This project demonstrates an ESP32-based system for generating and decoding NMEA (National Marine Electronics Association) data. The ESP32 connects to a Wi-Fi network and hosts a web server that provides a user interface for generating sample NMEA data and uploading NMEA files for decoding.
git clone https://github.com/Esmail-sarhadi/ESP32-NMEA-Generator-Decoder-WebServer.git
esp32-nmea-data.inoWiFi, WebServer, FS, and SPIFFS from the Arduino Library Manager if not already installed. const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";
esp32-nmea-data.ino: The main Arduino sketch that initializes the web server and handles requests.index.html: The HTML file served to the client, containing the web interface.data: Directory containing additional files to be served by the ESP32 (if any).generateRandomNMEAData(): Generates random NMEA sentences.generateRandomTime(): Generates a random time string.generateRandomCoordinate(bool isLatitude): Generates random latitude or longitude coordinates.generateRandomSatelliteCount(): Generates a random satellite count.calculateChecksum(String nmea): Calculates the checksum for an NMEA sentence.decodeNMEAData(String nmea_data): Decodes NMEA data and extracts information from GPGGA sentences.process_gpgga_line(const String& line, GPGGAData& data): Processes individual GPGGA sentences.generateRandomNMEAData()Generates a series of random NMEA sentences (GPGGA) with valid checksums. This function creates 10 GPGGA sentences with randomly generated time, coordinates, and satellite counts.
generateRandomTime()Generates a random time string in the format HHMMSS. This is used to simulate the time component in NMEA sentences.
generateRandomCoordinate(bool isLatitude)Generates a random coordinate string. If isLatitude is true, it generates a latitude coordinate; otherwise, it generates a longitude coordinate. The coordinates are generated in degrees and minutes, with a random direction (N/S for latitude, E/W for longitude).
generateRandomSatelliteCount()Generates a random satellite count between 1 and 12. This simulates the number of satellites tracked by the receiver.
calculateChecksum(String nmea)Calculates the checksum for an NMEA sentence. The checksum is calculated by XORing all characters between the ‘$’ and ‘*’ characters in the sentence.
decodeNMEAData(String nmea_data)Decodes NMEA data, specifically GPGGA sentences, and extracts information such as time, latitude, longitude, and satellite count. The extracted data is formatted into a human-readable string.
process_gpgga_line(const String& line, GPGGAData& data)Processes an individual GPGGA sentence and extracts the relevant data into a GPGGAData structure. This function splits the sentence into its components and assigns them to the corresponding fields in the GPGGAData structure.
Check out my GitHub profile: Esmail Sarhadi
View this project on GitHub: ESP32-NMEA-Generator-Decoder-WebServer
If you find this project helpful, consider making a donation:
This project is licensed under the MIT License - see the LICENSE file for details.