Tutorial to Interface GSM SIM900A With Arduino

278,881

110

72

Introduction: Tutorial to Interface GSM SIM900A With Arduino

Description

SIM900A Modem is built with Dual Band GSM/GPRS based SIM900A modem from SIMCOM. It works on frequencies 900/ 1800 MHz. SIM900A can search these two bands automatically. The frequency bands can also be set by AT Commands. The baud rate is configurable from 1200-115200 through AT command. The GSM/GPRS Modem is having internal TCP/IP stack to enable you to connect with internet via GPRS. SIM900A is an ultra compact and reliable wireless module. This is a complete GSM/GPRS module in a SMT type and designed with a very powerful single-chip processor integrating AMR926EJ-S core, allowing you to benefit from small dimensions and cost-effective solutions.

Specification

  • Dual-Band 900/ 1800 MHz

  • GPRS multi-slot class 10/8GPRS mobile station class B

  • Compliant to GSM phase 2/2+

  • Dimensions: 24*24*3 mm

  • Weight: 3.4g

  • Control via AT commands (GSM 07.07 ,07.05 and SIMCOM enhanced AT Commands)

  • Supply voltage range : 5V

  • Low power consumption: 1.5mA (sleep mode)

  • Operation temperature: -40°C to +85 °

Step 1: Material Preparation

In this tutorial, you will need :

1. GSM SIM900A (MINI V3.9.2)
2. Arduino Uno Board and USB
3. Jumper Wire
4. Power adapter 5V
5. SIM card
6. Breadboard

Step 2: Booting Up SIM900A

1. Insert your SIM card to GSM module and lock it. (picture 1 and 2)
2. power up your gsm by connecting it to Arduino's 5V and GND (picture 3)
3. Connect the Antenna (picture 4)
4. Now wait for some time (say 1 minute) and see the blinking rate of ‘status LED’ or ‘network LED’ (D6, refer picture 5) //GSM module will take some time to establish connection with mobile network//
5. Once the connection is established successfully, the status/network LED will blink continuously every 3 seconds. You may try making a call to the mobile number of the sim card inside GSM module. If you hear a ring back, the gsm module has successfully established network connection.

Step 3: Pin Connection

You can see a TTL pin with 3VR, 3VT, 5Vr, 5VT, VCC and GND on your sim900a near your power supply pin. You have to connect GSM's 5VT to Arduino D9 and GSM's 5VR to Arduino's D10 for serial communication between arduino and sim900a module.

Step 4: Basic AT Command

1. To change sms sending mode : AT+CMGF=1

mySerial.println("AT+CMGF=1");

2. To read SMS in text mode : AT+CNMI=2,2,0,0,0

mySerial.println("AT+CNMI=2,2,0,0,0");

3. To make a call : ATD+60XXXXXXXXX; //replace X with number you want to call, change +60 to your country code

mySerial.println("ATD+60XXXXXXXXX;"); 

4. To disconnect / hangup call : ATH

mySerial.println("ATH");

5. To redial : ATDL

mySerial.println("ATDL");

6. To receive a phone call : ATA

mySerial.println("ATA");

Step 5: Library

SoftwareSerial is a library of Arduino which enables serial data communication through other digital pins of Arduino. The library replicates hardware functions and handles the task of serial communication. To be able to interface gsm module with arduino, you will have to download this library and extract it into your Arduino's libraries.

Step 6: Sample Source Code

Download the sample source code below and open it on your Arduino IDE. Select the correct board and port and upload it into your Arduino Uno Board.

Step 7: Serial Monitor

After you has succesfully uploaded your source code, open your serial monitor. Serial monitor will display as shown in the picture above.

Step 8: Result : Call / Redial

1. As you key-in c : to make a call, gsm will read the ATD command and make a call to a phone number you have upload in your source code. (Picture 1 and 2)

2. When you key-in h : to disconnect/hangup call, gsm will read the ATH command and disconnect the connection. (Picture 3)

3. When you key-in e : to redial, gsm will read the ATDL command and redialing previous number it has called.(Picture 4)

4. When there is an incoming call, you can see RING printed on serial monitor and you can click i : to receive a call and GSM's ATA command will be carried out and you will be connected to a call connection. (Picture 5)

Step 9: Result : Send and Receive SMS

1. Key-in s to send SMS. Recepient's number and text message printed on serial monitor. NOTE : You can edit the recepient's phone number and text message on your source code.

2. When gsm receive a message, text message and number will be printed on serial monitor.

Step 10: Video Demonstration

This video shows how SIM900A MINI make a call, receive a call, send sms, receive sms, redial and hangup call based on the sample source code uploaded in this tutorial.

11 People Made This Project!

Recommendations

  • Home and Garden Contest

    Home and Garden Contest
  • Woodworking Contest

    Woodworking Contest
  • Origami Speed Challenge

    Origami Speed Challenge

72 Comments

0
Leeeeee
Leeeeee

Question 5 months ago

Can I make this module to send and receive message simultaneously? I want my project to send and receive in real-time.

0
DietrichD1
DietrichD1

Question 9 months ago

I've tried this project but how come the readings I get from the arduino to the gsm is like this H⸮⸮⸮⸮B⸮i H⸮⸮⸮⸮B⸮i. Can anyone help me?

0
muhammadameruzzaini
muhammadameruzzaini

Tip 11 months ago

