Toggle Nav

GPS Car Tracker Using Arduino And SIM808


GPS Car tracker with Arduino Project

Table of Contents


Thousands of cars are being stolen every day around the globe. So it is really important to protect and secure your car. In this tutorial we will use the SIM808 module to build a GPS car tracker.

If you are not willing to use a GPS read this article to find out how to detect location by GSM modules: (Using GSM with Arduino as an alternative for GPS).

What You Will Learn

  • Get to know with the concept of GPS
  • Get to know with the sim808 module
  • Build a GPS car tracker

What is GPS and how does it work?

GPS stands for Global Positioning System, which designed and built in 1973 by the United States Department of Defense. Today, the use of GPS has become so common that almost all of us use this system daily.

The GPS system includes 24 satellites. For the car tracker project (or any other project) you need a GPS receiver to receive information sent from this satellite. All your GPS receiver has to do is identify four satellites and read information from them to calculate your position with a series of geometric relationships.

GPS can provide your position with very high accuracy, but the satisfaction of this accuracy depends on your GPS receiver, typical GPS modules have an accuracy of between 2 and 5 meters.

The most important information we can get from the GPS system are: longitude, latitude, speed, height and time in Greenwich Mean Time.

Ublox is a leading company in the industry of manufacturing GPS modules, but to receive GPS information, we can also use the SIM808 module manufactured by SIMCOM.

What is SIM808 module?

We usually used a series of SIM modules for sending and receiving SMS, making calls, using GPRS, etc., but the SIM808 module has a special feature and that is GPS receiver. This in combination with Arduino,  makes it perfect for our car tracker device

The most important features of this module are the following:

  • Operation voltage 3.4 to 4.4 volt
  • Quad Band GSM/GPRS
  • Capability to send and receive SMS and calls
  • Capability to install microphones and speakers
  • Up to 2A current while connecting
  • GPS and Bluetooth support
  • serial port interface

This module, like other SIM series modules, interacts with AT commands, and the AT commands of this module and other SIM modules are the same for text message, call, GPRS, etc. (If you need to be more familiar with these commands, read the Using GSM with Arduino as an alternative for GPS)

But the AT commands for GPS communication are specific to the SIM808 module, will mention the most important of them as follow:

Command Application
AT+CGNSPWR=0 or 1 Turn GPS on (1) or off (2) If you do not use GPS, turn off this unit with this command to avoid wasting power on your system.
AT+CGPSRST=0 or 1 or 2 Activate HOT mode (1) or WARM mode (2) or COLD mode (0) in GPS. In cases where the GPS antenna is weak, the HOT mode can solve this problem to some extent, but instead consumes more power
AT+CGNSTST =0 or 1 GPS performance test. If everything is correct, by turning on this test (1), a set of GPS information will be delivered to you.
AT+CGNSINF Get GPS information. By entering this command you can get GPS information. This information will be in this format: +CGNSINF: ,, ,,, ,, , , , ,, ,,, , ,,,,

You can see the AT + CGNSINF command information in the table below:

Now you can create a professional GPS by extracting this information.

GPS is not designed for indoor applications, so it is necessary to install an outdoor GPS antenna.

Required Materials

Hardware Components

Arduino UNO R3 × 1
SIM808 Module + IPX SMA GSM GPS Antenna × 1
0.96" I2C OLED Display Module × 1
NodeMCU ESP8266 ESP-12E Board × 1
12v-5A Power Adaptor × 1
Female to Female Jumper Wire × 1

Software Apps

Arduino IDE

Build A GPS Vehicle Tracking Device

In the following image, you can see the module used in our car tracker device:


After connecting the power supply, you must press the vertical key on the board for at least 1 second.

For this project, you can use the DFRobot_SIM808 library to communicate between Arduino and SIM808.


Using AT commands is a more common approach.


#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
#include "U8glib.h"
#include "logo.h"
#define PIN_TX    3
#define PIN_RX    2
SoftwareSerial mySerial(PIN_TX, PIN_RX);
#define MESSAGE_LENGTH 160
char message[MESSAGE_LENGTH];
int messageIndex = 0;
char MESSAGE[300];
char lat[12];
char lon[12];
char phone[16];
char datetime[24];

int progressbar = 0;

DFRobot_SIM808 sim808(&mySerial);
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_DEV_0);

void clearOLED() {
  do {
  } while ( u8g.nextPage() );

void OLED_init() {

void loading_menu() {
  while (progressbar < 129) {
    do {
      u8g.drawFrame(0, 30, 128, 20);
      u8g.drawBox(0, 30, progressbar, 20);
    } while (u8g.nextPage());
    if (progressbar < 129) progressbar ++;
    else progressbar = 0;
void show_signal(int signal_strength) {
  if (signal_strength > 20)
    u8g.drawBitmapP(110, 0, 2, 16, signal_3);
  else if ((signal_strength < 20) && (signal_strength > 14))
    u8g.drawBitmapP(110, 0, 2, 16, signal_2);
  else if ((signal_strength < 14) && (signal_strength > 9))
    u8g.drawBitmapP(110, 0, 2, 16, signal_1);
    u8g.drawBitmapP(110, 0, 2, 16, signal_0);

void show_data(float la, float lo, float s) {
  do {
    u8g.drawStr(10, 40, "la = ");
    u8g.setPrintPos(60, 40);
    u8g.drawStr(10, 60, "lo = ");
    u8g.setPrintPos(60, 60);
  } while (u8g.nextPage());

void setup() {
  while (!sim808.init()) {
    Serial.print("Sim808 init error\r\n");
  if ( sim808.attachGPS())
    Serial.println("Open the GPS power success");
    Serial.println("Open the GPS power failure");

void loop() {
  while (!sim808.getGPS()) {}
  Serial.print("latitude :");
  Serial.println(, 6);
  Serial.print("longitude :");
  Serial.println(sim808.GPSdata.lon, 6);


  float la =;
  float lo = sim808.GPSdata.lon;
  show_data(la, lo, 25);
  dtostrf(la, 6, 2, lat); 
  dtostrf(lo, 6, 2, lon); 
  sprintf(MESSAGE, "Check the link.\n,%s\n", lat, lon);

  messageIndex = sim808.isSMSunread();
  if (messageIndex > 0) {
    sim808.readSMS(messageIndex, message, MESSAGE_LENGTH, phone, datetime);
    if (message == "1") {
      sim808.sendSMS(phone, MESSAGE);

By sending the number 1 to the SMS system, the link of Google Map will be sent to you for your car.

The Google link is as follows:,lot

Please note that latitude and longitude are also displayed on the screen.

We used the U8glib library for the display.

What’s Next?

  • Upload the received information to the server.

Liked What you see?

Get updates and learn from the best

More To Explore

Leave a Reply

Your email address will not be published. Required fields are marked *