This post is a complete guide to the SIM900 GSM GPRS Shield with the Arduino. Learn how to send and receive SMS and how to make and receive phone calls with Arduino.
In this guide we’ll cover:
- Introducing the SIM900 GSM GPRS Shield
- SIM900 GSM GPRS Shield Hardware
- SIM900 AT Commands
- Testing the shield
- Sending and receiving SMS – example
- Making and answering phone calls – example
Introducing the SIM900 GSM GPRS Shield
The SIM900 GSM GPRS Shield is shown in figure below.
GSM stands for Global System for Mobile Communications and is the global standard for mobile communications.
GPRS stands for General Packet Radio Service. GPRS is a mobile service on the 2G and 3G cellular communication.
Applications:
The GSM GPRS shield is particularly useful as it allows to:
- Connect to the Internet over GPRS network
- Send and receive SMS
- Place and receive phones calls
Its capabilities make it perfect for projects with Arduino like:
- Remote control of electronic appliances – sending an SMS to turn something on;
- Receive notifications – send SMS to your cell phone if movement is detected in your house;
- Receive sensor data – send periodic SMS to your cell phone with daily weather data.
Features
Here’s some of the most important features of the shield:
- Compatible with Arduino and clones
- Based on SIM900 module from SIMCOM
- Allows you to send SMS, MMS, GPRS and Audio via UART using AT commands.
- It has 12 GPIOs, 2 PWMs and buit-in ADC of the SIM900 module
- Quad Band: 850; 900; 1800 and 1900 MHZ, so it should work in all countries with GSM (2G) networks
- Control via AT commands
- Supports RTC (real time clock) – it has a holder for a 3V CR1220 battery at the back
- Has microphone and headphone jacks for phone calls
Where to buy?
You can check the SIM900 GSM GPRS shield on Maker Advisor and find the best price.
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Preliminary steps
Before getting started with your SIM900 GSM GPRS module, you need to consider some aspects about the SIM card and the shield power supply.
GSM coverage
Ensure you have coverage on a GSM 850 MHz, GSM 900 MHz, DCS 1800 MHz or PCS 1900 MHz network. By GSM we mean 2G.
Prepaid SIM Card
We recommend that you use a prepaid plan or a plan with unlimited SMS for testing purposes. Otherwise, if something goes wrong, you may need to pay a huge bill for hundreds of SMS text messages sent by mistake. In this tutorial we’re using a prepaid plan with unlimited SMS.
The shield uses the original SIM card size, not micro or nano. If you have micro or nano you may consider getting a SIM card size adapter.
Turn off the PIN lock
To use the SIM card with the shield, you need to turn off the pin lock. The easiest way to do this, is to insert the SIM card in your smartphone and turn off the pin lock in the phone security settings.
In my case, I needed to go through: Settings > Advanced Settings > Security > SIM lock and turn off the lock sim card with pin.
Getting the right power supply
The shield has a DC socket for power as shown in figure below.
Next to the power jack there is a toggle switch to select the power source. Next to the toggle switch on the board, there is an arrow indicating the toggle position to use an external power supply – move the toggle switch to use the external power supply as shown above.
To power up the shield, it is advisable to use a 5V power supply that can provide 2A as the one shown below. It can also be powered with 9V 1A, or 12V 1A.
You can find the right power adapter for this shield here. Make sure you select the model with 5V and 2A.
SIM900 GSM GPRS Shield Hardware
The figure below shows the back of the shield. It has a holder for the SIM card and for a 3V CR1220 battery for the RTC (real time clock).
The figure below shows the shield most important components on the board that you need to pay attention to.
Getting started
1) Insert the SIM card into the SIM card holder – make sure you’ve read the preliminary steps in the previous section.2) Make sure the antenna is well connected.
3) On the serial port select, make sure the jumper cap is connected as shown in figure below to use software serial.
4) Power the shield using an external 5V power supply. Make sure you select the external power source with the toggle switch next to the DC jack.
5) To power up/down the shield press the power key for about 2 seconds.
6) Then, the Status LED will light up and the NetLight LED will blink every 800 ms until it finds the network. When it finds the network, the NetLight LED will start blinking every three seconds.
Note: you can automatically turn on the shield via software. See how to do that in the Automatically turn on the shield section, after the code examples.
7) You can test if the shield is working properly by sending AT commands from the Arduino IDE using an FTDI programmer – as we’ll shown later in this guide.
SIM900 AT commands
- set the SIM900 to text mode: AT+CMGF=1\r
- send SMS to a number: AT+CMGS=PHONE_NUMBER (in international format)
- read the first SMS from the inbox: AT+CMGR=1\r
- read the second SMS from the inbox: AT+CMGR=2\r
- read all SMS from the inbox: AT+CMGR=ALL\r
- call to a number: ATDP+ PHONE_NUMBER (in international format)
- hang up a call: ATH
- receive an incoming call: ATA
For more information, you can check the SIM900 AT commands manual here.
Testing the Shield with FTDI programmer
To test if everything is working properly, you can test the shield by sending AT commands from the Arduino IDE serial monitor. For that, you need an FTDI programmer as the one shown in figure below. You can get an FTDI programmer like this here.
1) Connect the FTDI programmer to the GSM shield as shown in figure below.
2) Open the Arduino IDE and select the right COM port.
3) Open the Serial monitor
4) Select 19200 baud rate – the shield default setting is 19200 – and Carriage return. Write AT at the box highlighted in red and then press enter. See figure below.
5) The shield will respond with OK, if everything is working properly.
Connecting the Shield to Arduino
Connect the shield to the Arduino as shown in the schematics below.
Sending an SMS
To send an SMS, upload the code below to your Arduino board.
/*********
Complete project details at https://randomnerdtutorials.com
*********/
#include <SoftwareSerial.h>
// Configure software serial port
SoftwareSerial SIM900(7, 8);
void setup() {
// Arduino communicates with SIM900 GSM shield at a baud rate of 19200
// Make sure that corresponds to the baud rate of your module
SIM900.begin(19200);
// Give time to your GSM shield log on to network
delay(20000);
// Send the SMS
sendSMS();
}
void loop() {
}
void sendSMS() {
// AT command to set SIM900 to SMS mode
SIM900.print("AT+CMGF=1\r");
delay(100);
// REPLACE THE X's WITH THE RECIPIENT'S MOBILE NUMBER
// USE INTERNATIONAL FORMAT CODE FOR MOBILE NUMBERS
SIM900.println("AT+CMGS=\"+XXXXXXXXXXXX\"");
delay(100);
// REPLACE WITH YOUR OWN SMS MESSAGE CONTENT
SIM900.println("Message example from Arduino Uno.");
delay(100);
// End AT command with a ^Z, ASCII code 26
SIM900.println((char)26);
delay(100);
SIM900.println();
// Give module time to send SMS
delay(5000);
}
In this code, you start by including the SoftwareSerial.h library and create a software serial port on pins 7 and 8. (Pin 7 is being set as RX and 8 as TX)
#include <SoftwareSerial.h> SoftwareSerial SIM900(7, 8);
The sendSMS() function created is what actually sends the SMS. This function uses the AT commands: AT+CMGF=1\r and AT + CMGS.
You need to change the recipient’s mobile number at: (replace the X‘s with the recipient’s phone number)
SIM900.println("AT + CMGS = \"++++++++++++++"");
The recipient’s mobile number should be in international format.
Then, at the following line you can edit the text you want to send.
// REPLACE WITH YOUR OWN SMS MESSAGE CONTENT
SIM900.println("Message example from Arduino Uno.")
Reading received SMS
To read incoming SMS, upload the code below to your Arduino. After uploading, wait 20 seconds for the shield to establish communication. Then, test the script by sending an SMS to the shield SIM card number. The SMS is shown on the Arduino serial monitor – baud rate: 19200.
/*********
Complete project details at https://randomnerdtutorials.com
*********/
#include <SoftwareSerial.h>
// Configure software serial port
SoftwareSerial SIM900(7, 8);
//Variable to save incoming SMS characters
char incoming_char=0;
void setup() {
// Arduino communicates with SIM900 GSM shield at a baud rate of 19200
// Make sure that corresponds to the baud rate of your module
SIM900.begin(19200);
// For serial monitor
Serial.begin(19200);
// Give time to your GSM shield log on to network
delay(20000);
// AT command to set SIM900 to SMS mode
SIM900.print("AT+CMGF=1\r");
delay(100);
// Set module to send SMS data to serial out upon receipt
SIM900.print("AT+CNMI=2,2,0,0,0\r");
delay(100);
}
void loop() {
// Display any text that the GSM shield sends out on the serial monitor
if(SIM900.available() >0) {
//Get the character from the cellular serial port
incoming_char=SIM900.read();
//Print the incoming character to the terminal
Serial.print(incoming_char);
}
}
In this code, you set the module to send the SMS data to the serial output:
SIM900.print("AT+CNMI=2,2,0,0,0\r");
You store the incoming characters from the SMS message on the incoming_char variable. You read the chars using the SIM900.read() function.
Making a phone call
To make a phone call, upload the following code to your Arduino.
Don’t forget to edit the code with the phone number you want to call.
/*********
Complete project details at https://randomnerdtutorials.com
*********/
#include <SoftwareSerial.h>
// Configure software serial port
SoftwareSerial SIM900(7, 8);
void setup() {
// Arduino communicates with SIM900 GSM shield at a baud rate of 19200
// Make sure that corresponds to the baud rate of your module
SIM900.begin(19200);
// Give time to your GSM shield log on to network
delay(20000);
// Make the phone call
callSomeone();
}
void loop() {
}
void callSomeone() {
// REPLACE THE X's WITH THE NUMER YOU WANT TO DIAL
// USE INTERNATIONAL FORMAT CODE FOR MOBILE NUMBERS
SIM900.println("ATD + +XXXXXXXXX;");
delay(100);
SIM900.println();
// In this example, the call only last 30 seconds
// You can edit the phone call duration in the delay time
delay(30000);
// AT command to hang up
SIM900.println("ATH"); // hang up
}
To make the call, you use the callSomeone() function that uses the ATD command.
SIM900.println("ATD + +XXXXXXXXX;");
You need to replace the X‘s (highlighted in red) with the phone number you want to call.
Don’t forget to connect a microphone and earphones to make the call.
In this code example, the call is hang up after 30 seconds, using the ATH command:
SIM900.println("ATH");
Hanging up after 30 seconds is not very useful, but it works well for an example. The idea is that you use the ATH command when an event is triggered. For example, connect a push button to the Arduino, that when pressed sends the ATH command to hang up the phone.
Answering incoming phone calls
The following code answers incoming calls.
/*********
Complete project details at https://randomnerdtutorials.com
*********/
#include <SoftwareSerial.h>
// Configure software serial port
SoftwareSerial SIM900(7, 8);
char incoming_char=0;
void setup() {
// Arduino communicates with SIM900 GSM shield at a baud rate of 19200
// Make sure that corresponds to the baud rate of your module
SIM900.begin(19200); // for GSM shield
// For serial monitor
Serial.begin(19200);
// Give time to log on to network.
delay(20000);
SIM900.print("AT+CLIP=1\r"); // turn on caller ID notification
delay(100);
}
void loop() {
// Display any text that the GSM shield sends out on the serial monitor
if(SIM900.available() >0) {
// Get the character from the cellular serial por
// With an incomming call, a "RING" message is sent out
incoming_char=SIM900.read();
// Check if the shield is sending a "RING" message
if (incoming_char=='R') {
delay(10);
Serial.print(incoming_char);
incoming_char=SIM900.read();
if (incoming_char =='I') {
delay(10);
Serial.print(incoming_char);
incoming_char=SIM900.read();
if (incoming_char=='N') {
delay(10);
Serial.print(incoming_char);
incoming_char=SIM900.read();
if (incoming_char=='G') {
delay(10);
Serial.print(incoming_char);
// If the message received from the shield is RING
// Send ATA commands to answer the phone
SIM900.print("ATA\r");
}
}
}
}
}
}
When someone calls the SIM900 number, it sends a message saying “RING”. To know if someone is calling you, you can wait for incoming characters from the SIM900 and then, compare if it was a RING message. That’s what is done in this code. When it receives a RING message, you send the ATA command to answer the phone.
Automatically turn on the shield
Instead of manually pressing the “power” key to turn on the shield, you can automatically turn on the shield via software.
1) First, you need to solder R13 connections on the shield as shown in the figure below – highlighted in red.
2) Connect D9 on the shield to the D9 Arduino pin as shown in the schematic below.
3) Add the following code snippet in the setup() function. This is the equivalent of pressing the shield “power” button.
digitalWrite(9, HIGH); delay(1000); digitalWrite(9, LOW); delay(5000);
Troubleshooting
Shield doesn’t respond with OK
Check your TX and RX connections to the Arduino. Try repeating the process by changing the TX with the RX pins.
Also check if you have selected the software serial by placing the jumper cap on the appropriate place on the serial selector.
Cannot see messages in the serial monitor
To see the messages in the serial monitor, the shield and the Arduino’s serial port baud rate should be the same. The SIM900 GSM GPRS shield default baud rate is 19200. So, select the Arduino’s baud rate to 19200.
However, if you need to change the shield baud rate, you can send the following AT command to change it to 19200 or other appropriate baud rate.
AT+IPR=19200
Wrapping up
This tutorial shows you how to send and receive SMS and making and receiving phone calls with the Arduino. You can apply the concepts learned in this tutorial to build your own projects to communicate over a cell network. We have other projects that use GSM, check them below:
If you like Arduino projects, make sure you check our latest Arduino: Arduino Step-by-step Projects – Build 25 Projects
We hope you’ve found this guide useful.
Thanks for reading.
Waouw. Great tutorial !
Thank you so much !
You’re welcome 🙂
This is great
Can you post the tutorial for connecting sim 900 to internet (server) through GPRS
Hi.
Maybe we’ll do that in the future.
Thanks for the suggestion.
Verry good tutorial!
I am also interested in connecting SIM 900 to internet (server) through GPRS.
I saw the question from September 14, 2017.
Is anything more known about this?
Best regards.
Hi.
We have a similar tutorial, but not exactly what you’re looking for.
See this example: https://randomnerdtutorials.com/esp32-sim800l-publish-data-to-cloud/
I think you can use the same library we used with that shield.
Regards,
Sara
Do you have any tutorial about using SIM7100e or SIM5320 with arduino or ESP to send/receive HTTP data from server using 3G/4G communication. Thanks
Hi.
Unfortunately, we don’t have any tutorials about those modules.
Regards,
Sara
Hi fantastic, thank you
Great Tuto. but i prefert M590 or A6 module. cheaper and less space.
It is great tutorial as all You project !! Thank so much for You!
Mike
Great tutorial ! Thanks, just what I need.
Do you know if it is possible to feed the 5 volts from the Arduino ? It seems a bit odd to me to use 2 separate powersupplies. Does the GPRS shield use 2 Amps ?
Hi.
It is not recommend to power up the shield using the 5V from Arduino as it won’t provide enough current, and the shield won’t work properly.
Yes, it is advisable to use an external 5V power supply that can provide 2A with the GSM shield.
Great tutorial!
Is it possible to enable this shield from arduino, without pressing to the button?
Thank you.
Hi.
Yes. There is a way to use software trigger, so you don’t need to use the button to enable the shield.
In this specific module, accordingly to the data sheet, you need to connect D9 on the shield to D9 of the arduino and add the following snippet to your code, at the setup(), that is equivalent of pressing the power button:
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(5000);
I hope this helps.
Regards.
Thank you.
Hi again.
I forgot to mention that you need to solder the R13 connection in some shields. I added a section regard that subject in the guide – Automatically turn on the shield.
I hope this helps.
I read that issue with R13, but even with the photo it is not clear to me what to solder. Is it possible to give a better description or a more detailed photo. Second question, what do recommend as batty power supply. I like to use these 18650 accus. My project is to change an old rotary dial phone into a mobile just for fun. Hello from Germany
Hi.
There are two tiny pins inside the R13 label. You should solder those pins to each other.
I haven’t tested using a battery to power up the shield, but I think those batteries should work. However, keep in mind that if you have your shield always on, the batteries will drain in no time. So, you need to keep the shield off, and turned it on, only when it needs to send a message, or make a phone call, etc…
I hope this helps 🙂
Great tutorial!
Is there a way to make an internet connection with the GSM module? For example, currently I use WiFi to connect my ESP8266 to a variety of servers such as Blynk and Thingspeak. I would like to use the GSM card to do the same without needing to connect to a WiFi access point. Is this possible?
Great Tutorial! It work for me. Thank you so much. – Malaysia
Is this GSM SIM900 works in Malaysia, I tried to run the AT commands but it not give response “OK”, please help me
This is very interesting and useful tutorial that I have ever seen.
HI, I would like to ask if somebody could post the pdf link of the datasheet for the SIM 9000 module. I have not been able to find on-line !.
Hi Fredy.
You can find a link to download at the SIM900 product page on Banggood.
Check the following link:
files.banggood.com/2016/10/SKU191995%20.zip
more than tutorial, Sara my God bless you
Thanks 🙂
thank you for the great tutorial. it is working with calls . but not sending messages
Hi.
If it is working great with the calls, I have no idea why it doesn’t work with messages 🙁
Everything worked just fine for us.
Does it work with other versions of SIM900 like SIM900A and SIM900D?
Hi Angelo!
We haven’t tested with those boards, but everything should be compatible.
Hi, i like this awesome tutorial. But it gives me some idea, please can you tell me if it may be possible to send one sms to a big number of phone numbers throught data bases?
Hi.
I think it should be possible as long as your SIM card allows it.
But we don’t have any example on that subject.
Regards,
Sara
Can you give examples of SIM cards that work with your system? When I type in the IMEI number from the figure into a T-Mobile reseller’s website, an “incompatible” message appears.
Hi.
I used SIM card from Vodafone. I haven’t tested with other providers.
Regards,
Sara
beatiful
Thank you, it is great tutorial
Thanks 🙂
Is the FTDI required?? Is thought that when connecting GSM module to Arduino Uno and then go to the serial monitor is fine to give AT commands. I ordered a GSM900 as shown in your pictures, but no FTDI, since I did not know about it.
Jan
Hi Jan.
You don’t need an FTDI programmer to work with the shield. It will work just fine with the Arduino.
In the tutorial, we show how to send AT commands using the FTDI programmer, but you can also use the Arduino and Serial Monitor.
Dear Sra Santos, When I enter AT command, I do not get any response. So please help me.
I bought a GSM900a in first place, but that one did nothing at all. So I’m waiting for a long time… hope that I can forget about the FTDI therefore 😉
Sis , i followed all off your tutorial start from hardware interfacing until whole of the program written , but here i found a problem that my SIM900 shield didn’t work properly even i get OK response from AT COMMAND. i try to call someone with AT COMMAND in first 3 second serial monitor give me OK but after several second the other response show NO CARRIER. I tried to change my SIM card but it still happen. could you give me solution about it? Thanks
Hi.
If you get an OK response, your shield should be working properly.
So, I can’t tell you why it is not working.
Maybe you’re not using the phone number correctly. Please make sure you’re using the phone number in international format.
I hope this helps.
Regards,
Sara
Hi, thanks for the tutorial, it’s great, and worked for me right the first time. My only problem is, when i call someone, the phone shows “unknown number” (Private number). The sim card with a phone, showing the number, but when i call with the shield it’s hiding the phone number.
Sorry for my english, hope you understand what is the problem. :/
Hi Peter. I understand your problem.
Unfortunately, I don’t know why that happens.
I’ve tried to search for someone with the same problem but I was unable to find any information regarding that specific problem.
Very helpfull .Great tutorial. Thank you. I’m looking for the frizing part of this shield, but after searching everywhere, I didn’t find it. May be you have it ?
Hi. Unfortunately we don’t have that fritzing part.
Thanks for beautiful guide. I’m now able to send and receive sms as i needed. The only thing is that i can not send and receive sms with Extended characters. How can i send and receive sms eith ąčęėįšųūž letters?
Hi Arnas.
I think you need to convert the characters to ASCII.
Take a look at this tutorial: playground.arduino.cc/Main/Utf8ascii
However, I’m not sure if this will work when sending the characters on an SMS.
I hope this helps, though.
please could someone help me how to replace
SIM900.println(“Message example from Arduino Uno.”)
so i could send with sms the temperature read from a sensor
Hi.
You need to create a variable to hold your temperature. Then, you need to convert that variable into a String.
Finally, you just need to send that variable using the SIM900.println(). For example: imagine you save the temperature on the Temp variable. You just need to do as follows:
SIM900.println(String(Temp));
I hope this helps.
Hi, I have problems getting the SIM900 shield to operate.
I have checked that the SIM is without PIN code, and I have checked that it works by using it in my mobile phone. The SIM is a prepaid card from Telenor in Norway. I power the SIM900 from a separate 60W power supply
Trying to get the card to connect to the network, eveything is as described after pressing power on.
However, it looks like the cards stops when it connects to the network. The NetLight turns off and does not blink anymore. I then have to remove power and start over for the power key to work again.
-any idea what might be the problem?
-should the AT commands work before I press the power key and get it connected?
Hi Tor.
When the card connects to the network, the NetLight LED should be blinking every three seconds (that indicates it is properly connected to the network).
To power up the shield you should press the power key for about 2 seconds. Then, the Status LED will light up and the NetLight LED will blink every 800 ms until it finds the network. When it finds the network, the NetLight LED will start blinking every three seconds.
If it is not connecting to the network, it may be a problem with your card, or with your GSM shield.
The GSM shield should be connected to the network before sending the AT commands.
I hope this helps.
Regards,
Sara 🙂
Hi, i recently got a Sim900 module, i understand all the AT commands, and functions, ( this guide also helped me ) But i got a problem, the first step! My net light only blinks once per second, and it stays that way for long time… which means it cant acquire network, i dont know why?
My module is connected to a 9v 1a power supply,
The Sim card is in correct position.
Ive read that sometimes, the Ant pin is not soldered properly, or also if the Manufacturer its from china, it wont with america signals.
Do you know what could be happening?
Hi. I don’t know what can be wrong.
Does you location support 2G network?
The SIM900 is a 2G network device.
It looks like you have the same problems as I have, see above.
When the SIM900 does not connect to the network, its impossible to debug what the problem is as the AT commands does not work
I’m pretty sure 2G is supported bu my provider here, but it does not connect.
Please tell if you find a way to get a status from the shield without a network connection.
Look for an AT-command-list like –SIM900_AT.pdf– and find out more about signal quality, connections etc..
You can start by checking the signal quality with a command like — SIM900.println(“AT+CSQ”) — (and feed the output back the serial port). Also check the commands AT+COPS? and AT+CREG? in different variations…
This will tell you if your antenna is working (CSQ) and if there are carriers you can connect to or are connected to.
You can find out a lot more about your board and connection with AT commands, even without (or before ) a network connection !
And I admit, it’s still difficult to connect these boards … but you will learn a lot more about your board by trying these commands 🙂
Hi Gerrit.
Thank you so much for this information.
This will be very useful for many of our readers 🙂
Hi,
Although i managed to send an sms from the gsm shield, i cannot read the sms.
i followed the steps you described about setting the baud rate to the correct value etc but still the read sms doesn’t send out anything to the serial out port.
can you help?
thnaks
Make sure you SIM has not a PIN set (that’s a common mistake).
When i connect the GSM module with my 9V battery after few blink the status LED and the NetLight LED just wen5 OFF..
What is the issue i have no clue.
Please help.
A 9V battery shouldn’t have enough power to make the GSM module work reliably… You need to use an external power source or a power adaptor.
Any clue on how to use the RTC on this board?
Hi.
Unfortunately, we don’t have any tutorial on that subject.
Regards,
Sara 🙂
Nice work guys, keep it up
I wanted to ask could you please help me to sending my sensor data over the internet? I wanted to transmit my data using internet and gsm module, I did it using esp8266 but now I wanted to transmit using gsm sim900 shield.
Thanks in advance
Hi.
Unfortunately, we don’t have any tutorial on that exact subject.
Thanks for reading,
Regards,
Sara 🙂
Hey,
I am trying to make a program in which I execute certain actions based on the SMS I receive. However I don’t know how to only store the SMS text in a variable (to later compare it) without the phone number of the sender etc…
Hi Matteo.
We have a tutorial that executes actions based on the SMS received. This tutorial may help you with your project:
– Control a 12V Lamp via SMS with Arduino
This tutorial shows how to send SMS to make the arduino do something (in this case it turns a lamp on, but you can do any other action)
I hope this helps 🙂
Great Tutorial! Can please post the tutorial how to find out the location, Latitude,Longitude using Arduino and SIM900 only?
Thanks for the suggestion, but we don’t have any tutorials on that exact subject
Thank you for this complete tutorial.
I haven’t received my SIM900 module yet but I found this recent documentation on AT commands including GPRS commands:
simcom.ee/documents/SIM900/SIM900_AT%20Command%20Manual_V1.11.pdf
Hi.
Thank you for sharing!
That’s a great documentation.
Regards, Sara 🙂
Hi there,
Nice tutorial! I wanted to open my gate gate by calling into the Arduino (with a saved number in the Arduino). The Arduino should switch on a relai and after a couple of seconds switch it back off.
Is it possible to do something like this?
Greets Gijs
Hi. It is possible.
When you call the Arduino, it triggers a function that turns on a relay. When you call the shield, it receives a “RING” message. So, you can check whether it received that message and then, turn on the relay. Take a look at the “Answering incoming phone calls” section.
You may also find useful the following tutorial, in which we control a 12V lamp using a relay via SMS:
– https://randomnerdtutorials.com/control-a-12v-lamp-via-sms-with-arduino/
I hope these tips help you.
Regards,
Sara 🙂
If I use SIM808, all that is explained in this guide remains good?
Thank you and greetings.
Hi Alberto.
We haven’t tested with the SIM808. But I think it should work similarly.
Just take into account the serial pins location and how to properly power your board.
I think the AT commands should also work with that board.
Regards,
Sara
HI,
sorry one small question, when we do automatically on/off via PIN D9, that means if electricity switch off and come back again, after starting Arduino will start also the shield without pressing manual button??. Many thanks.
Hi.
Yes, it should start the shield automatically because the snipet of code to automatically turn on the shield is in the setup().
So, when the Arduino restarts, it will run the setup(), and automatically turn on the shield.
Regards,
Sara 🙂
Hello Ms. Sara,
This is really a splendid tutorial; I would not have made my project work if it were not for you. Thank you so much. I was trying to make a PIR-triggered-SMS alarm. My shield which is identical to yours kind a works ONLY without the auto-on snippet(so, I deleted this from the code and unplugged the D9 wire); however, in some 20 minutes, the shield turns off by itself. My intention is to manually switch it ON and leave it ON for a longer period of time (days). Would you know how to?
Hi Jonathan.
Thank you for you kind words.
I was not aware of that problem, but after searching for a while it seems to be a power issue.
Can you read the solution #13 on this thread: https://forum.arduino.cc/index.php?topic=383424.0 and see if it helps?
Regards,
Sara 🙂
Hi Sara, would you mind to help me?
I purchased the same Shield as your and followed all the passages but It doesnt work!
I read that the Baudrate is too fast but im not sure!
Could you help me? Maybe contact me via mail or here? I will explain all my steps.
Thank you
Hi Nocolo.
What exactly doesn’t work?
Does the shield respond with OK when experimenting with the AT commands?
Regards,
Sara 🙂
Hi sir,
I am facing a problem in sending a message using GSM AT commands for
Serial.print(“AT+CMGS=\”6361066623\”\r”); here instead of my number I am using a variable which has a mobile number.
So the command I used looks like
Serial.print(“AT+CMGS=\”” + myNum + “\””); or
Serial.print(“AT+CMGS=\””);
Serial.print(myNum);
Serial.print(“\””);
but the problem is the code gets compiled but I am not receiving any messages for that number stored in the variable ‘myNum’.
I am using Arduino UNO board,
Please help me to solve this problem
Hi Jeevan.
Try the following line:
SIM900.println(“AT + CMGS = \” + myNum + “\”);
Your phone number should be in international format.
I hope it works,
Regards,
Sara 🙂
This works in my code:
Serial.print(“AT+CMGS=”); //send sms message
Serial.println(phoneNR);
delay(100);
Serial.println(F(“Your message content…”));//the content of the message
delay(100);
Serial.println((char)26);//Close message–the ASCII code of the ctrl+z is 26
delay(100);
Serial.println();
Guess this will solve your problem.
Regards,
Gerrit
Hey I saw the input voltage of the SIM900 should be between 4.1 – 4.8 in the datasheet, Is it ok to use 9V/1A or 12V/1A??? Is that not a problem for the SIM900 components?
Hi Jerom.
It depends on your specific SIM900 module/shield.
The module we’re using here recommends the voltage we specify on the article.
You should note that there are different modules that use the SIM900. Therefore, they might need different power requirements.
Regards,
Sara 🙂
Hey Sara amazing tutorial!
Any chance to have a HTTP GET/POST tutorial?
Can’t really find anything useful around and yours has been the only working tutorial so far..
Hi Juan.
Thank you for your kind words.
At the moment, I don’t have any tutorials about what you’re asking.
Regards,
Sara 🙂
Hello Sara,
Will a SainSmart GSM900 shield work with your project? I already have one and wouldn’t have to purchase the larger development board you list.
sainsmart.com/products/sim900-gprs-gsm-board-quad-band-module-kit-for-arduino
Hi Jeff.
It uses the SIM900 module. So, it should work with this tutorial.
You just need to make sure you wire the shield properly.
Regards,
Sara 🙂
Sara my gsm sheild 900a not work not show at command on serial moniter it show the nmbr to which ‘ send the msg not send msg
Awsome,
The solution to having a phone that makes you look smart and doesn’t cost heaps of money!
hello, excellent guide
I have a problem: after switching on the card, the two LEDs light up, but after a few seconds they turn off again.
can you help me?
thank you
But what’s the problem? Is the example working for you?
I think on the code examples you miss the
// import the GSM library
#include
Hi Michael.
Those examples use the SoftwareSerial library to communicate with the SIM900 via serial.
There’s no need to include other library.
Regards,
Sara
Would it be possible for this module to trigger an Arduino port when it receives a call from a previously registered number?
Yes, you can definitely modify it to do that. You need an if statement that compares the number that is calling with the number stored, then you can do whatever you want. Unfortunately I don’t have any examples with that exact subject…
Thank you very much.
Can I also use PIN 0 and PIN 1 instead of PIN 7,8 . If this is true, do I still have to use the softwareSerial library? I am using an Arduino UNO R3.
Hi Max.
If you use pin 0 and pin 1, you are using hardware serial. So, you don’t need that library.
If you’re going to use hardware serial, you need to change the shield jumper caps to use hardware serial.
This image shows the jumper caps to use software serial (https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2017/08/software-serial.jpg?w=700&ssl=1), you should change that to use hardware serial.
Regards,
Sara
Sara my gsm sheild 900a not work not show at command on serial moniter it show the nmbr to which ‘ send the msg not send msg
What is hardware serial and connecting pinout diagram
Bonjour et merci Sarah pour ce tuto très complet et bien expliqué.
Peut on se servir de ce tuto pour exploiter la sim 800?
Merci
Hi Gaspard.
I’m sorry but we don’t have any tutorial about the SIM800.
Regards,
Sara
Hi,
I search the diagram of the card and the function of the pins of the connectors.
thank you if you can transmit it or the address of the site.
Emmanuel
bonjour,
je recherche le schéma de la carte et la fonction des broches des connecteurs.
merci si vous pouvez le transmettre ou l’adresse du site.
Emmanuel
Hi Emmanuel.
Take a look at the following link: stackoverflow.com/questions/42549537/sim-900-gprs-shield-pinout
I think it might help you out.
Regards,
Sara 🙂
Thanks Sara for the great Tutorial.
I’m working on a home automation project with Raspberry, Openhabian and relay boards. And my “failover” project will include this GSM shield just in case the network wouldn’t be available. Tomorrow I will get the GSM shield. I will make you know about my experience with this.
I’m eager to test it and see how it works!
Thanks and keep up the good work !!
Richard
Hi Richard.
Great!
Then let me know how your project went.
Regards,
Sara
Hello,
I have two doubts:
-In my card, there is a resistance 0 in R13 position… i think that I do not have to modify anything for the D9 pin to work. Is this correct? (but sometimes D9 don’t work and sometimes D9 work OK. Sometimes Q2 don’t conmute with D9 High Level. I don’t know why?)
Someone else happens?
-which is the function of J20 and J3 Jumpers? (GND // VCC5 and GND // 4.1V)
Thanks a Lot
Pedro
Hi Pedro.
It seems that you shield behaves differently than mine. So, I can’t advise much.
If D9 works, it is probably already connected.
As for the jumpers, I don’t know their functions :\
I’m sorry that I can’t help much.
Regards,
Sara
OK.
Thanks a Lot
Pedro
Hello Sara
How to prevent SIM 900 module to go in to sleep mode.
Is serial communication will not work if module goes in to the sleep mode. Or serial port are not accessible in sleep mode??
In my projects arduino receiving inputs from field and sending sms through Gsm 900 module.
How i can turn on sim900 module continuously or for a log time.
The information was very useful. Kindly can I get the REACH statement for the manufacturer SIMCOM with the manufacturer part number SIM 900.
Hello Sara
How to prevent SIM 900 module to go in to sleep mode.
Is serial communication will not work if module goes in to the sleep mode. Or serial port are not accessible in sleep mode??
In my projects arduino receiving inputs from field and sending sms through Gsm 900 module.
How i can turn on sim900 module continuously or for a log time.
Hi.
I didn’t have that problem with my SIM900.
But you can learn more about the SIM900 sleep mode here: raviyp.com/embedded/223-sim900-sim800-sleep-mode-at-commands
Regards,
Sara
Hello Sara
Thanks for your quick reply and suggestion.
Now I am using same Gsm 900 module.
When power up module(12v 1amp), status led turn on & netlight start blinking(3sec).
But why status led blink automatically after 18 second.
When status led blink netlight again start blinking for network and network connection established.
This process happen three times then after status led and netlight led turn on continuously and network connection failed.
Bonsoir juste savoir si le bouclier sim900 peut se connecter au reseau gsm 4G
Hi Alain.
SIm900 doesn’t work with 4G.
You need other module like SIM800C.
Regards,
Sara
hi sara can you help me? i have the right code. but the receiver did not receive a message.
Hi.
Without further information, it is impossible to understand what is going on.
Make sure the SIM card is working properly and it is able to send SMS/make phone calls. Also, make sure that your country support 2G (used by the SIM900 module).
Regards,
Sara
how to connect GSM shield to arduino uno without external supply ie providing supply directly from arduino to it?
I have a SIM800L module instead of SIM900
how do i please ??
Hi.
I’m sorry, but we don’t have any resources about SIM800L module.
Regards,
Sara
hi ,
Can you help me with just sending a message from gsm sim 900a with if condition !
Hi.
What is your question?
Regards,
Sara
You just have to call the sendSMS() function after your if statement.
This tutorial help me a lot! Thank you so much…
hey Sara,
great tutorial,
Please what is a jumper cap , what does it do ?
I searched google, but did not find intersting results.
thx
Hi.
A jumper cap is usually a small piece of plastic outside and metal inside that connects two pins together.
Regards,
Sara
Does SIM900 module need any programme to be uploaded to it before connecting to the arduino UNO?
Hi.
No, you just need to upload the code to the Arduino.
Regards,
Sara
hi,
great information.
i want to ask how i can filter phone number from received sms so that i can program it later to recieive sms from specific phone number and not from any number
To check the number that send the SMS, I think you can use the following AT command:
“AT&CNUM=?
Try a quick google search for SIM900 AT commands.
Regards,
Sara
Hello, beautiful project !!! I wanted to know, I am in possession of the 800l sim module and apart from the esp 32 board I can use them in this project? Can you show me links and the sketch is modified or not?.
good code great work
Thank you for this tutorial. I got it working with SMS sending, and have some additional advice. You may not need an extra power supply, if you are close to a base station. Arduino takes just a small part of the current that your PC can deliver to USB port. The rest may be enough to the GSM shield. Just connect +5V from Arduino to +5V of the shield. That is an easy trial, and it worked for me. When you have your code ready, you can replace PC with an USB power bank. If your code is waiting for something to happen, you should use sleep mode inside the waiting loop and put also the shield to sleep mode. You can get easily over one month waiting time.
Thanks for the tip.
Regards,
Sara 😀
Hello again. I haven’t found anywhere information about in what state is the shield after connecting the power but not powering up with the button or by software. I wanted to keep it waiting in a low current state, but is that the lowest I can reach? Can you help me in this?
Our SIM Card is a 3G. Could this be the problem
You can use a 3G SIM card, but your country needs to support 2G network.
How do you get SIM card number? I see the ‘unlock pin’ thats easy and clear, but no where on the internet does it show how to get the SIM card #
if you call straight talk, you need the IME or SN numbers, to activate the SIM but then i would think they contain your cellphone # and not a different new one for the SIM so if i activate the new SIM i would be calling my own phone # It must be a real, real simple process because there is so much confusion and people unable to run their device over SIM issues like to run your GF-07 GPS- Tracker… Please what are the steps to “use a SIM card” presume nothing and please leave nothing out. i did buy your camera tutorial and hope to build one soon, and the GPIO controller using a server based database. and i am playing with the GSM900 from youtubes website.
hello
i want to ask that can you help me on a project that is home security using gsm 900A and a pir sensor?
Hi I’m starting to develop a project with a GSM module, first I read your tutorial an let me tell you is very,very good.
I wonder if I can put any type of SIMCard, as you know , the operators sells you a SIMcard to 2G Networks and a UsimCard to 3G/4G Networks
It will be work with either of SIMCard type?
Thanks in Advanve
Best regards
Marcos
Hi Marcos.
It works with any SIM card type. For example, you can use a 3G or 4G card.
But the module will just work if your area supports 2G network.
Regards,
Sara
thanks for this tutorial ! this is very helpful
Great tutorial but it stops right when you get to what’s really needed. I have searched all over the internet and this is the same tutorial that I find. It works great. I need the next steps on how to have the arduino read an incoming text and have it trigger a function. Please do a part 2.
Hello.
Great tutorial. It is working perfectly.
I am testing to see if it presents any problem:
I turned it on and left it there for about 3 hours, then I decided to press the button to see if it would send me a SMS – the shield showed it was connected to the network ( LED blinking every 3 seconds) , but it did not send the SMS.
What could it be?
Grato
Hello,
I’m working on a similar project. I’m wondering if I can use your code and try to adapt it to my project, which consists of sending a text message to a cell phone number.
Please answer me.
Hi.
Yes, you can use it and modify it as long as you reference our project.
Regards,
Sara
hi sara … Can I communicate with you personally other than here by e-mail or WhatsApp … to help me with several problems .. Thank you very much
Hi.
I’m sorry, but we don’t do that kind of job.
Regards,
Sara
Great tutorial.
Please can you help me with connecting gprs with arduino mega board.
Regards.
Good day.
Please i want to know whether i can send SMS and at the same time send data using GPRS SIM900.
assuming i want to send a message to a particular number. example. sending “HELLO ” and at the same time sending data like sensor value to the same number.
thank you so much
Hello,
I am working on a similar project using SIM808 GSM/GPRS/GPS Shield (B) and Arduino Uno. I want to send sms notification. Any insights of how to go about it. It seems the shield I bought has not yet been posted by anyone. I’m stuck!
Hello,
Fantastic!!
Great tutorial.
Please could you help me with code for:
1) Send SMS to 5 different number,
2) Make Call to 5 different number.
Thanks.
Hello Sara,
i want to make some automated calls and after pick up a recording should play.
Is there a way the arduino knows when a call is picked up?
Thank you very much
Andrei
Hi.
Yes.
Check the section that says “Answering incoming phone calls”.
Regards,
Sara
Hi Sara,
That part is for the incoming call, i want to make an outgoing call, i dont know the event which is telling me that the phone was picked up.
my question was misleading.
i want to make some automated calls (from arduino) to a person and after person is picking up a recording should play.
is there some event which tells me about answering outgoing call
Thank you very much
Hi.
I think this issue provides information about your question: stackoverflow.com/questions/63240900/sim900-gsm-module-how-to-check-if-the-outgoing-call-is-answered
I hope this helps.
Regards,
Sara
I have completed my two basic projects with your help. your article helps a lot me.thanks
I really want to get started using these modules BUT I am unable or unsure which SIM Card to get…
I tried carriers like mint mobile but no service…
I’d like to get a card that does not expire as I don’t play with this stuff everyday and can be reloaded with min/text…
Anyone have any ideas…thanks
Lets say youre monitoring something and you need to invoke a call when a certain condition is met. How do you go about it?
How do you program that function?
Salve, non so se è il posto giusto ma avrei una domanda……..come si può inviare un SMS a più utenti contemporaneamente???? E’ possibile e come…..
Grazie
Silvano G.
Hi, I don’t know if it’s the right place but I have a question …….. how can you send an SMS to multiple users at the same time ???? Is it possible and how …..
Thank you
Silvano G.
RX and TX are very confusing. See the Getting started No 3 picture and Connecting the Shield shows 2 different ways jumper cap setting. Which is correct?
This is the right way to place the cap: https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2017/08/software-serial.jpg
Hello Sara,
Thanks much for sharing the information, the project on turning ON and OFF the relay via SMS works well, however, I would like to know more about memory latching the status of the output such that when the output is HIGH after sending the “ON” text and it happens that there is a power outage when the power comes back the output status should be maintained, remain “HIGH” or “LOW” when the shield and Arduino power up automatically and vice versa depending on last received text message, Thanks.
Wilberforce.
Hi.
Try to save the last state on the Arduino EEPROM.
Then, whenever it resets, the first thing it should do is checking the last state that is saved on the EEPROM.
Check this tutorial: https://randomnerdtutorials.com/arduino-eeprom-explained-remember-last-led-state/
Regards,
Sara
Hi Sara thanks for the replay will go through and give a feedback
Hi Sara
I have build your “Guide to SIM900 GSM GPRS Shield with Arduino” (datapin 7 and 8) and i have build a NEO-6M with another arduino uno (datapin 3 and 4) too. Therefore i ask for a combination/build togeather so I can get the locations for the NEo-6M send via SIM900. Is this a possible item?
Reggards
Poul
Hi plz help me
(How to change phone number
in a program ) I want to change phone number with SMS command in ardoinu project
thanks for your help
Many thanks for this tutorial. I was previously trying to use a Siemens TC35i GSM Modem to do this. I wanted to communicate cheaply and reliably to an ‘off grid’ device where there is no WiFi, such as in a field.
I also wondered for how long I could expect 2G to continue to work. I found the following official statement which relates to the UK :-
ofcom.org.uk/phones-telecoms-and-internet/advice-for-consumers/advice/3g-switch-off
Hi.
You may consider using a board with more recent modems like the SIM7000G, for example.
Regards,
Sara
Although in the UK, it’s the 3G they’re turning off and not the 2G. 2G is the GSM systems which runs your phone calls and SMS. If you turned 2G off completely then I think you’d have no phone service as that still runs on 2G. (3G/4G/5G are data only services in parallel to GSM).
As this shield is just 2G and if you’re only using it to send/receive SMS I think it will continue. If you’re using the data functions over 2G will then maybe they might somehow get disabled while still leaving SMS and phone service working. but then it’s probably not costing them anything to run that as it’s part of GSM anyway, which is still needed for the basic phone service.
Thanks for the replies. I am more than happy that the UK regulator is giving my project a potential lifetime of a further 10 years. As it says, 3G can and will go, but 2G must remain for much longer. I quote below the relevant extract from that report :-
2G will be switched off by 2033
All the mobile providers have confirmed to the Government that they do not plan to offer their 2G (and 3G) services beyond 2033.
We expect that mobile providers will start making plans to switch off their 2G networks at some point after they have switched off their 3G networks. None of the providers have set a specific date yet, but we will update this advice if their plans change.
A quick follow up. I have had all sorts of issues with my UK network provider who I now refer to as VodaFoe – lol. I still can’t get credit onto a spare SIM, as suggested above to limit potential costs if things go wrong. However, the SIM has worked before and apart from not yet being able to send messages, it can still receive them for now.
I have fitted pin headers, 2 x 8 pin and 2 x 6 pin, to the underside of the empty ‘shield connectors’ – J13, J14, J21 & J22. I had previously swapped the existing yellow 6 pin headers out of J13 & J14 into J13_1 and J14_1. Fortunately I have a desoldering machine. This allows the UNO and SIM900 to fit onto a breadboard. The battery on the underside makes this a little tricky but it works. I also fitted pin headers to the other, empty spaces on the top of the board, 3 x 6 way and 2 x 5 way.
I found a good quality switch mode power unit from a discarded router at 5V 3Amps, the plug fits tight and it works well. However, I didn’t really want two power supplies for SIM900 and Arduino UNO. So rather than try to power the SIM900 off the Arduino, that I can understand is not wise, I have done it the other way around as the UNO needs much less current.
To keep connections simple, I have added a wire between the SIM900 DC Barrel Connector +ve on the back of the board, to connector J14_1 pin 6 ( NB not J14 pin 1 which is the connector beside it on the inner side of the two ). That is not connected to anything else on the SIM900 except J14 pin 1. This allows the UNO to get it’s power from the larger SIM900 PSU via its 3 Amp on board regulator. I fitted a Du Pont jumper wire between UNO 5V and SIM900 J14_1 pin 6 ( beside J14 pin 1 ). The regulator is running quite cool so far. No resets, glitches or data corruption encountered.
Initially, I could not get any intelligible characters in the serial monitor using the ‘Reading Received SMS’ code example above. Lots of funny characters that looked like a baud rate issue. I tried playing with Serial Monitor baud rates – no change. Then I spotted another, similar project, on another site, still using the SIM900 and UNO. They were using 9600 baud instead in their code. My board is brand new out of a sealed bag, so not sure why it is different, or why others are using different defaults. However, it now works perfectly after changing to 9600 baud in the code.
I have a SIM900 I wanted a project that answers a call after 3 seconds, hangs up the call and activates pin 13 if the number is valid with a predefined list.
It is worth pointing out a couple of things:-
There are a number of these boards fitted with a SIM900A instead of a SIM900 main chip. This is obvious when you look at the board, or actual photos and not old ‘stock’ photos from internet suppliers. The difference is that the SIM900A is ‘Dual Band’ and not ‘Quad Band’. I have several boards and one is the SIM900A version will not connect for me, despite using SIMs that work in the other boards.
There is also a slightly smaller version of this board without the bulk of the battery holder and SIM carrier on the back. They also don’t have the phone jacks and RTC chip. The lack of an RTC is not really an issue, as the time can be picked up from incoming call and message activity.
Good luck with your projects….
very good work. but how can we recognize an incoming phone number so that if a known number calls us, some function will be activated
Excelent..!
By following your tutorial, sending SMS, initiating phone calls are working. My issue is that once the module receive an incoming call, it automatically hang up. There is no “RING” in the serial. Do you know what could be the problem? Wiring are the same, except that i don’t have FTDI programmer.
Hello, Is it possible to separate the message content and the number from the received message inorder to handle them differently?