- Step 1: The shield (hardware)
- Step 2: Using GSM/GPRS module with AT commands
- Step 3: Powering the board
- Step 4: Using the shield in standalone mode – Calls
- Step 5: Using the shield in standalone mode – Sending and receiving SMS
- Step 6: Using the shield in standalone mode – FTP
- Step 7: Using the shield in standalone mode – TCP and UDP
- Step 8: Using the shield in standalone mode – HTTP
- Fritzing Libraries
- Links and Documentation
Introduction Go to index
- 1 x Arduino or 1 x Starter Kit for Raspberry Pi + Raspberry Pi
- 1 x GPRS/GSM Quadband Module for Arduino and Raspberry Pi (SIM900)
- 1 x GPRS antenna
- 1 x SIM card
- 1 x PC
Preparation Time: 45 minutes
NOTE: If you are looking for a complete solution to use 3G, GPRS and A-GPS, you can use our 3G/GPRS shield for Arduino and Raspberry Pi (3G + GPRS) or our Kit with Audio/Video
NOTE: The Arduino codes of the tutorial have developed to work on Arduino IDE v1.0.1
Step 1: The shield (hardware) Go to index
The board (shield) we are going to use in this tutorial is the GPRS/GSM Quadband Module for Arduino and Raspberry Pi (SIM900) from Cooking hacks.
The GPRS shield is fully compatible with old Arduino USB versions, Duemilanove and Mega.
The LED of the shield shows the status of the GPRS/GSM module. The table below shows the meaning of the blink of the LED.
|Off||SIM900 is not running|
|64ms On/ 800ms Off||SIM900 not registered the network|
|64ms On/ 3000ms Off||SIM900 registered to the network|
|SIM900 registered to the network||PPP GPRS communication is established|
Step 2: Using GSM/GPRS module with AT commands Go to index
- Use capital letters for AT commands.
- Send CR (Carriage return) and LF (Line feed) after the AT command.
- Place the serial communication jumpers in the right position.
- Use an external power supply and place the power jumpers in the right position. If the shield is powered from the Arduino or Raspberry Pi, the power jumper must be in Arduino 5V position. It the shield is powered from the Vin input (in the shield), the power jumper must be in Vext position.
Important type commands in capital letters and with CR (carriage return) and LF (line feed)!!!
|AT||OK||If you get OK, the communication with the module is working|
|AT+CPIN=”****”||OK||If the SIM card is locked with PIN (**** is the pin number)|
NOTE: Factory baudrate setting is auto-bauding by default. Baudrate can be fixed using the command AT+IPR=baudrate . Allowed baudrates: 0 (Auto-bauding) , 1200 , 2400 , 4800 , 9600 , 19200 , 38400 , 57600 and 115200 ;
All the AT commands here
Using 3G module with AT commands in Arduino
The first thing we are going to do with the module is to connect the module to a PC directly (using an Arduino as gateway) and check the basic AT commands. In this case, serial communication jumpers have to be set on USB gateway position.
Remember take out the ATmega microcontroller from the Arduino gateway.
Then connect the USB cable and the SIM card.
Finally plug the USB cable to the computer and open a serial port terminal to communicate via the usb port (e.g: hyperterminal (win), cutecom / gtkterm (linux)).
If you use the Arduino IDE serial monitor for sending AT commands – Be sure that you are sending CR (Carriage return) and LF (Line Feed).
Set the baudrate to 115200 bps and open the serial port, then press the ON button for two seconds. Then if you type AT you’ll get OK, this means that the communication with the module is working fine. Now, with the module working you can check some AT commands to control the module, the basic commands are:
NOTE: With some sketches, the buffer of the UART may be small, to increase the length of the buffer you need to change these lines in the file HardwareSerial.h in /arduino-1.0.X/hardware/arduino/avr/cores/arduino/ (or in file HardwareSerial.cpp in /arduino-1.0.X/hardware/arduino/cores/arduino/ depending on the Arduino IDE version)
#if (RAMEND < 1000) #define SERIAL_TX_BUFFER_SIZE 16 #define SERIAL_RX_BUFFER_SIZE 16 #else #define SERIAL_TX_BUFFER_SIZE 64 #define SERIAL_RX_BUFFER_SIZE 64 #endif #endif
#if (RAMEND < 1000) #define SERIAL_TX_BUFFER_SIZE 400 #define SERIAL_RX_BUFFER_SIZE 400 #else #define SERIAL_TX_BUFFER_SIZE 400 #define SERIAL_RX_BUFFER_SIZE 400 #endif #endif
Using SIM900 module with AT commands in Raspberry Pi
The first thing we are going to do with the module is to check the basic AT commands in gateway mode. Using gateway mode, commands can be sent from our Raspberry Pi directly to any serial module. To stablish UART connection with the module you can use several programs as cutecom in Raspbian graphical environment or minicom in a terminal window in order to use it via SSH . For using minicom follow these steps: