Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » GPS Tracker using A9G GPRS/GPS Module & Arduino
Arduino Projects

GPS Tracker using A9G GPRS/GPS Module & Arduino

Mamtaz AlamBy Mamtaz AlamUpdated:June 19, 20231 Comment3 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
A9G GPS Tracker Arduino
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Overview: GPS Tracker using A9G GPRS/GPS Module & Arduino

In this project, we will make GPS Tracker Project using A9G GPRS/GPS Module & Arduino. The Maduino A9G GPS Tracker is an IoT (Internet of things) Solution-based product that integrates a Microcontroller ATSAMD21G18, GRRS/GSM+GPS module A9G with best power management and storage.

A GPS tracker is a navigation device normally carried by a moving vehicle or person that uses the Global Positioning System (GPS) to track the device’s movements and determine its location. The recorded location data can either be stored within the tracking unit or transmitted to an Internet-connected device using the cellular (GPRS or SMS) unit. This allows the location to be displayed against a map backdrop either in real-time or when analyzing the track later, using GPS tracking software.

This post is a continuation of the previous tutorial: Getting Started with A9G GSM/GPRS+GPS Module with Arduino. I highly recommend you to go through the previous post first before moving here directly. The previous post contains all the information about A9/A9G GPRS/GSM Module as well as Maduino Zero A9G Board. All the detailed setup guide and device preparation is explained there.

You may refer to some previous GPS Tracker-based projects:

  • Real Time GPS Tracker using ESP8266 & Blynk with Maps
  • ESP32 GPS Tracker using L86 GPS Module & OLED Display
  • GPS+GSM Based Vehicle Tracking System using Arduino
  • LoRa Based Low Power GPS Tracker with Arduino & ESP8266

AT Commands for getting GPS Data

Maduino Zero A9G GPS Tracker

To turn ON/OFF the GPS, you can send the following command.

1
2
AT+GPS=1       //Turn ON GPS
AT+GPS=0       //Turn OFF GPS

The following AT Command is used to read NEMA information every 10 seconds.

1
AT+GPSRD=10

To stop retrieving NEMA information every 10 seconds, you can use send the following command.

1
AT+GPSRD=0

To get the GPS information in terms of Latitude & Longitude, you can use send the following command.

1
AT+LOCATION=2

Note: These commands are practically explained in Previous Post




How to get GPS Location information?

Copy the below code and upload it to the Maduino A9G Board using Arduino IDE. Once the code is uploaded the A9G GPS Tracker is ready.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include <stdio.h>
#include <string.h>
 
#define DEBUG true
int PWR_KEY = 9;
int RST_KEY = 6;
int LOW_PWR_KEY = 5;
 
bool ModuleState=false;
unsigned long timeCount;
 
void setup()
{
    pinMode(PWR_KEY, OUTPUT);
    pinMode(RST_KEY, OUTPUT);
    pinMode(LOW_PWR_KEY, OUTPUT);
    digitalWrite(RST_KEY, LOW);
    digitalWrite(LOW_PWR_KEY, HIGH);
    digitalWrite(PWR_KEY, HIGH);
 
    SerialUSB.begin(115200);
    while (!SerialUSB)
    {
        ; // wait for serial port to connect
    }
    Serial1.begin(115200);
    digitalWrite(PWR_KEY, LOW);
    delay(3000);
    digitalWrite(PWR_KEY, HIGH);
    delay(5000);
        ModuleState=moduleStateCheck();
        if(ModuleState==false)//if it's off, turn on it.
        {
            digitalWrite(PWR_KEY, LOW);
            delay(3000);
            digitalWrite(PWR_KEY, HIGH);
            delay(5000);
      SerialUSB.println("Now turnning the A9/A9G on.");
        }
 
    //GPS test
    sendData("AT+GPS=1", 1000, DEBUG);//1: turn on GPS  0:Turn off GPS
    sendData("AT+GPSRD=10", 1000, DEBUG);//Read NEMA information every 10 seconds
 
    sendData("AT+LOCATION=2", 1000, DEBUG);//AT+LOCATION=X  //1:Get base address, 2:get gps address
        
    //sendData("AT+CCID", 3000, DEBUG);
    //sendData("AT+CREG?", 3000, DEBUG);
    //sendData("AT+CGATT=1", 1000, DEBUG);
    //sendData("AT+CGACT=1,1", 1000, DEBUG);
    //sendData("AT+CGDCONT=1,\"IP\",\"CMNET\"", 1000, DEBUG);
    
    //sendData("AT+CIPSTART=\"TCP\",\"www.mirocast.com\",80", 2000, DEBUG);
    timeCount=millis();
    SerialUSB.println("Maduino A9/A9G GPS Test Begin!");
}
 
