GNSS receiver for land surveying based on ESP32

Student: Alexandru Rares Apostol, ACES
Master: ACES

1. Introduction

The purpose of this project involves the development of a GNSS receiver for land surveying applications. The receiver will provide accurate positioning on-site and provide a user friendly application for viewing the generated perimeters. All these features will be available at the press of a button, where the precise position will be stored in a database.

2. Hardware

The hardware components needed for this project are:

  • 1 x ESP32
  • 1 x GNSS receiver module
  • 1 x GNSS antenna (L1, L2, L5 bands)
  • Jumper wires
  • 1 x Micro USB data cable
  • 1 x Button
  • PC with an internet connection and with Arduino IDE

Fig. 2.1. - Overview

Fig. 2.2 - Electronic Diagram

3. Software

The following flowchart of the software architecture shows the states and transitions which the application will execute. Initially, the application configures the required peripherals and I/Os and then performs updates on the incoming NMEA sentences. When an interrupt is detected on the designated digital I/O pins, the application performs additional instructions in which it constructs the GeoJSON and sends it to the remote database.

In this section I will describe the configurations implemented in order to obtain the desired functionality. The code starts by including the Firebase libraries which are used by the ESP32 to send and receive data from the remote database, and the ESP8266WiFi and EEPROM libraries for connecting to the internet and storing the updated value of certain data.

  #include <Arduino.h>
  #include <ESP8266WiFi.h> 
  #include <Firebase_ESP_Client.h>
  #include <EEPROM.h>
  //Provide the token generation process info.
  #include "addons/TokenHelper.h"
  //Provide the RTDB payload printing info and other helper functions.
  #include "addons/RTDBHelper.h"

The setup function performs the initialization of the used peripherals, which include:

  • Serial
  • WiFi
  • Firebase
  • Interrupts
  void setup() {
// Initialize UART
// Initialize Wifi
Serial.print("Connecting to ");
WiFi.begin(_SSID, _PWD);
while (WiFi.status() != WL_CONNECTED) {
Serial.print("WiFi connected with IP: ");
// Configure Firebase
// Assign the API Key
conf.api_key = API_KEY;
// Assign the RTDB URL
conf.database_url = DATABASE_URL;
// Sign up
if (Firebase.signUp(&conf, &auth, "", "")){
  signupOK = true;
} else{
  Serial.println("nui ok gion");
  Serial.printf("%s\n", conf.signer.signupError.message.c_str());
 /* Assign the callback function for the long running token generation task */
conf.token_status_callback = tokenStatusCallback;
Firebase.begin(&conf, &auth);
count =;
count1 =;
// Configure button input
pinMode(interruptPin, INPUT);
attachInterrupt(digitalPinToInterrupt(interruptPin), interruptFunction, FALLING);
attachInterrupt(digitalPinToInterrupt(nextArrayPin), nextArrayHandle, FALLING);
Serial.println("Setup finished");

During the loop, the receiver performs continuous updates of the incoming NMEA messages, and when the button is pressed, the latest parsed NMEA message is uploaded on Firebase as GeoJSON.

void loop() {
// Firebase Error Handling ************************************************
if (!Firebase.ready()) {
  Firebase.begin(&conf, &auth);
  Serial.println("Connection to firebase failed. Reconnecting...");
} else {
  if (isButtonPressed) {
    Serial.print("Lat: ");
    Serial.print("Long: ");
    Firebase.RTDB.setDouble(&fbdo, "location1/perimeter/geometry/coordinates/" + String(count1) + "/" + String(count) + "/0/", NMEA.gnss.longitude_deg);  
    Firebase.RTDB.setDouble(&fbdo, "location1/perimeter/geometry/coordinates/" + String(count1) + "/" + String(count) + "/1/", NMEA.gnss.latitude_deg);  
    EEPROM.write(0, count);
    isButtonPressed = false;
if (isNextArrayPressed) {
  count = 0;
  EEPROM.write(0, count);
  EEPROM.write(1, count1);
  isNextArrayPressed = false;

Subsequently, after the data has been added to the database, a React application has been included in order to properly view the inputted data and verify the obtained perimeters overlayed on the Open Street Map.

4. Challenges

The main challenge in this project was that the React frontend required a certain type of JSON, so multiple changes had to be made in order for it to work. Also in the frontend, in order to represent the pins as a perimeter, multiple Open Street Map overlays had to be implemented and used (it is also the reason why the pins are editable via the map).

5. Conclusions

The approach is feasible as the only on-site constraint is the availability of the wireless connection and the internet is becoming available worldwide due to the emerging Starlink. It still requires more user-friendly interactions, but this proof of concept is enough to validate this application type.

6. Resources

iothings/proiecte/2022/gnsslandsurvey.txt · Last modified: 2023/01/20 11:22 by alexandru.apostol
CC Attribution-Share Alike 3.0 Unported Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0