SIM808 GSM/GPRS/GPS Application

Overview:

A SIM808 module is a GSM/GPRS module that uses GPS technology to track items of interest. Its smaller and more compact design significantly saves time and reduces costs for potential customers to create their own GPS-enabled applications. With an industry-standard interface and a built-in GPS, it allows important items to be tracked at any location and anytime with good signal coverage.

This tutorial will explore the functions of the SIM808 module using Arduino, where the module will use its GPS function to detect your location using your SIM card.

 

Hardware Used:

Arduino UNO


SIM808 GSM/GPRS and GPS in-1 with antenna


9V Adapter

Jumper Wires


SIM Card (w/ disabled PIN)

Software Used:

Arduino IDE

 

Application Discussion

A SIM808 module is a complete Quad-Band GSM/GPRS module that combines GPS technology for satellite navigation.The compact design which integrated GPRS and GPS in a SMT package will significantly save both time and costs for customers to develop GPS enabled applications. Featuring an industry-standard interface and GPS function, it allows variable assets to be tracked seamlessly at any location and anytime with signal coverage.

This tutorial aims to teach you the basic functions of an SIM808 module. Using Arduino, you can find how its GPS function can find your location with a SIM card. By simply texting the SIM Card equipped, the module will text you your location and send a Google Maps link as well.

SIM808 GSM/GPRS and GPS in-1 with antenna

 

Description

1.Three power input interface: DC044 interface and V_IN and a lithium battery interface.Note that: The range of DC044 and the V_IN pin voltage input is 5 - 26V, when use the 5V as the power, be sure that the power supply can provide 2A current.

The range of voltage of Lithium battery input power is 3.5 - 4.2V.

2.Switch: It is used to open / close the input power supply for the module. When in use, please confirm the toggle switched to the OPEN state (near the board inside).

3.SMA antenna interface: there is a GSM antenna interface, a GPS antenna interface onboard and a BT antenna interface.

4.Start button: 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 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 de 1second light), that indicates that the module is registered to the network, and you can make a call or do something else.

5.TTL serial interface: a TTL level interface. Notice that: The pin of VMCU is used to control  the high level of TTL UART, so as to realize to match between 1.25V/3.3V /5V systems.

6.USB interface: This interface is just use to update the firmware of SIM808 module.

Operation
1. Preparation:
SIM808 SHIELD
DC9V adapter
USB-TTL module or other tools.
PC software
2. Hardware configurations
2.1 Connect USB-TTL to UART interface
USB-TTL SIM808
TXD RXD
RXD TXD
GND GND

2.2 Insert valid SIM card to SIMCARD holder.
2.3 Connect the GPS antenna and GSM antenna to the board
Connect the power adapter to the DC044 Interface
2.4 Change the switch
2.6 Press the POWKEY button for 2 second, the module will work and the other 3 LEDs will light

 

Hardware Setup

SIM808 Module

Actual Setup

 

Fritzing Diagram

 

Schematic Diagram

 

Pin Configuration

Arduino UNO pins

PIN 10 => SIM Module TXD (YELLOW)

PIN 11 => SIM Module RXD (GREEN)

GND   => SIM Module GND (BLACK)

SIM808 Module PINS

GSM Antenna  => SIM Module GSM ANTE (left side)

GPS Antenna   => SIM Module ACTIVE GPS ANTE (2nd pin on right side)

9V Adapter        => SIM Module Adapter (front)

SIM Card (w/ disabled PIN) => SIM Module SIMCARD holder (under)

 

Software Setup:

The Arduino Codes for the application can be downloaded here or you can copy the code down below. You must also download and import the SIM808 library, which is provided by clng and available here.

After the setup, press the button near the GSM Antenna for 2 seconds to activate the SIM Card. Open the Serial Monitor and wait for the monitor the read the SIM Card.

Once the card is read, simply send a message to the no. of the SIM Card. The card will reply with your current location as well as your location on Google Maps.

 

Code Breakdown:

SIM808 Module

#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
  • Includes the DFRobot_sim808.h library in the code.
  • Includes the SoftwareSerial.h library in the code.
#define MESSAGE_LENGTH 160
char message[MESSAGE_LENGTH];
int messageIndex = 0;
char MESSAGE[300];
char lat[12];
char lon[12];
char wspeed[12];
  • Defines the message contents and length to be sent.
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!");
}
  • Initializes the SIM808 module.
  • Checks if the module is connected or not.
float la = sim808.GPSdata.lat;
float lo = sim808.GPSdata.lon;
float ws = sim808.GPSdata.speed_kph;
 
dtostrf(la, 6, 2, lat);
dtostrf(lo, 6, 2, lon);
dtostrf(ws, 6, 2, wspeed); 
  • Puts the float value of the latitude into an array.
  • Puts the float value of the longitude into an array.
  • Puts the float value of the wind speed into an array.
    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); 
    • The final message to be sent after a response.

    Video Output

     

    Conclusion

    SIM modules are good circuits for finding out your location. Although the modules have limited range, these kinds of circuits are effective at their jobs and are very helpful for when you want to know where you are right now with the most accurate assessment possible.

     

    References

    https://maker.pro/arduino/projects/build-a-car-tracking-system-with-the-sim808-module

    ArduinoArduino unoGprsGpsGps trackerGsm/gprsSim808

    Leave a comment

    All comments are moderated before being published