Skip to main content

ESP32 with Neo-6M GPS Module: Hardware Serial Code & Practical Implementation Guide


In this project, I used the ESP32 WROOM-32 development board in combination with the Neo-6M GPS module to acquire real-time satellite-based location data. The hardware components were interconnected using hardware serial (UART) to ensure reliable communication between the ESP32 and the GPS module. The wiring setup is illustrated below.

Neo-6M GPS Module     |      ESP32 WROOM-32
       Vcc      =====>   VIN (3.3V)
GND   =====>     GND
    TX      =====>    GPIO16
    RX     =====>   GPIO17

Snapshot of the NEO-6M GPS Module used in this project:

Front View of the NEO-6M GPS Module


Backside of the NEO-6M GPS Module

Snapshot of the ESP32 WROOM-32 Arduino board used in this project:


After the interconnecting these two boards you have to follow following procedures.

Install TinyGPS++ library:

  • Open Arduino IDE → Go to SketchInclude LibraryManage Libraries.
  • Search TinyGPS++ and install it.

Connect ESP32 via USB and select the correct board:

  • ToolsBoardESP32 WROOM DA module
  • ToolsPort → Select your ESP32’s port.
My board and port selection as follows:

Upload the code and open Serial Monitor (115200 baud).

Use following Arduino code read the GPS and write the results on the serial monitor.

#include <HardwareSerial.h>
#include <TinyGPS++.h>

static const int RXPin = 16, TXPin = 17; // ESP32 Hardware Serial pins
static const uint32_t GPSBaud = 9600;    // Default baud rate of Neo-6M

TinyGPSPlus gps;
HardwareSerial gpsSerial(1); // Using UART1

void setup() {
    Serial.begin(115200); // Monitor serial
    gpsSerial.begin(GPSBaud, SERIAL_8N1, RXPin, TXPin);

    Serial.println("GPS Module is starting...");
}

void loop() {
    while (gpsSerial.available()) {
        gps.encode(gpsSerial.read()); // Parse GPS data
       
        if (gps.location.isUpdated()) {
            Serial.print("Latitude: ");
            Serial.print(gps.location.lat(), 6);
            Serial.print(" Longitude: ");
            Serial.print(gps.location.lng(), 6);
            Serial.print(" Speed: ");
            Serial.print(gps.speed.kmph());
            Serial.println(" km/h");
        }
    }
}

Once the GPS module locks onto satellites, LED of the GPS will start to blink. then you will see Latitude, Longitude, and Speed in the Serial Monitor as follows:

Finally, my overall setup can be denote as this.




Comments

Most Popular Topics

Unboxing & Configuring Heltec ESP32 V3 LoRa Boards – Easy Peer-to-Peer Communication Setup

  LoRa (Long Range) is a wireless communication technology designed for long-distance, unlicensed frequency, low-power data transmission. It’s widely used in IoT (Internet of Things) applications where devices need to send small amounts of data over several kilometers without relying on Wi-Fi or cellular networks. With its low power consumption and extended range, LoRa is ideal for smart agriculture, environmental monitoring, and remote sensing projects. In this guide, I’ll walk you through my LoRa implementation setup using the Heltec ESP32 V3 boards. If you haven’t already installed the Arduino IDE on your computer, make sure to install it first. it’s essential for uploading code to your LoRa boards. Once the Arduino IDE is successfully installed, it should look like the screenshot below (or similar depending on your version). From there, follow the steps outlined in this tutorial to configure your boards for peer-to-peer communication. For this project, I used two Heltec ESP32 V...

Monitor Docker Services Using Grafana, Prometheus & cAdvisor — Without Touching the CLI

  If you're running Docker containers on a server, monitoring their performance using command-line tools can be time-consuming and difficult to visualize. In this guide, I’ll show you how to monitor your Docker services using Grafana, Prometheus, and cAdvisor—all through a web interface, without relying on CLI tools after setup. You’ll be able to: Track real-time Docker container metrics Visualize system performance through a Grafana dashboard Use Prometheus to scrape and expose container metrics Deploy everything using simple Docker commands Step 1: Run Your Docker Containers Make sure your Docker containers are already running. Here’s a snapshot of my currently active containers: Step 2: Install cAdvisor in a Docker Container To collect container metrics in real time, we’ll run cAdvisor inside a dedicated Docker container. Run the cAdvisor Container: sudo docker run   --volume=/:/rootfs:ro   --volume=/var/run:/var/run:rw   --volume=/sys:/sys:ro   --volume=/var...

Analyzing Seismic Waves from Human Footfalls Using IoT Vibration Sensors and AI

  In this test, I used an ESP32 development board, an ADS1115 16-bit analog-to-digital converter, and an SM-24 geophone sensor to capture seismic signals generated by human footfalls. Rather than relying on an external analog bandpass filter, which often introduces additional electrical noise. I implemented a digital bandpass filter directly on the ESP32 microcontroller. This software-based signal conditioning approach enabled more precise control over frequency filtering and reduced hardware complexity. The filter was designed to pass frequencies in the 5 Hz to 60 Hz range, which corresponds to the dominant frequency band of human footfall vibrations. The complete sensor setup for footfall vibration acquisition is illustrated below: Based on insights from prior research studies, the SM-24 geophone sensor exhibits higher accuracy and signal stability when buried at a depth of approximately 20 centimeters. To maximize seismic wave sensitivity, the sensor in this experiment was embed...

