Interfacing SIM800 GSM Modem with Arduino

This post is intended to help beginners interfacing SIM800 GSM Modem to Arduino.

Arduino serial

Power supply requirement:

The power supply to the board should be 12v, 1-2A.The SIM800 modem described in this link has both RS232 and TTL type inputs. Make sure that the two pins labeled as power key are shorted, it is required for the modem to turn ON.When the modem turns ON the “power” and the “stat” LEDs also turn ON and  the network LED starts blinking.

Note.1: The power key feature is included so that we can turn ON the Modem using a controller, as required ,which can be helpful for low power applications.

 

Note.2: The Blinking pattern of the network LED has the following information.

Status                               SIM800 behavior
Off                                          SIM800 is not running
64ms On/ 800ms Off       SIM800 not registered in the network
64ms On/ 3000ms Off     SIM800 registered to the network
64ms On/ 300ms Off       GPRS communication is established

The code is tested with SIM800 and Arduino UNO. Connect the Tx and Rx pins of arduino pins to Rx and Tx pins of GSM Modem.

Note: The uart pins should be cross connected, ie. GSM Tx –> Arduino Rx and GSM Rx –> Arduino Tx. Make the ground common between Arduino and GSM modem.

C360_2016-06-28-12-05-18-513

TTL pins can be seen just behind the 9 pin DB9 connector. If you are using DB9 connector for interfacing you need MAX232 circuitary for converting RS232 output of DB9 to TTL levels.

Copy and paste the following code to your Arduino IDE as a starting point for GSM-Arduino interfacing test.

Note : Before powering SIM800 module user should insert the SIM into the module.

Change the phone number in the below code before running the code.


/*
Author: Dhanish
Created on: 19-08-2014
Company: Elementz Engineers Guild Pvt Ltd
Run this code only after SIM800 Module has powered and connected to a Network.
Please make a call to the module knowing whether the connection is established.
If connected a ring will be heard at the caller end
*/

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);

delay(10000);
// print the serial data to GSM
Serial.print("ATD9020XXXXXX;" ); // change here to call a number using SIM800
// wait 10 seconds before the next loop
delay(10000);
Serial.print("ATH" ); // hold the call
}

void loop() {
}

Another code using Software serial is as seen below

Note: Connect as follows
         digital pin 10 — connect to TX of GSM Modem
         digital pin 11 — connect to RX of GSM Modem

/*
The circuit:
* RX is digital pin 10 (connect to TX of GSM Modem)
* TX is digital pin 11 (connect to RX of GSM Modem)
*/
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);

Serial.println("Calling through GSM Modem");

// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
delay(2000);
mySerial.println("ATD81290255XX;"); // ATD81290255XX; -- watch out here for semicolon at the end!!

Serial.println("Called ATD81290255XX");
}

void loop() // run over and over
{
// print response over serial port
if (mySerial.available())
Serial.write(mySerial.read());
}

Arduino sample code can also be downloaded from the following Link.

Advertisements

7 thoughts on “Interfacing SIM800 GSM Modem with Arduino

    • Short Answer: DIY(Do it Yourself).

      Long Answer: We cannot develop for each and every microcontroller out there in the market. All you have to do is communicate with the module serially. We are sharing the Arduino code because the Arduino ecosystem is beginner friendly and easy to use. And there is less likely to get any error even if you copy paste the code that we provide. But in the case of other microcontrollers this is not the case. However, you can get sufficient help from avrfreaks forums.

  1. hai,
    i have a sim 800c module and an arduino uno.i need an output in pin1 of arduino when a call receive at gsm module.
    please help me

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s