Book Image

Internet of Things Projects with ESP32

By : Agus Kurniawan
Book Image

Internet of Things Projects with ESP32

By: Agus Kurniawan

Overview of this book

ESP32 is a low-cost MCU with integrated Wi-Fi and BLE. Various modules and development boards-based on ESP32 are available for building IoT applications easily. Wi-Fi and BLE are a common network stack in the Internet of Things application. These network modules can leverage your business and projects needs for cost-effective benefits. This book will serve as a fundamental guide for developing an ESP32 program. We will start with GPIO programming involving some sensor devices. Then we will study ESP32 development by building a number of IoT projects, such as weather stations, sensor loggers, smart homes, Wi-Fi cams and Wi-Fi wardriving. Lastly, we will enable ESP32 boards to execute interactions with mobile applications and cloud servers such as AWS. By the end of this book, you will be up and running with various IoT project-based ESP32 chip.
Table of Contents (12 chapters)

Parsing GPS data

We have built the gpsdemo project to read GPS data via the UART interface. We can see that the GPS module output shows raw data. To obtain the current position of our location with the GPS module, we should parse our GPS data. There are a number of libraries that we can use to parse GPS data.

For our project, we can use the minmea library (https://github.com/kosma/minmea). You can download the minmea project and extract it into components for our project. You can see how to to implement minmea as the ESP32 component in Figure 7.6:

Figure 7.6: The project structure for the gpsdemo project

Now we can modify our gpsdemo project. We do this by adding minmea.h in our main program file:

// minmea
#include "minmea.h"

We also define latitude, longitude, fix_quality, and satellites_tracked as variables to hold our current GPS data:

// GPS variables and initial...