Interfacing SIM900A GSM Modem with Arduino

This post is intended to help beginners interfacing SIM900A to Arduino.

 

Arduino serial

 

Power supply requirement:

For RS232 type modem mentioned in this link, requires adapter/battery of 12 Volt 1-2 Ampere current rating for reliable operation. DC Jack can be used to feed the input power.

For TTL Modem mentioned in this link, use 5 Volt, 1-2 Ampere adapter or Power bank.

 

Note : Watch-out for the network led pattern.

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

The code is tested with SIM900A 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.

 

IMG_0078 copy

 

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 SIM900A 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 SIM900A 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 SIM900A
// 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.

Arduino – GSM Sample code.

Advertisements

131 thoughts on “Interfacing SIM900A GSM Modem with Arduino

  1. Also i see a power supply for lithium battery at 3v. So can I use a 3000mAh mobile battery instead? I will only be using GPRS.

  2. Sir g I’m making a project in which I’m using GSM Module, when but it is not connecting to Network I have inserted Telenor, Ufone and Warid sim in it but it still searching, it was just send two messages when I used it first time but after that it was just searching… Please help me Sir  

  3. hello, is there a power on / off pin? something similar to the arduino gsm shield pin 9? I would like to be able to control the on / off status of the modem from the mcu. Thanks.

      • Well noted. Can you give me some detailed instructions on how to do it on your board, i.e. how best to desolder the enable pin from ground and solder in an additional pin connected to it.

  4. Dear Elementzonline team, I am able to send the message to modem and i am able to send the message from gsm modem to the defined numbers. But i want the GSM modem to reply to the recieved number. so please send me an example for this.

  5. i tried to connect my gsm using 12V 2A adapter but it become hothelp me. the gsm status led didnt turn on at all. i dont know whats wrong with it. can u please help me with it?

  6. Hi,
    I bought the module from elementzOnline. The sim in my module is not connecting to the network.
    ie, When I call to sim in the GSM SIM900A, I hear “Not Reachable” but not the “ring”.

    Can you please, mention the useful links so that I can follow the instructions to solve my problem?

  7. Hi,

    I bought “SIM900A GSM MODEM MODULE V1.2 with SMA ANTENNA”, and trying to connect it to Arduino UNO through UART ports, but unfortunately, Arduino fails to detect the modem. Whenever I run Testmodem sketch on Arduino, it returns

    Starting modem….. ERROR,no modem answer
    Modem’s IMEI : 0

    I am powering Arduino through serial port of desktop and Shield through a 12 V 1A power supply. Since I am trying to first connect the shield to Arduino, I haven’t used any SIM yet.

    Please suggest me what can be wrong

    Regards,
    Pradeep Verma

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