You are on page 1of 8

BitStoc Electronics

www.bitstoc.com

Edited Last 10/16/2014

TUTORIAL / USER MANUAL V1.1

SIM900 GSM/GPRS (SMS) Shield

FEATURES:

SIMCOM SIM900 GSM/GPRS chip


Arduino Compatible Shield
On-board LDO Voltage Regulator
With High Signal Scope antenna
Hardware/Software UART selector
SIM Card holder

SPECIFICATION:

LED Indicators: Power, Network, Status


Power Input: (5V - 7.5 Vdc)

WWW.BITSTOC.COM

BitStoc Electronics

Page 1

HARDWARE BLOCK DIAGRAM

TOP

BOTTOM

BLOCK DESCRIPTION:

Power Select Switch - select power source as External Power Jack or Arduino board
External Power Jack - connect external power source (5V - 7.5 Vdc)
Antenna Jack - insert the included antenna
Serial Port Selector - jumper to choose between Hardware or Software Serial configuration
Hardware Serial - D0/D1 port of Arduino
Software serial - D7/D8 port of Arduino
LED indicators - NetLight: Blinks every 3 seconds if it is connected to the cellphone network
Status: indicates if SIM900 is powered ON/OFF
Power Button & LED: manual button switch to turn ON/OFF SIM900 chip and
LED to indicate if the GSM Shield circuitry is ON/OFF.
SIM Card Holder - placement for the SIM Card.

WWW.BITSTOC.COM

BitStoc Electronics

Page 2

(continuation for BLOCK DESCRIPTION)


NOTE: GSM shield headers are connected to the standard Arduino board I/O ports.
Available - port is available for other use (not used as data port by the GSM Shield)
NOT Available - port is not available for other use since it is used as data port by the GSM Shield

D0 - Available if you select SoftwareSerial configuration to communicate with GSM Shield


D1 - Available if you select SoftwareSerial configuration to communicate with GSM Shield
D2 - Available
D3 - Available
D4 - Available
D5 - Available
D6 - Available
D7 - NOT Available if you select SoftwareSerial configuration to communicate with GSM Shield
D8 - NOT Available if you select SoftwareSerial configuration to communicate with GSM Shield
D9 - Available
D10 - Available
D11 - Available
D12 - Available
D13 - Available
D14(A0) - Available
D15(A1) - Available
D16(A2) - Available
D17(A3) - Available
D18(A4) - Available
D19(A5) - Available
Note: A4 and A5 are connected to the I2C pins on the SIM900. The SIM900 cannot be accessed
via the I2C

WWW.BITSTOC.COM

BitStoc Electronics

Page 3

SAMPLE CODE AND PROJECT


IN THIS TUTORIAL, WE WILL BE USING THE FOLLOWING ITEMS:
GSM/GPRS (SMS) Shield:
http://www.bitstoc.com/index.php?route=product/product&product_id=93
Arduino UNO R3:
http://www.bitstoc.com/index.php?route=product/product&path=20&product_id=76
USB A to B cable:
http://www.bitstoc.com/index.php?route=product/product&path=20&product_id=58
***
Hardware Preparation
In this example we will be using a SoftwareSerial programming and configuration.
To start, we first need to prepare the hardware properly by following the steps below:
1. Insert SIM Card on the SIM Card Holder located at the bottom of the GSM Shield.

2. Attach the included antenna by rotating it until properly tightened.

3. Put the Power Select Switch to the outside corner of the PCB board (not on the Xduino side). To
allow Uploading of the Arduino Sketch Code.

4. Insert the GSM Shield (in correct position) to the Arduino board and Connect the Arduino board
to the computer using your USB A to B programming cable.

WWW.BITSTOC.COM

BitStoc Electronics

Page 4

SENDING SMS from Arduino+SIM900 to a recipient phone


5. In this test we will use SENDING an SMS Text Message Code
Before Uploading the Example Arduino Code found on the next pages or in the project folder,
A.) Check and remember the correct Serial COM PORT number of your Arduino.
B.) Check the code to change your preferred recipient number.

C.) Make sure the comment line // is aligned to the code line.
After checking the above list, Compile and Upload the code to the Arduino board. A ready to
upload code is also available in the Sample Arduino Code folder.
6. After successful uploading of Code, slide the switch back to Xduino side and the Green LED on
the shield will light up.

