Home ARDUINO Build Your Own Vehicle Tracking System using Arduino (Start with Sim808 )

Build Your Own Vehicle Tracking System using Arduino (Start with Sim808 )

2
Build Your Own Vehicle Tracking System using Arduino (Start with Sim808 )

Build Your Own Vehicle Tracking System using Arduino (Start with Sim808 )

This article describes SIM808 hardware interface in great detail. This article can help user to quickly understand SIM808 interface specifications, electrical and mechanical details. With the help of this articles and other SIM808 application notes, user guide, users can use SIM808 to design various applications quickly.

SIM808 Overview

Designed for a global market, SIM808 is integrated with a high-performance GSM/GPRS engine, a GPS engine and a BT engine. SIM808 is a quad-band GSM/GPRS module that works on frequencies GSM 850MHz, EGSM 900MHz, DCS 1800MHz and PCS 1900MHz. SIM808 features GPRS multi-slot class 12/ class 10 (optional) and supports the GPRS coding schemes CS-1, CS-2, CS-3 and CS-4. The GPS solution offers best-in-class acquisition and tracking sensitivity, Time-To-First-Fix (TTFF) and accuracy.

With a tiny configuration of 24242.6mm, SIM808 can meet almost all space requirements in users’ applications, such as M2M, smartphone, PDA, tracker and other mobile devices.

Why with SIM808?

SIM808 has 68 SMT pads, which provide all hardware interfaces between the module and customers’ boards.

  • Support 4*4keypads by default
  • One full modem serial port (UART interface)
  • One USB, which support debug and firmware upgrading.
  • Audio channels which include a microphone input and a receiver output.
  • One SIM card interface.
  • Charging interface.
  • Programmable general purpose input and output (GPIO).
  • Support Bluetooth function.
  • Support GPS function.
  • Support two PWMs and two ADCs.
  • PCM/SPI interface.
  • SIM808 is designed with power saving technique so that the current consumption is as low as 1.2mA in sleep mode (with GPS engine powered down).
  • SIM808 integrates TCP/IP protocol and extended TCP/IP AT commands which are very useful for data transfer applications.

How to connect SIM 808 Module with Arduino UNO?

Hardware and Software Required

SIM 808 Module ( Buy here )

                                                      OR

Hardware connections

The SIM808 module has to be connected to Uno as follows:

Vcc to 5V

Gnd to Gnd

RXD to digital pin 10

TXD to digital pin 11

Note:

When the board is power on, the LED (PWR) will light up. After a long press (about 2 second) on this button, the other three LEDs(D3, D4,D5) will be light. And one of them starts to flash, this suggests that SIM808 is beginning to work now. When the power supply, GSM and GPS antenna and SIM card are connected to the module correctly, the LED will be flash slowly (3Second delay), that indicates that the module is registered to the network, and the user can make a call or do something else.

AT Commands for using the SIM808 Module

AT Commands for GSM

AT Press ENTER

Checking the Operation and Connection of GSM Shield. This would print OK which signifies of working connection and operation of the GSM shield.

ATD+ (country code) mobile number; Press ENTER

Making a Voice Call

ATH Press ENTER

Disconnecting the Active Call

ATA Press ENTER

Receiving the Call

AT+CMGF=1 Press ENTER

For sending SMS in text Mode

AT+CMGS=” mobile number” Press ENTER

Once the AT commands is given’ >’ prompt will be displayed on the screen. Type the message to be sent via SMS. After this, Press CTRL+Z to send the SMS. If the SMS sending is successful, “OK” will be displayed along with the message number.

AT+CMGF = 1 Press ENTER

For reading SMS in the text mode

AT+CMGR = num

Number (num.) is the message index number stored in the SIM card. For new SMS, URC will be received on the screen as + CMTI: SM ‘num’. After this AT+CMGR=1 Press ENTER. This displays the message on the screen along with sender details, number and timing too. For more AT commands, visit here

AT Commands for Bluetooth

Send pairing request to other Bluetooth device

AT+BTPOWER=1

Power on BT radio

AT+BTSCAN=1,20

Inquiring surrounding BT device

AT+BTPAIR=0,6

Try to pair the sixth BT device in the view list.(0,6 denotes the 6th BT device)

AT+BTPAIR =2,0000

Answer to the pairing request in passkey mode

Accept request from other BlueTooth device

AT+BTPOWER=1

Power on BT radio

AT+BTPAIR=1,1

Accept pairing request, and paired successfully

AT+BTPAIR=2,0000

Accept pairing request, and paired successfully. Default passkey of other BT device is 0000.

Connect service

AT+BTCONNECT=1,2

Connect with the second profile service of first paired device.

