Getting Started and Interfacing GPS with ESP32

03.01.24 05:07 AM By AKB

Getting Started and Interfacing GPS with ESP32If you are an embedded engineer working in the electronic industry, and somewhere in the project you are required to determine the moving object's position or calculate the altitude and velocity for a specific location. In such instances, the integration of a GPS module becomes invaluable.


In this article you will understand how to get GPS coordinates(longitude, latitude, altitude), GPS speed, date-time information from the Allystar GEM1205 module.

So let’s get started!

Hardware Requirements

  1. ESP-Wroom 32 Dev Module

                                                                                                                                                                ESP 32

  1. Allystar GEM1205-2516AS0

                                                                                                                                                        GEM1205



  1. Jumper Wires

                                                                                                                                                      Jumper wires

  1. Breadboard

                                                                                                                                                       Breadboard


Software Requirements

  1. Arduino IDE

  2. GPS Libraries

Introduction to Allystar GEM1205 Module

                                                                                                                                GEM1205

Allystar GEM1205 is a high-performance dual-band (L1/L5) multi-system GNSS positioning module. It supports the global civil navigation systems, including GPS, IRNSS, BDS, GLONASS, Galileo, and QZSS. Embedded antennas ensure GEM1205 to work at L1 and L5 bands simultaneously to increase the number of visible satellites assisting by GPS, BDS, Galileo, and IRNSS signals, which makes this module achieve high positioning accuracy and short TTFF, especially in a rough urban environment. GEM1205 supports external active antennas featured with auto-detecting and auto-switching. With a compact body and high performance, GEM1205 is widely applied to tracking applications, like automotive, consumer, and industrial tracking.

GEM1205-2516AS0 Specifications

  • Supports GPS, BDS, IRNSS, Galileo and QZSS systems covering L1 and L5 bands 

  • Supports AGPS/DGPS/SBAS (WAAS/EGNOS/MSAS/GAGAN) 

  • Built-in LNA & SAW for better sensitivity 

  • Integrated with dual-feed (L1&L5) antenna 

  • Supports Geo-Fence function 

  • Supports message broadcast service for IRNSS 

  • Ultra-low power consumption around 40mA in dual-band tracking mode 

  • Supports external active antenna featured with auto-detecting and auto-switching 

  • Compact size: 26.7mm*18.5mm*7.0mm

Interfacing Allystar GEM1205 Module with ESP32 

Make the connections according to the schematic shown below:


                                                                                          Getting Started and Interfacing GPS with ESP32


  • Connect ESP32’s 3V pin to Vcc of module and Ground to Ground.

  • Connect 34 pin to TXD of the module.

  • Connect the 35 pin to the RXD of the module.

ESP32 Code

// After interfacing the Allystar GEM1205 module with ESP32 upload the following code in ESP32.

#include <TinyGPS++.h>

#define GPS_BAUDRATE 9600  // The default baudrate of Allystar GEM1205 module is 9600

TinyGPSPlus gps;  // the TinyGPS++ object

void setup() {

 Serial.begin(9600);

 Serial2.begin(GPS_BAUDRATE);

 Serial.println(F("ESP32 - GPS module"));

}

void loop() {

 if (Serial2.available() > 0) {

 if (gps.encode(Serial2.read())) {

 if (gps.location.isValid()) {

 Serial.print(F("- latitude: "));

 Serial.println(gps.location.lat());

 Serial.print(F("- longitude: "));

 Serial.println(gps.location.lng());

 Serial.print(F("- altitude: "));

 if (gps.altitude.isValid())

 Serial.println(gps.altitude.meters());

 else

 Serial.println(F("INVALID"));

 } else {

 Serial.println(F("- location: INVALID"));

 }

 Serial.print(F("- speed: "));

 if (gps.speed.isValid()) {

 Serial.print(gps.speed.kmph());

 Serial.println(F(" km/h"));

 } else {

 Serial.println(F("INVALID"));

 }

 Serial.print(F("- GPS date&time: "));

 if (gps.date.isValid() && gps.time.isValid()) {

 Serial.print(gps.date.year());

 Serial.print(F("-"));

 Serial.print(gps.date.month());

 Serial.print(F("-"));

 Serial.print(gps.date.day());

 Serial.print(F(" "));

 Serial.print(gps.time.hour());

 Serial.print(F(":"));

 Serial.print(gps.time.minute());

 Serial.print(F(":"));

 Serial.println(gps.time.second());

 } else {

 Serial.println(F("INVALID"));

 }


 Serial.println();

 }

 }

 if (millis() > 5000 && gps.charsProcessed() < 10)

 Serial.println(F("No GPS data received: check wiring"));

}

Applications Using Allystar GEM1205 Module with ESP32

  1. Real time location tracking

  2. Geofencing

  3. Outdoor navigation, etc and many more.

Conclusion

From the above tutorial on interfacing the Allystar GEM1205 module module with the ESP32, you now possess a valuable skill set to create diverse applications. As an embedded engineer in the electronic industry, the ability to determine object positions, calculate altitudes, and measure velocities becomes seamless with this integration.

For your hardware needs, trusted brands like Allystar GEM1205 module and ESP32 microcontrollers can be found at Campus Component. If you are looking for electronic components by Espressif and modules like GPS, GSM, reach out to the Electronics components suppliers- Campus Component today!

Added to cart
- There was an error adding to cart. Please try again.
Quantity updated
- An error occurred. Please try again later.
Deleted from cart
- Can't delete this product from the cart at the moment. Please try again later.