My Cart

GPRS Dualband Module for Arduino

Difficulty Level: Intermediate -

1. Introduction

Ingredients:

Preparation Time: 30 minutes

Buy now

Step 1: The shield (hardware):

The board (shield) we are going to use in this tutorial is the GPRS Dualband Module for Arduino from Cooking hacks.

The GPRS shield is fully compatible with old Arduino USB versions, Duemilanove and Mega.

GPRS Modules:

  • GSM 900/1800MHz: GPRS DC35E6416-C2 Module.
  • GSM 850/1900MHz: GPRS DC35U6416-C2 Module.

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 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 AT+CPIN="****" AT+COPS?
OK OK  
If you get OK, the communication with the module is working If the SIM card is locked with PIN (**** is the pin number) 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)
AT+CSCS="IRA"

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:

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.1
   *  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(){

   pinMode(led, OUTPUT);
   pinMode(onModulePin, OUTPUT);

   Serial.begin(19200);               // the GPRS baud rate
      
   switchModule();                    // swith the module ON
   
   for (int i=0;i<2;i++){
      delay(5000);
   }
   
      Serial.println("AT+CMGF=1");         // set the SMS mode to text
      delay(100);
      Serial.print("AT+CSCS=");
      Serial.print(34,BYTE);
      Serial.print("IRA");
      Serial.println(34,BYTE);
   }

   void loop(){
   
   while (count < timesToSend){
      delay(1500);
      Serial.print("AT+CMGS=");          // send the SMS the number
      Serial.print(34,BYTE);             // send the " char
      Serial.print("*********");         // send the number (change ********* by the actual number)
      Serial.println(34,BYTE);           // send the " char
      delay(1500);
      Serial.print("Hola caracola...");     // the SMS body
      delay(500);
      Serial.print(0x1A,BYTE);             // 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:

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(){

   pinMode(led, OUTPUT);
   pinMode(onModulePin, OUTPUT);

   Serial.begin(19200);              // the GPRS baud rate
      
   switchModule();                    // swith the module ON
   
   for (int i=0;i<2;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

Download Fritzing DualbandModule for Arduino

GPRS Dualband Module for Arduino offers GPRS connection to your Arduino board. It includes the DC3500 DavisComms 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.