void loop()
{
  
  if(millis()-timeCount>5000)
  {
    sendData("AT+LOCATION=2", 1000, DEBUG);
    timeCount=millis();//refresh
  }
  while (Serial1.available() > 0) {
    SerialUSB.write(Serial1.read());
    yield();
  }
  while (SerialUSB.available() > 0) {
    Serial1.write(SerialUSB.read());
    yield();
  }
}
 
bool moduleStateCheck()
{
    int i = 0;
    bool state=false;
    for (i = 0; i < 10; i++)
    {
        String msg = String("");
        msg = sendData("AT", 1000, DEBUG);
        if (msg.indexOf("OK") >= 0)
        {
            SerialUSB.println("A9/A9G Module had turned on.");
                state=true;
            return state;
        }
        delay(500);
    }
    return state;
}
 
String sendData(String command, const int timeout, boolean debug)
{
    String response = "";
    Serial1.println(command);
    long int time = millis();
    while ((time + timeout) > millis())
    {
        while (Serial1.available())
        {
            char c = Serial1.read();
            response += c;
        }
    }
    if (debug)
    {
        SerialUSB.print(response);
    }
    return response;
}

After uploading the code, open the Serial Monitor and set the baud rate to 115200. The Module will take some time to retrieve data from Satellite. And soon it will display the NEMA information as well as Latitude, Longitude Coordinates.

We can show our location where we are in https://www.gps-coordinates.net/




A9G GPS Tracker on OLED Display

Now let us add an extra OLED Display to the board so that we can retrieve GPS information on OLED display. We need two library for OLED Display.
1. Adafruit GFX Library: https://github.com/adafruit/Adafruit-GFX-Library
2. SSD130 OLED Library: https://github.com/adafruit/Adafruit_SSD1306

Now copy the below code and upload it to the Maduino A9G Board.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#include <stdio.h>
#include <string.h>
 
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
 
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
 
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
 
void(* resetFunc) (void) = 0; //declare reset function at address 0
 
#define DEBUG true
int PWR_KEY = 9;
int RST_KEY = 6;
int LOW_PWR_KEY = 5;
 
bool ModuleState=false;
unsigned long timeCount;
 
void setup()
{
    pinMode(PWR_KEY, OUTPUT);
    pinMode(RST_KEY, OUTPUT);
    pinMode(LOW_PWR_KEY, OUTPUT);
    digitalWrite(RST_KEY, LOW);
    digitalWrite(LOW_PWR_KEY, HIGH);
    digitalWrite(PWR_KEY, HIGH);
 
    SerialUSB.begin(115200);
    //while (!SerialUSB)
    {
        ; // wait for serial port to connect
    }
    Serial1.begin(115200);
    digitalWrite(PWR_KEY, LOW);
    delay(3000);
    digitalWrite(PWR_KEY, HIGH);
    delay(5000);
        ModuleState=moduleStateCheck();
        if(ModuleState==false)//if it's off, turn on it.
        {
            digitalWrite(PWR_KEY, LOW);
            delay(3000);
            digitalWrite(PWR_KEY, HIGH);
            delay(5000);
      SerialUSB.println("Now turnning the A9/A9G on.");
        }
 
    //GPS test
    sendData("AT+GPS=1", 1000, DEBUG);//1: turn on GPS  0:Turn off GPS
    sendData("AT+GPSRD=10", 1000, DEBUG);//Read NEMA information every 10 seconds
 
    sendData("AT+LOCATION=2", 1000, DEBUG);//AT+LOCATION=X  //1:Get base address, 2:get gps address
        
  
 
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
    {
        SerialUSB.println("Now reset the maduino zero");
        delay(1000);
        resetFunc();//restart
       delay(20);
    }
  }
  delay(2000);
  display.clearDisplay();
 
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 10);
  //Display static text
  display.println("how2electronics.com!");
  display.println("Maduino Zero A9/A9G GPS Tracker!");
  display.display();
  delay(2000);
  
  timeCount=millis();
  SerialUSB.println("Maduino A9/A9G GPS Test Begin!");
  display.clearDisplay();
}
 
