Documentation: GPRS Quadband Module for Arduino Tutorial
Contents:
Introduction
Ingredients:
- 1 x Arduino
- 1 x GPRS Quadband Module for Arduino
- 1 x GPRS antenna
- 1 x SIM card
- 1 x PC
Difficulty: Medium -
Preparation Time: 30 minutes

Steps Index
Steps Index:
- The shield (hardware).
- Using GPRS module (Basic AT commands).
- Powering the board.
- Using the shield in standalone mode - Send SMS.
- Using the shield in standalone mode - Making lost calls.
- Video-Tutorial.
Step 1: The shield (hardware):
The board (shield) we are going to use in this tutorial is the GPRS Quadband Module for Arduino from Cooking hacks.
The GPRS shield is fully compatible with old Arduino USB versions, Duemilanove and Mega.
GPRS Shield diagram:
Step 2: Using GPRS module (Basic AT commands):
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, 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.
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:
Connect the shield to 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 (in Arduino UNO, the baudrate must be 9600) 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:
Important type commands in capital letters and with CR (carriage return) and LF (line feed)!!!
| Command | Response | Description |
| 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) |
| AT+COPS? | Operator information |
Note
If your GPRS module doesn't answer to AT commands, maybe it is configured in a different baudrate. The command for change it is AT+IPR. Try differents baudrates (9600, 19200, 34800, 57600, 115200) until you get to communicate. Once you can communicate, you can configure it in the baudrate you want. We suggest 19200 or autobaudrate (0).
| AT+IPR=19200 |
| AT+IPR=0 |
All the AT commands here
Making a call
Once the module is working, to make a call is very easy. The command to send is
| ATD*********; | ********* is the number to call |
| ATH | disconnect the call |
You can even add a speaker and a mic to the board.
Sending SMS
The next step is sending SMS's from the board
| AT+CSCA? | you get the SMS service center address |
| AT+CMGF=1 | select the SMS format (1=text mode) |
Sending the SMS
| AT+CMGS="*********" | ********* is the number to send the SMS |
| Text of the message ................. | The text of the message (without CR or LF) |
| 1A(hex) | End of message command |
Step 3: Powering the board:
Some of the USB ports on computers are not able to give all the current the module needs to work, if your module goes down when it tries to connect to the network, you can use an external power supply (12V - 2A) on the Arduino.
Remember set the Arduino power jumper to EXT!!! (if you use Diecimila or older).
How to set the power jumper in the shield?.
If you want the shield takes power from Arduino => Set the jumper to Arduino 5V possition
If you want the shield takes power from an external supply => Set the jumper to V ext. possition
For powering the shield from external supply, you have to use V in ext. connector (Vin + GND).
If you use a power supply with output smaller than 2 A, you should add an extra capacitor for the power.
For example, a 220 uF electrolytic capacitor between 3.3V and GND.
Step 4: Using the shield in standalone mode - Sending SMS:
Connecting the module to an Arduino Diecimila and using the code below, Arduino sends an SMS. Remember, now the serial communication jumpers have to be set on Arduino position.
Arduino code:
/*
* Sending SMS using GPRS module from Libelium for Arduino
* Basic program, just sends an SMS
* Copyright (C) 2008 Libelium Comunicaciones Distribuidas S.L.
* http://www.libelium.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Version 0.3
* Author: Marcos Yarza
*/
int led = 13;
int onModulePin = 2; // the pin to switch on the module (without press on button)
int timesToSend = 1; // Numbers of SMS to send
int count = 0;
void switchModule(){
digitalWrite(onModulePin,HIGH);
delay(2000);
digitalWrite(onModulePin,LOW);
}
void setup(){
Serial.begin(9600); // the GPRS baud rate
delay(2000);
pinMode(led, OUTPUT);
pinMode(onModulePin, OUTPUT);
switchModule(); // swith the module ON
for (int i=0;i<5;i++){
delay(5000);
}
Serial.println("AT+CMGF=1"); // set the SMS mode to text
delay(100);
}
void loop(){
while (count < timesToSend){
delay(1500);
Serial.println("AT+CMGS=\"*********\""); // send the SMS number
//(change ********* by the actual number)
delay(1500);
Serial.print("Hola caracola..."); // the SMS body
delay(500);
Serial.write(char(26)); // end of message command 1A (hex)
delay(5000);
count++;
}
if (count == timesToSend){
Serial.println("AT*PSCPOF"); // switch the module off
count++;
}
}
Step 5: Using the shield in standalone mode - Making lost calls:
Making calls is also very easy, here is a code example.
Arduino code:
/*
* Making a call using GPRS module from Libelium for Arduino
*
* Basic program, just makes a call
*
*
* 25/08/08 Zaragoza (Spain)
*
* Copyright (C) 2008 M. Yarza 2.008 - 07 - 22 - Zaragoza
* www.squidbee.org
* www.sensor-networks.org
* www.libelium.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
int led = 13;
int onModulePin = 2; // the pin to switch on the module (without press on button)
int timesToSend = 1; // Numbers of calls to make
int count = 0;
void testModule(){
Serial.flush();
}
void switchModule(){
digitalWrite(onModulePin,HIGH);
delay(2000);
digitalWrite(onModulePin,LOW);
}
void setup(){
Serial.begin(9600); // the GPRS baud rate
delay(2000);
pinMode(led, OUTPUT);
pinMode(onModulePin, OUTPUT);
switchModule(); // swith the module ON
for (int i=0;i<5;i++){
delay(5000);
}
}
void loop(){
while (count < timesToSend){
delay(1500);
Serial.println("ATD*********;"); // ********* is the number to call
delay(12000);
Serial.println("ATH"); // disconnect the call
delay(5000);
count++;
}
}
Step 6: Video-Tutorial:
Here's an explanatory video, which shows the whole process developed in this tutorial:
Fritzing Libraries
GPRS Quadband Module for Arduino
DownloadGPRS Quadband Module for Arduino offers GPRS connection to your Arduino board. It includes the HiLo SAGEM communication module.
You can send your data by SMS or do missed calls from your Arduino to mobile devices... or to another Arduino connected to this module.
You can download our Fritzing libraries from this area.
Links and Documentation
Links and Documentation:





