How to send and receive SMS with GSM/GPRS & GPS shield

By on May 30, 2013
Pin It

 GSM shield_COP_s

This post is one in a series showing you the main features of the GSM /GPRS/GPS shield and of its related library. The examples are great to have inspiration and reuse the material to create your own solutions. We already talked about how to use the shield to make calls, send DTMF tones and check whether the sender of an incoming call and command was in the trusted phonebook.

This is possible thanks to the call.h class contained within the call management library. Here we will show you few examples about how to deal with SMS management. The sms.h file, shows you how to send a text message in correspondence to a particular condition or how to extrapolate the content of a received text message and how to interprete the commands contained within it.



Let’s start from a sketch that can be used to send a text message to a preset number in case an alarm condition is happening. This example is similar to the one we shown regarding placing calls, it has been obviously tweaked to send a text message instead of placing a call.

In this case, the triggering condition is reached when the Arduino board reads an analog value that is below to one that has been  preset as a threshold value and the notification is done by sending a text message.

As for each sketch concerning this shield, first thing to do is to include the library (in this case the sms.h file) and then instantiate an object. This procedure can be done with the following commands:

#include “sms.h”


Each function belonging to this class must be initialized as follows:


In case the alarm status condition is verified, in order to send a message you simply call the following function:


The first parameter contains the message recipient, while the second one is the string containing the message body.

For example:

char message[]=“Hello world”;

char number[]=“3921234567”;


In this way the string “Hello world”  will be sent.

 In this example, in addition to sending the static string containing the warning message, we’ve also chosen to communicate the value that triggered the alarm condition: we must therefore transform the analog integer value read from the converter, in a string to be concatenated to the static one.


The function that takes care of this conversion is the on that follows:

 itoa(int integer, char* string, int base)

where base is usually 10 since we work in decimal base. If we were to work with numbers in different bases we just need to change this value as appropriate.


The function used to concatenate a string to another is:

strcat(char* string1, char* string2)



As said in the previous post, it is highly recommended to set a hysteresis or a low-pass filter to avoid repeatedly sending text messages in the case of oscillations around the threshold value.

In case you wish to add a message to communicate the return to the starting condition, you just need add the following piece of code before the update of the value_old variable.





Let’s have a look to the sketch used to interpret the commands received via text message. We’ll check the status of a digital output by sending simple text messages to the shield.

Will be possible, therefore, to give the Arduino some remote commands, by simply sending a text message.

To keep a minimum security level (in order to prevent unauthorized persons to execute commands) without imposing limitations to the sender number, the use of temporary password is provided.strstr(char* string, char* string2)


The first step is to check the presence of a new, unread, message and, in case, store the position in which it is stored on the SIM thanks to the following command:


which returns an integer containing the position of the first unread message. If no new messages are found it will return 0.

To analyze the content you need to ‘open’ the message and read the contents.


 The GetSMS function takes care of reading the message in the position shown and to save the sender number and the message body (up to a maximum of characters as indicated by the last parameter).

Once this is done you just need to control the text of the message to interpret the commands that have been sent.

First, we’ll verify that the password is contained in the message body (the password used in the examplse is ‘testpwd‘). To do this we’ll use the strstr(char* string, char* string2) function that checks if the second string passed is contained within the first, returning a pointer to the first character of the substring.


In case the substring is not present, a NULL pointer will be returned.

To verify the correct authentication simply insert the remaining code portion within the condition:

if(p){ […] }

Let’s recall that if(p) is equivalent to writing if (!=NULL).

At this point, when authentication is done, as done previously for the password, we’ll check the presence of predetermined command strings. Once we’ve got the message, we’ll proceed with the interpretation, by enabling or disabling the output.

Finally, we will delete the message, to avoid filling up the memory available on the SIM card. This will be done with the command:





As previously mentioned, we can provide authentication also by checking the sender.

In the same way as, in previous examples, we checked whether the sender of an incoming call was authorized, you can do the same operation with SMS sender.


Saving the trusted contacts on the within a specific range of the SIM will be enough: we just need to check what’s returned by the function in which we pass the range using the last two parameters.

In this case the authorized number is saved between position 8 and position 10 (both included) of the SIM.


Thanks to the previous condition we will enter the routine associated with the condition in which the SMS is received from a trusted number.

