Introducing the GPRS module: call and send SMS

Starting with the GPRS module




    • Present the GSM / GPRS card based on the SIM900 module.
    • Learn to connect and start it.
    • Use it to make calls and send SMS.


Arduino UNO GSM/GPRS Shield
Dupont Wires Arduino Power Source



We have seen several ways to connect our Arduino to the outside, such as Ethernet and Wi-Fi, but we may ever want to communicate with it and we do not have access to any of these networks, or we do not want to depend on them. It can be very useful, for example, to place in a weather station.

For this type of purpose we can use a GSM / GPRS module with a SIM card, so that we can communicate with it as if it were a mobile phone. And this card based on the SIM900 module allows us to send and receive calls and SMS and connect to the Internet, transforming our Arduino into a mobile phone.

gprs shield

The GSM (Global System for Global Communications) is the communication system that is most used in mobile phones and is a standard in Europe. The first functionality of this technology is the transmission of voice, but also allows the transmission of data (SMS, Internet), yes, at a very low speed of 9kb / s.

GPRS (General Packet Radio Service) is an extension of GSM based on packet transmission that offers a more efficient service for data communications, especially in the case of Internet access. The maximum speed (in theory) of the GPRS is 171kb / s, although in practice it is much smaller.



The module that we are going to use for the tutorial does not have pins to mount it directly on the Arduino, but there are models that do allow it. In any case, the connection is very simple.

This card is based on the SIM900 module, and we will configure and control it via UART using the AT commands.

First we will have to place the SIM card that we are going to use. The adapter for the cards is the size of normal SIMs, which have mostly been replaced by MicroSIM and NanoSim, so we will have to do with one or hook one of these in an adapter (the module we used in the session and you can get in the store this page includes adapters for all card sizes). With a little patience and expertise we could also place a nano or a mic directly, but in danger we will move and stop making contact.

Before connecting anything to the Arduino, we will place the jumpers that have the card so that we use to communicate pins 7 and 8.

bridges gprs

To connect it to our Arduino we have two options, and for both we will need an external power supply, since to connect the Arduino by USB it will be enough to turn on the module, but not to also feed the card. If we connect the external power to the GPRS shield and feed the Arduino with the USB or a separate source, we will only have to join the pins 7 and 8 for the serial communication and the GND between both cards.

  • If you use an Arduino Mega, the connection would be from pins 7 and 8 of the GPRS to pins 10 and 11 of the Mega.
  • In the programming we would also have to change the instruction in which we define the Software Serial instance that we created and put pins 10 and 11 (we will remember it later).
montaje gprs

If we connect the external power to the Arduino to part of the three previous connections we will have to join the 5V pins of the Arduino and the GPRS.

arduino gprs shield

To turn on the shield we have to place the switch in the correct position. The two positions correspond to each of the types of connection that we have explained above. Once we do this, two LEDs will light

To activate the power of the SIM card we also find two options. We can do it manually by pressing the button on one of the sides for one or two seconds and we will see that another LED lights up, and that one of the ones that had been on before starts flashing once per second. This blinking indicates that you are looking for the network. When it finds and connects it, it will change the blinking frequency and it will do it every 3 or 4 seconds. Of course, will not connect until we enter the SIM PIN, we’ll see now how to do it.

encendido modulo sim900

We can also activate it by program, but first we will have to carry out a welding on the pad “R13” that is right next to the red pin strip “J16”. And once this is done we will activate it by sending a 1 second pulse to pin 9 of the card. So if you want to use this type of activation you will have to add a cable between a digital pin (in our case 9) and pin 9 of the card that we have connected. Yes, remember that if the card is activated and we put the pulse back, what we will do is turn it off.

activar tarjeta software

Checking AT commands


To be able to communicate via AT commands we will have to load a program for serial communication as we have done so many times before. We will create an instance called SIM808 and select the Arduino pins that we want to use to communicate (Rx and Tx). We have chosen 7 and 8, but you can use whatever is compatible with the library. You can also change the communication speed, but it must be the same for the serial port and for the instance that we have created. We have chosen 19200 because it is the one that uses the SIM900, so that we can use the programs that we already have of those sessions.

#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8); //7 as Rx 8 as Tx
void setup()

void loop()
 //Send and receive at commands
 if (Serial.available() > 0)
 if (SIM808.available() > 0)