7. Then press and hold the Power Button switch for 2 to 3 seconds and release it to turn on the
SIM900 shield. You will notice the Status and Net Light will light up.

8. Wait for about 5 to 10 seconds and the green Net Light should blink every after 3 seconds which
means that the GSM Shield and SIM Card is now connected to the network, otherwise if the
Net Light blinks every 1 second it is still trying to connect to the network.
(Note: If the green Net Light only blinks every 1 second after a long time (ex. 2 minutes), go back
to the first step and double check that you follow correctly the steps. Also try to check that the
SIM Card is working and properly inserted.)

WWW.BITSTOC.COM

BitStoc Electronics

Page 5

9. If the Net Light blinks every 3 seconds, your GSM shield and Arduino board is now connected to
the network. Wait for a while your SMS message will appear on the recipient cellular phone.
(Congratulations!!!)

RECEIVING SMS and view in Computer Arduino Serial Monitor


10. This time we will try receiving an SMS. Repeat the previous steps above from number 1 to 4.
11. Now Compile and Upload RECEIVING Text Message Code found in the next pages. Remember
your Arduino Serial Port COM number and Make sure the comment line // is aligned to the
code line.
12. Do the previous step number 6 to 8. After step number 8, if the green Net Light blinks every 3
seconds your GSM shield and Arduino board is now connected to the cellular network.
13. Now OPEN your Arduino IDE and go to tab Tools > Serial Monitor. A Serial Monitor window will
pop out. On the 2 dropdown options found on the lower right of the Serial Monitor screen,
choose Carriage Return and 19200 baud. Look at the Serial Monitor and some characters
may appear. Wait for an OK text to appear.
14. Now get a cellular phone or any SMS capable device and send a message to the SIM Card
number that you placed on your GSM Shield. Wait for a moment and after a while you will see
the message printed on the Serial Monitor with the date, time and the composed message.
After your message in sent successfully, before sending a new text give an interval of 2 seconds
or more to give time for the GSM shield to process the previous message and stabilize. (You
should see a result like below. The number is intentionally tampered on the image).

WWW.BITSTOC.COM

BitStoc Electronics

Page 6

SENDING an SMS Text Message Code


/*
Arduino Sketch Code for SENDING SMS.
Created
by tronixstuff
Modified
by BitStoc for GSM Shield SMS Example
*/
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);
void setup()
{
SIM900.begin(19200);
delay(20000);
Shield and connect to the network
}

// give time to manually power ON the GSM

void sendSMS()
{
SIM900.print("AT+CMGF=1\r");
// AT command to SMS mode to text
delay(100);
SIM900.println("AT + CMGS = \"+639331247932\"");
// Change this to your desired recipient mobile
number. (international format)
delay(100);
SIM900.println("Hello! World. Success! This is a text message from an Arduino Uno.");
// Message
to send
delay(100);
SIM900.println((char)26);
// End AT command with a ^Z, ASCII code 26
delay(100);
SIM900.println();
delay(5000);
// give module time to send SMS
}
void loop()
{
sendSMS();
do {} while (1);
}

WWW.BITSTOC.COM

// Call this function to start sending the message

BitStoc Electronics

Page 7

RECEIVING Text Message Code (and Display received data on the Serial Monitor)
/*
Arduino Sketch Code for RECEIVING SMS.
Created
by tronixstuff
Modified
by BitStoc for GSM Shield SMS Example
*/
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);
char incoming_char=0;
void setup()
{
Serial.begin(19200);
SIM900.begin(19200);
delay(20000);
connect to the network

// for serial monitor display


// for GSM shield start serial programming
// give time to manually power ON the GSM Shield and

SIM900.print("AT+CMGF=1\r");
// set SMS mode to text
delay(100);
SIM900.print("AT+CNMI=2,2,0,0,0\r"); // Configuration to extract content of the received message.
Display it on Arduino Serial Monitor
delay(100);
}
void loop()
{
// Now we simply display any text that the GSM shield sends out on the serial monitor
if(SIM900.available() >0)
{
incoming_char=SIM900.read();
//Get the character from the cellular serial port.
Serial.print(incoming_char);
//Print the incoming character to the Arduino Serial Monitor.
}
}

WWW.BITSTOC.COM

BitStoc Electronics

Page 8