How to Design and Simulate a 4-Phase Interleaved Boost Converter Using MATLAB Simulink

In this case study, I investigate the performance of a 4-phase interleaved boost converter using MATLAB Simulink. This type of DC-DC converter architecture is widely used in high-efficiency power systems due to its improved current sharing and reduced output ripple. Each phase of the converter is symmetrically designed using identical passive components: Inductors: L₁ = L₂ = L₃ = L₄ = 1.5 mH Capacitors: C₁ = C₂ = 200 μF The converter supplies an inductive load that draws a constant output current of 5 A. The input voltage is fixed at 30 V, and the converter is operated at a duty cycle (D) of 0.6. The primary simulation objectives are to analyze: The voltage gain of the converter, The output voltage ripple characteristics, And the phase current sharing behavior under these operating conditions. Simulink design of 4-phase interleaved boost converter Simulink inputs and output of design Through this design and simulation, the following steady state waveforms can be evaluated: Load voltage...

Scientific Writing - Research Article

  Significant sections of the Research Article How to write an Abstract? The abstract section is very important for the scientific paper because it represents all the contents briefly of a paper and the reader will decide whether or not to read the whole article. This is written by summarizing the introduction section. It has to briefly include the  problem, method, findings, and conclusion usually in the factual or past tense. How to write an Introduction? Start with a broad overview of the research scope. You have to provide a general background of the field or topic. Then you write a  literature survey about the topic. It does a critical analysis of the existing research on a specific topic. The next step is explaining a problem statement or research gaps . Then you can be writing  research objectives to provide the solution to the given problem statement or research gaps. Finally write scope and limitations that explain how the limitations may have affec...

The Example two story house project scheduling in Project Management

First, we must identify the various activities that must be carried out in constructing a two-story house and group them into suitable work breakdown structures (WBS). The following figure indicates the WBS of this sample project and appropriate implementation periods for each activity. Note that the project has to complete within 12 months as a condition. Therefore, we have to be very careful when scheduling the duration of activities in order to complete the project on time. The next step is to build a project using a computer program. Here I used MS Project software and the following figure shows the Project plan and the status of activities completed. The red color activities and arrows indicate the critical path of the project. Path activities have to be completed between the exact period in order to hand over the project on time.

What is a Network Operation Center (NOC)? Key Functions, Roles, and Benefits

A Network Operation Center (NOC) is a centralized facility where IT professionals monitor, manage, and maintain network systems around the clock. Acting as the command center for network performance and security, a NOC ensures seamless communication, stability, and efficiency across an organization’s infrastructure. NOCs are responsible for a range of critical tasks, including: Monitoring network devices and data flows Maintaining system health and software updates Troubleshooting and identifying network anomalies Rectification of errors and service disruptions Escalating issues to higher-level support teams Supervising and organizing system operations A NOC can be either internally managed by the organization or outsourced to a managed service provider (MSP). The choice depends on factors such as company size, network complexity, and operational budget. NOC Performances Metrics and KPIs Who Needs a NOC? Organizations with large-scale or mission-critical networks—such as telecom pr...

How MPLS Powers Modern Telecom Infrastructure: Architecture, Case Study, and Enterprise Benefits

Abstract Multiprotocol Label Switching (MPLS) is a versatile network technology that enhances the performance, reliability, and scalability of data traffic management. This article explores a case study of MPLS, detailing its architecture and key components, such as Provider Edge (PE) Routers and Provider (P) Routers. It highlights the benefits of MPLS including simplified connectivity deployment, protocol efficiency, and improved performance. Through practical analysis and examples, this content provides a comprehensive understanding of MPLS networks, their implementation, and their role in modern telecom infrastructure. Introduction Multi-Protocol Label Switching (MPLS) is a pivotal routing technique primarily utilized in telecommunication networks. In this case study, all telecom network nodes are located in specialized core rooms that maintain strict environmental conditions and uninterrupted power to ensure reliable performance. These core rooms are geographically distributed to m...

How to make the network connectivity between CentOS VM and Windows host computer | Deploy a simple website on Apache server

  In this instructional video, I guide you through the crucial process of establishing network connectivity between a CentOS Virtual Machine (VM) running on VMware Player and a Windows 10 host computer. This skill is fundamental for various practical and industrial applications, ensuring seamless communication between systems. Subsequently, I demonstrate the step-by-step installation of the Apache server, a pivotal component for web hosting. To enhance your understanding, I walk you through the deployment of a straightforward webpage on the Apache server, providing practical insights into web hosting capabilities. Mastering these essential processes empowers you to optimize connectivity and elevate your server's functionality for diverse applications.