Once we have loaded the program we open the serial monitor and select the correct speed. The first AT command will serve us simply to know if the module responds and that communication therefore works. And this command is simply AT, we write it and press ENTER. You should respond with an OK; if we should not review that everything is in order: connections, ignition and correct speed

monitor serie AT

Checked this, we can enter the PIN of the SIM card, which is done by the command AT + CPIN = “XXXX”; where you will have to replace XXXX with the corresponding pin, in my case 1867, that is, AT + CPIN = “1867”. We will get a reply message indicating if the PIN is correct, and if it is, the LED that flashed once per second will do so every 3 seconds (more or less), indicating that it has found the mobile network.

comando at pin sim

And now we are ready to send and receive calls and connect to the Internet. To check that you can actually call the phone number of the SIM that you have put in the module, or use the command ATDXXXXXXXXX; (replacing the X with the phone number and respecting the “;”) to call whoever you want. And if you connect a helmet and a microphone to the module you can talk as if it were a normal phone.

monitor serie llamar recibir

Or if you call the phone number of the SIM that you have placed, you will hear a tone and in the serial monitor you will see how “RING” appears.

Making calls


PTo communicate with the module we will use AT commands, but the first thing we will do is include the SoftwareSerial.h library and configure the communication by pins 7 and 8 (10 and 11 for the Arduino Mega).

#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8); // 10 and 11 for Arduino Mega

The module uses a communication speed of 19200KHz, so in the setup we will configure the serial port for the SIM900 and for Arduino at that speed.

In addition we will introduce the PIN of the card to unblock it using AT commands and we will give you a little time to connect to the network. The command that we will use is AT + CPIN = “XXXX”, where we will replace XXXX with the PIN of our card.

  • Remember that since we are going to put the command inside a println, we will have to use the \ before each “so that they do not behave like a special character.
 So the setup would look like this:
void setup()
      //digitalWrite(9, HIGH); //Software turn on
      //digitalWrite(9, LOW);
      delay (5000);  
      SIM900.begin(19200);  //SIM900 serial port speed
      Serial.begin(19200);  //CArduino serial port speed
      delay (1000);
      SIM900.println("AT+CPIN=\"XXXX\"");  //SIM card pin at command
      delay(25000);  //time to find a network

We will create a function in which we will insert the necessary instructions to call and hang up the call, also using AT commands. To call we will use the command ATDXXXXXXXXX, (replacing the X with the number we want to call) and to hang ATH.

We do not have to be stingy with the time we keep the call, because sometimes it may take time to start giving tone and otherwise we could hang up before receiving anything on our mobile.

void call()
      SIM900.println("ATDXXXXXXXXX;");  //Call AT command
      SIM900.println("ATH");  //call dangle
      Serial.println("Call end");

And we only have to call the function when we want. In this example we simply have you call once and stay on hold indefinitely.

void loop()
      call();  //Calling
      while (1);
serie llamar

Sending SMS


The programming to send an SMS will be identical, but we will create another function that will be responsible for sending the AT commands to send the SMS.

First we will use the command AT + CMGF = 1 \ r to indicate to the GPRS module that we are going to send a message, and then we enter the number to which it is addressed with the command AT + CMGS = “XXXXXXXXX”.

Once this is done, we simply send the content of the message and end it with the character ^Z. The function would look like this:

void sending_sms()
      Serial.println("Sending SMS...");
      SIM900.print("AT+CMGF=1\r");  //Configure text mode to send or receive SMS
      SIM900.println("AT+CMGS=\"XXXXXXXXX\"");  //Destintaion number
      SIM900.println("SMS sent from Prometec.");  //SMS text
      SIM900.println((char)26); //End command ^Z
      Serial.println("SMS sent");
serie mandar mensaje

Here we leave a video for you to see how it has gone to us:

In the next session we will learn to receive calls and SMS. And, if you have left wanting more, we recommend that you take a look at this session. In it you will find a more worked program in which, among other things, we are going to use a function to send the AT commands and make sure that the module response is what we expect.



In this session we have learned several important things:

    • We can make our Arduino behave like a mobile phone.
    • How to connect and configure the GPRS card.
    • To send calls and SMS to any phone.


(1) Comment

    • Lucas Stoner

    Hi, I uploaded the code for the checking that the AT commands work and I got this error:
    SIM808 was not declared in this scope

Leave a Reply to Lucas Stoner cancel reply