Differently from the previous case, in this example we will analyze a string containing the logic states (0 or 1) that must be set on the digital outputs (for example: “LEDCONF0000” or “LEDCONF1001” and so on.)

Using the substrings search function we will identify the command for the allocation of the states and then we will move forward analyzing it character by character and then setting the appropriate status to its output.

In this example, the “LEDCONF0000” string, sent to turn off all outputs, is composed of the first part (LEDCONF) that relates to the command type (in fact we could send different commands within a single message) and by a following part containining 0000 as the states to be set on the outputs ranging from 9 to 12.

Recalling that the search function, if successful, returns a pointer to the first character of the substring, you will need to move forward of a number of characters that is sufficient to reach the first value containing the information on the first output.

We’ll do this thanks to the strlen(char* string) function that gives back an integer with the length of the string passed as a parameter.

Then we translate the pointer of a number of characters that is equal to the length of the command:


In this way the p pointer will refer to the first numeric character.

will be sufficient to check if this is equal to 1 or 0 to activate or not the output to it associated with it.


For your convenience we will put everything in a loop equipped with some diagnostic messages (not strictly necessary) sent to the hardware serial port.

As we did before, at the end of the cycle we first delete the SMS and then add a a few seconds delay to avoid making continuous queries to the shield.




In this last example we chosen to create a sketch using both the classes we created: that for the management of phone calls and that to manage SMS.

Upon the reception of a call from a trusted number, the program will check the status of the inputs (digital ones have been chosen but you can be easily extend to analog ones) and will communicate this information through an SMS to a specified number.

Since this sketch uses functions already explained in this and in the previous article, we will just post the code without explaining in detail each step.

About Boris Landoni