Accept file from paired device

AT+BTOPPACPT=1

Accept file (stored in internal memory card by default, input “AT+BTOPPACPT=1,1” if want it stored in external memory

Send file to other paired BT device

AT+BTOPPPUSH=1, c:\User\BtReceived\link.txt

LETS Program with Arduino UNO

Note: if you are Beginner please follow my previous article so then you can learn how to setup Arduino UNO Beginner Guide for Adruino

Upload this Code

 

#include <DFRobot_sim808.h>

#include <SoftwareSerial.h>

#define MESSAGE_LENGTH 160

char message[MESSAGE_LENGTH];

int messageIndex = 0;

char MESSAGE[300];

char lat[12];

char lon[12];

char wspeed[12];

 

char phone[16];

char datetime[24];

 

#define PIN_TX    10

#define PIN_RX    11

SoftwareSerial mySerial(PIN_TX,PIN_RX);

DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,

 

void setup()

{

mySerial.begin(9600);

Serial.begin(9600);

 

//******** Initialize sim808 module *************

while(!sim808.init())

{

Serial.print(“Sim808 init error\r\n”);

delay(1000);

}

delay(3000);

 

if( sim808.attachGPS())

Serial.println(“Open the GPS power success”);

else

Serial.println(“Open the GPS power failure”);

 

Serial.println(“Init Success, please send SMS message to me!”);

}

 

void loop()

{

//*********** Detecting unread SMS ************************

messageIndex = sim808.isSMSunread();

 

//*********** At least, there is one UNREAD SMS ***********

if (messageIndex > 0)

{

Serial.print(“messageIndex: “);

Serial.println(messageIndex);

 

sim808.readSMS(messageIndex, message, MESSAGE_LENGTH, phone, datetime);

 

//***********In order not to full SIM Memory, is better to delete it**********

sim808.deleteSMS(messageIndex);

Serial.print(“From number: “);

Serial.println(phone);

Serial.print(“Datetime: “);

Serial.println(datetime);

Serial.print(“Recieved Message: “);

Serial.println(message);

 

while(!sim808.getGPS())

{

 

}

 

 

Serial.print(sim808.GPSdata.year);

Serial.print(“/”);

Serial.print(sim808.GPSdata.month);

Serial.print(“/”);

Serial.print(sim808.GPSdata.day);

Serial.print(” “);

Serial.print(sim808.GPSdata.hour);

Serial.print(“:”);

Serial.print(sim808.GPSdata.minute);

Serial.print(“:”);

Serial.print(sim808.GPSdata.second);

Serial.print(“:”);

Serial.println(sim808.GPSdata.centisecond);

Serial.print(“latitude :”);

Serial.println(sim808.GPSdata.lat);

Serial.print(“longitude :”);

Serial.println(sim808.GPSdata.lon);

Serial.print(“speed_kph :”);

Serial.println(sim808.GPSdata.speed_kph);

Serial.print(“heading :”);

Serial.println(sim808.GPSdata.heading);

Serial.println();

 

float la = sim808.GPSdata.lat;

float lo = sim808.GPSdata.lon;

float ws = sim808.GPSdata.speed_kph;

 

dtostrf(la, 6, 2, lat); //put float value of la into char array of lat. 6 = number of digits before decimal sign. 2 = number of digits after the decimal sign.

dtostrf(lo, 6, 2, lon); //put float value of lo into char array of lon

dtostrf(ws, 6, 2, wspeed);  //put float value of ws into char array of wspeed

 

sprintf(MESSAGE, “Latitude : %s\nLongitude : %s\nWind Speed : %s kph\nMy Module Is Working. Mewan Indula Pathirage. Try With This Link.\nhttp://www.latlong.net/Show-Latitude-Longitude.html\nhttp://maps.google.com/maps?q=%s,%s\n”, lat, lon, wspeed, lat, lon);

 

Serial.println(“Sim808 init success”);

Serial.println(“Start to send message …”);

Serial.println(MESSAGE);

Serial.println(phone);

sim808.sendSMS(phone,MESSAGE);

//************* Turn off the GPS power ************

sim808.detachGPS();

 

}

}

After Upload

After upload code to Arduino via Arduino IDE open the Serial Monitor in 9600 Serial Monitor so you can get the information that hardware their and send the text to the SIM808 and it will text back you with the longitude and latitude of real time location, as well as you will get the google map link in the return text. As the mention image Below

Here is the video tutorial let me know if you face any problem with it

 

Hope my article “Build Your Own Vehicle Tracking System using Arduino (Start with Sim808 )” helps you to Start with Sim808 with Arduino UNO/How to Build Vehicle Tracking System.

 

Advertisements

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here