GPRS/GSM Quadband Module for Arduino and Raspberry Pi Tutorial (SIM900)


Introduction Go to index

NOTE: The Arduino codes of the tutorial have developed to work on Arduino IDE v1.0.1

NOTE: All the code examples in this tutorial developed for Raspberry Pi use the arduPi library. You can see the documentation and download the library here.

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.

NOTE: The Arduino/Raspberry Pi jumper MUST be in Arduino position. The Raspberry Pi position should be used only if the shield is connected to a Raspberry Pi. A wrong position of this jumper can damage the GPRS+GPS shield.

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.

StatusSIM900 behavior
OffSIM900 is not running
64ms On/ 800ms OffSIM900 not registered the network
64ms On/ 3000ms OffSIM900 registered to the network
SIM900 registered to the networkPPP GPRS communication is established

Step 2: Using GSM/GPRS module with AT commands Go to index

Important issues:

  • 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)!!!

CommandResponseDescription
ATOKIf you get OK, the communication with the module is working
AT+CPIN=”****”OKIf the SIM card is locked with PIN (**** is the pin number)
AT+COPS?Operator information

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.

Basic configuration:

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)GPRS GSM Quadband Module for Arduino and Raspberry Pi Tutorial (SIM900) schematic

#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
to
#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:

For more detail: GPRS/GSM Quadband Module for Arduino and Raspberry Pi Tutorial (SIM900)




© 2015 Powered By Engineering Projects Team, Raspberry Pi Projects

Scroll to top