Boris Landoni is the technical manager of Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.


  1. Pingback: How to send and receive SMS with GSM/GPRS &...

  2. Pingback: The GSM/GPRS & GPS Shield: some Http connections examples | Open Electronics

  3. Pingback: How to use GPS functions with GSM/GPRS & GPS shield | Open Electronics

  4. Filippos

    September 4, 2013 at 4:58 PM

    Hi there,

    I keep getting this error:

    Trying to force the baud-rate to 9600

    ERROR: SIM900 doesn’t answer. Check power and serial pins in GSM.cpp


    I am using the GSM shield sold by OpenElectronics and your code but nothing seems to work! I changed 6 arduino Uno and tried 3 different power supply units.

    Any Idea why it doesn’t work

    Thanks in advance

    • BorisLandoni

      September 18, 2013 at 11:16 AM

      Have you chose the soft serial?
      There are two jumper to select hardware serial or soft.
      Please select soft

  5. Kostas

    September 8, 2013 at 2:00 PM

    Hello there,I try example2 and wrks perfect.But when ill try to change the pin number that i want to make HIGH, nothing happent.For example if I change pin13 to pin12 on pin12 i havent HIGH when I send sms.Any saggestions?
    Wait answer asap.
    Have a nice day.

    • BorisLandoni

      September 18, 2013 at 11:18 AM

      Try to set the pin as output

  6. Nazmul Hasan Pias

    October 5, 2013 at 7:48 PM

    Hi , I’m a beginner . I want to use your library without aurduino , in any avr microcontroller using available compilers . How can I do this ?

    • 4routing (ADMIN)

      January 2, 2015 at 11:36 AM

      did you implement something on atmega?

  7. Tom

    October 5, 2013 at 11:04 PM

    Hi there,

    I can send SMS messages but whenever I try and read a new SMS it doesn’t return the text message (it returns nothing at all). The GetSMS function returns GETSMS_OTHER_SMS. I know the message is on the phone as I can put the SIM in a standard phone and it shows up. Any ideas?

    • Martin

      October 15, 2013 at 2:47 PM

      I have the same problem, but when I active DEBUG it prints one message over and over again.

      How do I fix this?

      • Martin

        October 16, 2013 at 1:47 PM

        I ended up using this code;

        char position;
        char phone_num[20]; // array for the phone number string
        char sms_text[15]; // array for the SMS text string
        if (started){
        position = 1;
        if (position) {
        // there is new SMS => read it
        sms.GetSMS(position, phone_num, sms_text, 100);
        /* #ifdef DEBUG_PRINT
        sms.DebugPrint(“DEBUG SMS phone number: “, 0);
        sms.DebugPrint(phone_num, 0);
        sms.DebugPrint(“rn SMS text: “, 0);
        sms.DebugPrint(sms_text, 1);

        Since I was only looking for one message thats always the first one. It contains settings for gprs.

  8. karlcedrick

    December 12, 2013 at 12:26 AM

    what programming tool is used in developing the program?

    • BorisLandoni

      December 21, 2013 at 4:39 PM

      ? Arduino IDE

  9. Juan Alexis Vidal Gonzales

    December 16, 2013 at 7:44 AM

    I’m connecting a gps and sd card ublox whith gprs shield (separated work well) and together the gprs shield does not turn on, please help

    • BorisLandoni

      December 21, 2013 at 4:50 PM

      Be sure that the memory doesn’t overflow

  10. Martín

    December 18, 2013 at 1:34 AM

    Hello, I need some help please.
    I’m trying to get to work example 2 without success.
    I tried with a power supply of 12 V @ 1,5 A and the jumper are configured as software serial.
    Is it possible obtain a detailed step by step to check this shield and get to work example 2?
    Thanks in advance for your help.
    Best regards

    • BorisLandoni

      December 21, 2013 at 4:51 PM

      The other examples work?
      What the problem?

      • Martín

        December 24, 2013 at 1:20 AM

        Hi Boris, I tried example 4 too without success.
        The problem is I have no idea why doesnt work, there is no response from the shield and Arduino Uno.
        There is anything I can do in order to check the shield?
        There is a guide step by step in order to make work these shield with example 2 or 4?
        Merry christmas by the way!!!
        Thank for your help.

        • BorisLandoni

          December 27, 2013 at 8:54 AM

          Check the power, the serial connection anche the library installation.
          The compiler works?

          • Martín

            December 27, 2013 at 2:13 PM

            The power supply is 12V 1.5 A.
            The jumper are configured as software serial.
            The library is OK and the compiler work fine, without errors.
            This shield came with a guide in italian, that I cant understand.
            How I can activate the DEBUG? and where I can see what’s happening.
            Do you have any ideas?

          • BorisLandoni

            December 27, 2013 at 2:17 PM

            From the terminal you can see the debug.
            You can also enable other debug message modifing the library

          • Martín

            December 29, 2013 at 3:20 PM

            Hi Boris, Now I can see the debug in the serial monitor.
            I tried example 3, from call examples, and works very good.
            Thanks for your help.
            Best regards

        • Murad Hijjawe

          May 16, 2015 at 9:56 PM

          How to program the arduino uno with gsm/gprs sim900A which I am connecting the following sensors to them :
          1- tech sensor
          2- temp. sensor
          3-co2 sensor
          4-pulse sensor
          please ?

  11. benzon sunday

    January 10, 2014 at 6:58 AM

    Hello, I’m a student and currently building my design project. I want to ask if i can use AT commands while using the library?. For example i want to check the battery level, I want to issue AT command to the SIM908 : gsm.println(“AT+CBC”). Is this possible? thank you. This post is very helpful, i’ve learned a lot.

    • BorisLandoni

      January 29, 2014 at 11:51 AM

      Hi, yes of course, in the examples you can find a sketch to do that

  12. Julia Pérez del Río

    January 24, 2014 at 10:48 AM

    Hi, Boris
    Firstly, I wanted to congratulate you on your wonderful posts, they are very clear and easy to follow!
    Secondly, I wanted to ask you a few questions. I have a customer who wanted to make voice calls from the location of its installation, in case an alarm happened. So I don’t need the ability to make a lost call, but to be able to perform a real conversation. I understand that with the GSM/GPRS & GPS Shield and the SIM900 or SIM908 it’s possible, right?
    The Arduino can be powered to the installation’s power, but in case of power failure, they have to be able to make the phone calls, so it would be necessary to have the ability to be powered through an external battery. I understood through your post that this can only be done with the SIM908, did I get it right?
    And lastly, I read that the GSM/GPRS & GPS Shield is Arduino Duemilanove, UNO and MEGA compatible. Could you make a complete list of the compatible devices? Just to be able to choose the best one according to the installation’s requirements.

    Thank you so much in advance!

    • BorisLandoni

      January 29, 2014 at 11:54 AM

      With both SIM900 and SIM908 you can perform audio comunication, but only SIM908 includes can manage the battery.
      You can add an external battery to the shield but not controlled by SIM90x.
      The shield can be used with UNO, 2009, mega. We tested these devices.

      • Julia Pérez del Río

        January 29, 2014 at 12:02 PM

        Great, thanks for your answer! I was thinking of buying the 1A lithium battery charging module with a Polymeter Lithium Ion Battery. I understand that this can only be done with the SIM908, right?
        But if I power my Arduino with the 1A lithium battery charging module and then the shiedl through the Arduino? Would I be able to use the SIM900 then?

  13. Bhanu teja

    May 5, 2014 at 6:20 PM

    Hey, I brought Sim900 module from local store. Trying to use your library with MEGA, Changed library for MEGA’s compatibility but no Response,
    Connecting it to pins 2 & 3 of mega and also to 4 & 5

    Getting this error:



    Please help!!

    • BorisLandoni

      June 3, 2014 at 3:28 PM

      Are you using our shield?

    • DeanSaunders

      October 29, 2014 at 2:18 PM

      I had the same problem. I solved it with more volt (9v), and less serial speed (9600)

  14. Gordon

    May 17, 2014 at 12:53 PM

    Hi Boris

    I have the GPRS Shield V2.0 and the Intel Galileo Board, I need to receive an sms to

    my GPRS Shield and be able to recognize the number of the sender and the body of

    the message.

    How can I do it?

    I tried to use the sotwareserial but it doesn’t work on Galileo.

  15. Carvelle Smith

    June 13, 2014 at 2:25 AM

    Boris, Please Help, bought the Arduino UNO R3 SIM908 and the GSM/GPRS and GPS shield a month ago. But now we can’t even get Exmaple 2 on your demonstration to work. when we send an sms for the 1st time, it turns on the Lamp, but when we try to send LEDOFF, the arduino freezes and prints out this junk on the serial monitor:

    ATT: OK

    RIC: ààààààðààààààðàààààààààààðààààààðààààààààààðàààààààààààðààààààààðàààààààààðàààààààààààààààààððààààààààààðààààààðàààààààààààðààààààðààààààààààðàààààààààààðààààààààðààààààààðààààààààààààààààààðààààààààà

    when we doing the test, both the USB and external 12VDC are plugged in. What are we doing wrong, Please help

    • BorisLandoni

      June 13, 2014 at 3:52 PM

      Hi, Are you using our shield?
      The power supply?

  16. Ankit

    July 3, 2014 at 2:13 PM

    If a message is sent to a GSM module interfaced with a micro-controller through UART, can the information about the message (text, number) be read on the UART lines? Is it possible to wake the MCU after receiving any message?

    • BorisLandoni

      July 4, 2014 at 2:45 PM

      There is a function to get the Sender and the Message.
      You have to call this function

  17. supra footwear usa

    July 4, 2014 at 7:09 PM

    thank you for share!

  18. air max 90 cheap

    July 4, 2014 at 7:09 PM

    thanks for share!

  19. jordan baby

    July 8, 2014 at 5:31 AM

    nice articles

  20. ysl downtown bag

    July 8, 2014 at 5:31 AM

    thank you for share!

  21. buy christian louboutin

    July 9, 2014 at 3:35 AM

    thanks for share!

  22. christian louboutin cheap

    July 9, 2014 at 3:36 AM

    good articles

  23. cheap louboutin

    July 9, 2014 at 3:36 AM

    nice articles

  24. jordan outlet

    July 9, 2014 at 3:36 AM

    thank you for share!

  25. Chathuranga

    July 11, 2014 at 12:43 PM

    Hi.. an example code on the library gives this error ” avrdude: stk500_getsync(): not in sync: resp=0x00 ”

    what is this about.. please help me…

    • BorisLandoni

      July 21, 2014 at 5:58 PM

      This is a comunication problem. Not due to library

    • Siddharth

      April 6, 2015 at 9:44 PM

      Disconnect your gsm module with arduino and then upload the code.

    • sayeodi ali

      December 1, 2017 at 1:01 AM

      plz how u fix this error?

  26. Adrian Sima

    July 23, 2014 at 2:15 PM

    Hello Boris,


    I can not use the shield, neither the small breakout to send an SMS.


    I have Arduino UNO.

    I have purchased and

    the shield that works with this breakout.

    I tried the library you provide but it keeps on reseting, which is a know issue due to

    insuficient memory capacity.

    The next thing I tried is to open up a software serial communication using this code:


    SoftwareSerial SIM900(2, 3);

    void setup()




    delay(20000); // give time to log on to network.


    void SIM900power()

    // software equivalent of pressing the GSM shield “power” button


    digitalWrite(9, HIGH);


    digitalWrite(9, LOW);



    void sendSMS()


    SIM900.print(“AT+CMGF=1r”); // AT command to send SMS message


    SIM900.println(“AT + CMGS = “+4xxxxxxxxx””); // recipient’s mobile number, in international format


    SIM900.println(“Hello, world. This is a text message from an Arduino Uno.”); // message to send


    SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26



    delay(5000); // give module time to send SMS

    SIM900power(); // turn off module


    void loop()



    do {} while (1);


    I checked the power on the shield and on the small breakout board and it is OK, 4.4 V.

    Also I checked D3 from Arduino with an oscilloscope and everything looks fine.

    I checked the RX pin from SIM900 connector on the shield and also it looks fine ( half voltage compared with D3 ).

    The green led on the small break-out blinks for a while ( 1Hz ).

    But the SIM900 processor doesn’t respons in any way. No waveform on D2. No SMS :).

    Do you have any idea what is going on?

    Thank you,

    Adrian Sima

    • BorisLandoni

      August 2, 2014 at 10:46 AM

      And the current of the power supply?
      You need >1A

  27. Enrique Ramirez

    September 24, 2014 at 10:03 PM

    Hello Boris, please how I can pass the gsm.SimpleRead() to an string variable. I want display this value on lcd.

  28. Velt

    October 17, 2014 at 8:25 PM

    Hello Boris, I’ve tried your code on example2, it compiled successfully but nothing was shown in the serial monitor…can you please guide me, Im new in this programming and Id be greatful if you help me, thank you in advance

  29. Velt

    October 17, 2014 at 8:29 PM

    Ive tried and tried but nothing is shown in the serial monitor, im using your code on example2

    • BorisLandoni

      November 4, 2014 at 2:52 PM

      Other examples works?

  30. samrat

    November 1, 2014 at 9:07 PM

    hi guys i m making my semester project fingerprint and gsm lock it is not working properly finger print works great but mu gsm in put is not working nice once i start the audrino. Gsm works nice after that when program runs another time it wont work can any one tell me how to check conditions again and again and plz dont say that us if else condition

  31. Tor Ocsalev

    November 24, 2014 at 4:52 PM

    Why am I getting this? right pin allocations and right volts and amperes. At first I used the readSMS commad and I did not get this from my serial monitor. It was able to go status=ready but keeps on complaining that I should use the GetSMS. When I used the GetSMS, this is what I got. WHY?

    GSM Shield testing.
    Trying to force the baud-rate to 9600

    ERROR: SIM900 doesn’t answer. Check power and serial pins in GSM.cpp


    • BorisLandoni

      December 1, 2014 at 6:47 PM

      Power supply?

      • Siddharth

        April 14, 2015 at 12:11 AM


        I am getting the same serial output.
        The power is correct.
        Also, to change the pins in GSM.cpp, I opened that file in dev c++ and changed the pins and saved it.

        Is that the right way to do it?


        • Tom

          April 22, 2015 at 7:21 PM


          I got the same output too.
          I’ve followed every single steps with the help of youtube videos, but still no luck.
          Btw, i can use adruino mega without a problem.
          But my project need to use arduino uno instead.
          any help will be much appreciated.


          • BorisLandoni

            May 27, 2015 at 10:27 PM

            Sorry for my late.
            With Mega it works?
            For uno check the setting beacuse Mega use the Serial Hardware and UNO the soft serial.
            Also I suggest you to use the softserial from the distribution, not from the Arduino IDE

      • eva

        April 22, 2015 at 7:31 PM


        Me too got the some output. i use arduino uno.
        however, i didnt face any problem when i use arduino mega.
        i followed all the steps provided. i use 9V/2A adapter.

        looking forward for you kind help..thanks

  32. Abhimanyu Muraleedhara Warrier

    February 4, 2015 at 3:24 PM

    pls help project is access control system,if un authorized entry is detected(by RFID & PIC),i just want to send a sms from SIM900A. how can i do it ???

    • Nazmul Hasan Pias

      February 17, 2015 at 9:48 AM

      you can use this function to send sms , its simple . you need to connect your gsm modem with arduino via TX and RX pin or you can also use software Serial library for doing this .

      void send_sms( char *m , char *cm )








  33. Dan G.

    February 24, 2015 at 5:31 PM


    I uploaded GSM_GPRSLibrary_SMS.ino on my Arduino Uno.

    I have an issue, after module is ready (status=READY), I receive in continuous mode (in serial monitor), the following lines:

    This method is deprecated! Please use GetSMS in the SMS class.
    ATT: +CMGL

    And I’m not able to send any other commands. Any Idea?

    The GPS library is working well!

  34. Vineeth Cherupalath Illam

    March 4, 2015 at 6:25 PM

    Can Any one post the MikroC code for sim900a with pic16f877a to send message and recieve msg???
    kindly help

  35. Rahul Maheshwari

    March 7, 2015 at 4:35 PM

    hello, my question is through any at command send sms to all in which number stored in sim memory

  36. Siddharth

    April 6, 2015 at 10:03 PM


    I tried using the code that you have posted but got the following error –

    sketch_apr07a.cpp.o: In function __static_initialization_and_destruction_0':

    /Streaming.h:27: undefined reference to LOG::LOG(int)’

    sketch_apr07a.cpp.o: In function loop':

    C:UsersnishantAppDataLocalTempbuild3685541356291295312.tmp/sketch_apr07a.cpp:70: undefined reference to gsm’

    C:UsersnishantAppDataLocalTempbuild3685541356291295312.tmp/sketch_apr07a.cpp:70: undefined reference to gsm'

    C:UsersnishantAppDataLocalTempbuild3685541356291295312.tmp/sketch_apr07a.cpp:70: undefined reference to SIMCOM900::read()’

    sketch_apr07a.cpp.o: In function setup':

    C:UsersnishantAppDataLocalTempbuild3685541356291295312.tmp/sketch_apr07a.cpp:40: undefined reference to gsm’

    C:UsersnishantAppDataLocalTempbuild3685541356291295312.tmp/sketch_apr07a.cpp:40: undefined reference to gsm'

    C:UsersnishantAppDataLocalTempbuild3685541356291295312.tmp/sketch_apr07a.cpp:40: undefined reference to GSM::begin(long)’

    C:UsersnishantAppDataLocalTempbuild3685541356291295312.tmp/sketch_apr07a.cpp:52: undefined reference to InetGSM::attachGPRS(char*, char*, char*)'

    C:UsersnishantAppDataLocalTempbuild3685541356291295312.tmp/sketch_apr07a.cpp:60: undefined reference to InetGSM::httpGET(char const*, int, char const*, char*, int)’

    Can you please help me out?

    Thanking you

  37. M Hilmi Shah

    May 13, 2015 at 5:04 PM

    hi,,i don’t know what to say..there are these errors when i’m compiling the example..what should i do?? :(

  38. Murad Hijjawe

    May 16, 2015 at 10:04 PM

    How to program the arduino uno with gsm/gprs sim900A which I am connecting the following sensors to them :
    1- tech sensor
    2- temp. sensor
    3-co2 sensor
    4-pulse sensor
    please ?

  39. mehdi

    September 8, 2015 at 7:50 PM

    I try with example 2 but when I send an sms to the module sim900 I only receive in serial monitoring consul 0 over and over…….why I can not receive sms with that …..other function is perfect

  40. Deepak CG

    September 20, 2015 at 6:47 PM

    Trying to force the baud-rate to 9600

    ERROR: SIM900 doesn’t answer. Check power and serial pins in GSM.cpp


    why the serial monitor gives this

    • Michael Kimollo

      January 2, 2016 at 12:33 PM

      The most possible cause would be RX and TX pin serial pin configurations in GSM.cpp,

      If you are using UNO, try to change these two line from GSM.cpp

      #define _GSM_TXPIN_ 2 ——-> #define _GSM_TXPIN_ 7

      #define _GSM_RXPIN_ 3 ——–> #define _GSM_RXPIN_ 8

      Then tell me how it responds!!

  41. wooja kurosaki

    March 2, 2016 at 12:56 AM

    good day sir! i tried to display the text that the GSM shield sends out on the serial monitor. the output was this

    +CMT: “+639XXXXXXXX”,””,”16/03/02,8:31:09:+32″
    hello world

    what does +32 mean? and where is it from?

  42. franck Moussounda

    June 20, 2016 at 12:02 PM

    Hi! i want to send a int data with sms gsm shield SIm900. i send the first message but i don’t send the value with itoa function; please could you help me

    #include “SIM900.h”
    #include “SoftwareSerial.h”
    #include “sms.h”
    SMSGSM sms;
    #include “call.h”
    CallGSM call;
    #include “GSM.h”

    int numdata;
    boolean started=false;
    char smsbuffer[160];
    char n[20];
    char sms_position;
    char phone_number[20];
    char sms_text[600];
    int i;

    char P1_apres_cpr_str [6];
    char P2_apres_secheur_str[6];
    char P3_apres_filtre_str[6];

    int analogPin5=A0;
    int analogPin6=A1;
    int analogPin7=A5;

    int analogValue5=0;
    int analogValue6=0;
    int analogValue7=0;

    int P1_apres_cpr=0;
    int P2_apres_secheur=0;
    int P3_apres_filtre=0;

    int voltageP1=0;
    int voltageP2=0;
    int voltageP3=0;

    unsigned long previousTime=0;
    unsigned long interval1=140000;
    unsigned long interval2=75000;
    unsigned long interval3=250000;
    unsigned long interval4=195000;

    void setup()

    Serial.begin( 9600);
    Serial.println(“GSM Shield testing.”);
    if (gsm.begin(9600)){
    else {Serial.println(“nstatus=IDLE”);}


    void loop()
    int g1=analogValue5+20;
    int g2=analogValue5-20;
    int g=(g1+g2)/2;
    // Serial.print(“analogValue5:”);
    // Serial.println(analogValue5);
    // Serial.print(“voltageP1: “);
    // Serial.print(voltageP1);
    // Serial.println(” V”);
    Serial.print(“P1_apres_cpr: “);
    Serial.println(” bar”);

    unsigned long currentime=millis();

    if (( P2_apres_secheur>6 && P3_apres_filtre>6)&& (P1_apres_cpr>0 && P1_apres_cpr=interval2)&& ((P1_apres_cpr=3)||(P1_apres_cpr=4)||(P1_apres_cpr=5)||(P1_apres_cpr=6)||(P1_apres_cpr=7)))
    { if(started){

    if(sms.SendSMS(“+3362331XXXX”, “Degradation de performance de l’UPA (blocs vis ou le niveau d’huile), intervenez le plus tot possible (moins de 7 jours)”))

    Serial.println(“nSMS sent OK”);}
    { Serial.println(“nError sending SMS.”);}

    Serial.println(“Degradation de performance de l’UPA (blocs vis ou le niveau d’huile), intervenez le plus tot possible (moins de 7 jours)”);
    previousTime = currentime;
    else if ((((unsigned long)(currentime-previousTime))>=interval1)&& ((P1_apres_cpr=8)||(P1_apres_cpr=9)))
    {if(started){ if (sms.SendSMS(“+3362331XXXX”, “Degradation de performance de l’UPA (blocs vis ou le niveau d’huile), vous maximum 2 semaines pour intervenir)”))
    { Serial.println(“nSMS sent OK”);
    { Serial.println(“nError sending SMS.”);}
    Serial.println(“Degradation de performance de l’UPA (blocs vis ou le niveau d’huile), vous maximum 2 semaines pour intervenir”);
    previousTime = currentime; }
    else { Serial.println(“Ok”);}
    // else if (( P2_apres_secheur<7.5 && P3_apres_filtre0&& P1_apres_cpr<=9.5 ))
    else if (( P2_apres_secheur<6 && P3_apres_filtre0 && P1_apres_cpr=interval3) && ((P1_apres_cpr=8)||(P1_apres_cpr=9)))

    if (sms.SendSMS(“+3362331XXXX”, “Degradation de performance de l’UPA (blocs vis ou le niveau d’huile), vous avez maximum 2 semaines pour intervenir”))
    Serial.println(“nSMS sent OK”);
    { Serial.println(“nError sending SMS.”);}
    Serial.println(“Degradation de performance de l’UPA (blocs vis ou le niveau d’huile), vous avez maximum 2 semaines pour intervenir”);
    previousTime = currentime; }
    else if ((((unsigned long)(currentime-previousTime))>=interval4) && ((P1_apres_cpr=4)||(P1_apres_cpr=5)||(P1_apres_cpr=3)||(P1_apres_cpr=6)||(P1_apres_cpr=7)))
    if (sms.SendSMS(“+3362331XXXX”, “Degradation de performance de l’UPA (blocs vis ou le niveau d’huile), intervenez le plus tot possible (moins de 7 jours)”))
    { analogValue5=analogRead(analogPin5);
    float g1=analogValue5+20;
    float g2=analogValue5-20;
    float g=(g1+g2)/2;
    itoa(P1_apres_cpr, P1_apres_cpr_str, 10);
    Serial.println(“nSMS sent OK”);
    { Serial.println(“nError sending SMS.”);}
    Serial.println(“Degradation de performance de l’UPA (blocs vis ou le niveau d’huile), intervenez le plus tot possible (moins de 7 jours)”);
    previousTime = currentime; }
    else { Serial.println(“Ok”);}

  43. franck Moussounda

    June 22, 2016 at 3:40 PM

    Hi!, so i want to send to multiple receiver. It’s possible to send in same time the same sms to multple receivers?

  44. franck Moussounda

    June 22, 2016 at 3:41 PM

    How i can send to multiple receivers in the same time?

    • Bo Herrmannsen

      September 19, 2016 at 3:17 PM


      you get the idea…. just change the number you want to send to

  45. Ronnel

    July 31, 2016 at 9:02 AM

    Hi sir Good Day! im having a difficulty on the code that you have provided above.. it says…(picture below).. i have used the library from
    hoping to get your reply

    • Ronnel

      July 31, 2016 at 9:04 AM

      i have used your example 2 bdw

      • Bo Herrmannsen

        September 19, 2016 at 3:14 PM

        arduino ide has a GSM lib and you need to remove that one first

        this is just a guess :-D

  46. Muhammad Usman Khan

    August 9, 2016 at 6:37 PM

    where is the Library sms.h. means from where to download?

  47. Pingback: دریافت sms

  48. Bo Herrmannsen

    September 19, 2016 at 3:11 PM


    Got the shield and want to build a remote control with it

    i use example 3 to start with and i wonder what the purpose of this line is:

    char number[]=”3921234567″;

    the sketch use pos 8 to 10 to auth what numbers are allowed

    so why the need to supply the sketch with a phone number

  49. Bo Herrmannsen

    September 20, 2016 at 10:34 PM


    that one gives the error:

    no matching function for call to ‘SMSGSM::GetAuthorizedSMS(int, char [11], char [180], int, int, int)

    taken from example 3

  50. em ef

    October 22, 2016 at 9:56 AM

    On example 2, when i sends testpwd LEDON, it turns on, but when i sends testpwd LEDOFF, it doesnt turn off, and in serial moitor, no more NUOVO MESSAGGIO, POS=, and no PSWD OK, only at first message it works.
    I need some help, thanks.

  51. Tiny Clintoy

    January 21, 2017 at 6:51 PM

    hi sir,, it is possible to make one identified number and can disregard the unauthorized number ?

  52. Tiny Clintoy

    January 21, 2017 at 6:55 PM

    im looking forward for your answer..thanks

  53. nhatviettin

    March 1, 2017 at 3:37 AM

    thanks, i hope you will help me for future…

  54. cafu

    March 7, 2017 at 5:45 AM

    can i save numbers in the arduino with only serial software library?

  55. cafu

    March 7, 2017 at 5:51 AM

    How do i set phone numbers into a variable for multiple sim cards??is that possible?

  56. Jeff in 92833

    April 16, 2017 at 1:13 PM

    I’d like to use GSM/GPRS modules for some remote monitoring. The technical aspect is easy enough to understand, but do I have to set up an account for each module with a cellular service provider?

  57. Shaira Garcia

    May 17, 2017 at 6:34 AM

    How do i can i use this on an arduino clone. I think it’s an ATMega

Leave a Reply