I have succeeded in this project using Arduino Mega.
To those whom not yet get it, here is the tips.
1. Coding is Good. No need to Worry about That.
2. Need Extra power Supply. For me, I use power supply unit of 5V to Vin (Arduino Mega)
3. I use pin 2 and 3 for 5VT and 5VR (remember to change it in coding).
Remember, TX (Arduino) goes to RX (sim900a) and vice versa. (i think they don't mention that in here)

Done.
Email me if you guys don't understand. Ill help.

0
zhikanggg
zhikanggg

11 months ago

Hi there. May i check if there any different thing i need to do if i am using Arduino Mega instead? i am not able to get it working despite following the setup..

0
qian862004
qian862004

1 year ago

can i use a nano sim card on the gsm sim900a?? PLEASE HELP!

0
fluthershy514
fluthershy514

Reply 1 year ago

u can't. need to use the original size. gsm sim900a do not support nano sim card. u need to use sim card adapter if you have nano sim card.

0
Gimiyoni
Gimiyoni

Question 1 year ago on Step 3

I connected the gsm with arduino as stated, it responds to commands like AT+CFUN and some other than relating to sim card functionality, i have inserted a working simcard and still brings up CME ERROR 10, I tried enabling the sim detection command AT+CSDT and inserted sim, still same error for calling. When i unplug and power on the module again AT+CSDT goes back to 0. Is there something I'm missing

0
FitriRosli
FitriRosli

Question 1 year ago on Step 10

Hi, may i know how can i use the message function to send a text to multiple contact?

0
lalit.dhingra
lalit.dhingra

1 year ago

Hi, I have been trying to run DTMF commands on SIM900A. My firmware version is Revision:1137B10SIM900A32_ST_2012
It rejects AT+DDET commands. I looked into AT command set for SIM900 and it lacks a mention of DDET commands.
People have written about using AT+DDET on SIM900 without any issues.
Can you guide me how can I use incoming DTMF on SIM900A

0
hannanyusop
hannanyusop

1 year ago

Hye. I also get the same output.. if I send "AT" so gsm it responds "4", supposedly "OK" or "Error".

3 days stuck on this problem. HELP!!!!

Screenshot 2020-07-22 at 1.06.40 PM.pngScreenshot 2020-07-22 at 1.06.48 PM.png
0
MedasaryS
MedasaryS

Question 2 years ago

Hi, i used your code as it is, but hangup and receive calls successfully have done but not sending sms and other. Shall i know whats the cause. please help me in this.

/*THIS TUTORIAL USED GSM SIM900A MINI V3.9.2
Connect 5VT to D9 and 5VR to D10
Feed GSM SIM900A with Arduino's 5V
Code by IDAYU SABRI - MYBOTIC
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(9, 10);//tx, rx
char msg;
char call;
void setup()
{
mySerial.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
Serial.println("GSM SIM900A BEGIN");
Serial.println("Enter character for control option:");
Serial.println("h : to disconnect a call");
Serial.println("i : to receive a call");
Serial.println("s : to send message");
Serial.println("r : ReceiveMessage");
Serial.println("c : to make a call");
Serial.println("e : to redial");
Serial.println();
delay(100);
}
void loop()
{
if (Serial.available()>0)
switch(Serial.read())
{
case 's':
SendMessage();
break;
case 'r':
ReceiveMessage();
break;
case 'c':
MakeCall();
break;
case 'h':
HangupCall();
break;
case 'e':
RedialCall();
break;
case 'i':
ReceiveCall();
break;
}
if (mySerial.available()>0)
Serial.write(mySerial.read());
}
void SendMessage()
{
Serial.println("Sending Message");
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
mySerial.println("AT+CMGS=\"+917799036041\"\r"); // Replace x with mobile number +91
delay(1000);
mySerial.println("sim900a sms");// The SMS text you want to send
delay(100);
mySerial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}
void ReceiveMessage()
{
Serial.println("Received Message");
mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to recieve a live SMS
delay(1000);
if (mySerial.available()>0)
{
msg=mySerial.read();
Serial.print(msg);
}
}
void MakeCall()
{
mySerial.println("ATD+917799036041;"); // ATDxxxxxxxxxx; -- watch out here for semicolon at the end!!
Serial.println("Calling "); // print response over serial port
delay(5000);
}
void HangupCall()
{
mySerial.println("ATH");
Serial.println("Hangup Call");
delay(1000);
}
void ReceiveCall()
{
mySerial.println("ATA");
Serial.println("Received Call");
delay(1000);
{
call=mySerial.read();
Serial.print(call);
}
}
void RedialCall()
{
mySerial.println("ATDL");
Serial.println("Redialing");
delay(1000);
}

0
aungmyohtet123.ah
aungmyohtet123.ah

Answer 1 year ago

Hey Guy
I work with you it but it does not work my predefined number such as sms sent call phone, anything . Please explain me are you ok

0
Prateek18
Prateek18

2 years ago

Doesn't nodemcu works on 3.3v levels and gsm on 5v levels. How did you integrate the two, because you haven't told about that.

0
cgoyal2014
cgoyal2014

Reply 1 year ago

SIM900A mini module has seperate Rx,Tx pins for both 3.3V and 5V.
Namely:
5VT -> 5V Tx
5VR -> 5V Rx
3VT -> 3.3V Tx
3VR -> 3.3V Rx

0
abdurakhmonov
abdurakhmonov

2 years ago

Hi, I have the same module as you, but it's pins are different from your's. There is photos also of my module.
Can you help me to connect it with Arduino🙏, please.
If you can help me, please contact with me:
E-mail: abdurakhmonov2003@gmail.com
Telegram: https://t.me/crazy_inventor
Thanks for your attention.

15862786643046759807807438924105.jpg15862786946476104489966418937279.jpg
0
sanalkumarpv44
sanalkumarpv44

Question 2 years ago on Step 8

I have uploaded the program successfully, but in the serial monitor while key in c I am getting out put like this(@@@)

15725798005993419783188189117221.jpg
0
Telscrt
Telscrt

Question 2 years ago on Step 2

Mine keeps blinking every one second no change