void loop()
{
  
  if(millis()-timeCount>5000)
  {
    sendData("AT+LOCATION=2", 1000, DEBUG);
    timeCount=millis();//refresh
  }
  while (Serial1.available() > 0)
  {
    display.clearDisplay();
    String cstring = Serial1.readString();
    SerialUSB.print(cstring);//SerialUSB.write(Serial1.read());
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 0);
    display.println(cstring);
    display.display();
    yield();
  }
  while (SerialUSB.available() > 0) {
    Serial1.write(SerialUSB.read());
    yield();
  }
}
 
bool moduleStateCheck()
{
    int i = 0;
    bool state=false;
    for (i = 0; i < 10; i++)
    {
        String msg = String("");
        msg = sendData("AT", 1000, DEBUG);
        if (msg.indexOf("OK") >= 0)
        {
            SerialUSB.println("A9/A9G Module had turned on.");
                state=true;
            return state;
        }
        delay(500);
    }
    return state;
}
 
String sendData(String command, const int timeout, boolean debug)
{
    String response = "";
    Serial1.println(command);
    long int time = millis();
    while ((time + timeout) > millis())
    {
        while (Serial1.available())
        {
            char c = Serial1.read();
            response += c;
        }
    }
    if (debug)
    {
        SerialUSB.print(response);
    }
    return response;
}

After the code is uploaded, the A9G GSM/GPRS + GPS Module will take some time to get the data. Once it receives data, the information will be displayed on OLED Display.

GPS Tracker A9G Arduino OLED



You can check the next post of this Series here: Internet with A9G Low Power GPRS+GPS Module & Arduino


Video Tutorial & Complete Guide

A9G Low Power GPRS/GSM + GPS Module for Cellular IoT Applications | SMS, GPS Tracker & Internet
Watch this video on YouTube.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleHome Automation using Google Firebase & NodeMCU ESP8266
Next Article Internet with A9G Low Power GPRS+GPS Module & Arduino

Related Posts

DC Energy Meter using Arduino

Build a DC Energy Meter using Arduino – 32V/5A

Updated:August 26, 20252K
Interfacing ADXL375 Accelerometer with Arduino

Interfacing ADXL375 Accelerometer with Arduino (±200g)

Updated:June 28, 2025
PZEM-004T Arduino Energy Meter

DIY AC Energy Meter using PZEM-004T & Arduino

Updated:March 6, 20258K
Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Updated:February 2, 20259K
Password Based Door Lock Security System Using Arduino & Keypad

Password Based Door Lock Security System Using Arduino & Keypad

Updated:February 2, 20252436K
Earthquake Detector Alarm with with Accelerometer & Arduino

Earthquake Detector Alarm with Accelerometer & Arduino

Updated:February 2, 2025661K
View 1 Comment

1 Comment

  1. GUNASHEKAR ADUPA on June 1, 2023 1:30 AM

    can you help me with connection diagram for above code….

    Reply

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 21, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • How to use Modbus RTU with ESP32 to read Sensor Data
    How to use Modbus RTU with ESP32 to read Sensor Data
  • IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
    IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
  • MAX30102 & Arduino: Heart Rate + Blood Oxygen Monitoring
    MAX30102 & Arduino: Heart Rate + Blood Oxygen Monitoring
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.