Tutorial – Arduino Uno and SM5100B GSM Cellular

Connect your Arduino Uno or compatible to the cellular network with the SM5100 GSM module shield.

This is chapter twenty-six of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

If you are looking for tutorials using the SIMCOM SIM900 GSM module, click here, and here if you have an Arduino Mega.

Updated 15/01/2014


The purpose of this tutorial is to have your Arduino to communicate over a GSM mobile telephone network using the SM5100B GSM Cellular Shield:


My goal is to illustrate various methods of interaction between an Arduino and the GSM cellular network using the SM5100B GSM shield from Sparkfun, with which you can then use your existing knowledge to build upon those methods. Doing so isn’t easy – but it isn’t that difficult.

Stop! Please read first:

  • It is assumed that you have a solid understanding of how to program your Arduino. If not, start from chapter zero
  • Sending SMS messages and making phone calls cost real money, so it would be very wise to use a prepaid cellular account or one  that allows a fair amount of calls/SMS
  • The GSM shield only works with “2G” GSM mobile networks operating on the 850, 900 and PCS1800 MHz frequencies. If in doubt, ask your carrier first
  • Australians – you can use any carrier’s SIM card
  • Canadians – this doesn’t work with Sasktel
  • North Americans – check with your cellular carrier first if you can use third-party hardware (i.e. the shield)
  • I cannot offer design advice for your project nor technical support for this article.
  • If you are working on a college/university project and need specific help – talk to your tutors or academic staff. They get paid to help you.
  • Please don’t make an auto-dialler…


Getting started

As mentioned previously, we’re using the Sparkfun GSM shield with the SM5100B module. When you order the shield, don’t forget to order the stacking header pin set as they’re not included with the shield, and you’ll need to solder them on yourself. Power -the GSM shield can often require up to 2A of current in short bursts – especially when turned on, reset, or initiating a call.

However your Arduino board can only supply just under 1A. It is highly recommended that you use an external regulated 5V power supply capable of delivering 2A of current – from an AC adaptor, large battery with power regulator, etc. Otherwise there is a very strong probability of damaging your shield and Arduino.

Ignore this at your own risk

When connecting this supply DO NOT use the DC socket on the Arduino. Instead, connect the 5V (positive) from the supply to the 5V pin on the GSM shield, and the negative to the GND pin.

If you’re looking for a more permanent or easy-to-wire solution, get yourself a DFRobot power shield:


This shield sits on top of your GSM shield (which sits on top of your Arduino). Before use you need to set it up:

  1. The only jumpers that should be on the power shield are as shown in the image above;
  2. Connect a power supply of between 9 and 35V DC to the blue terminal block at the bottom-left of the shield;
  3. Connect a voltmeter/multimeter to the other blue terminal block at the top-left and adjust the potentiometer (blue thing between the terminal blocks) until the voltage measured is 5 volts; ignore the LEDs on the shield as they’re not that accurate;
  4. Run a wire from the positive power output to the 5V pin on the shield, and run another one from the negative power output to a GND pin on the shield;
  5. If you have the USB cable connected to your project while operating the GSM shield, remove the USB cable before turning off external power to the project.

Here’s what it looks like once assembled with the antenna:


Next – use an antenna! The wire hanging from the shield is not an antenna. YOU NEED THE ANTENNA! There are two choices. Either use the smaller one for areas where handheld mobile reception is acceptable, such as this one:

Or if you are in an area of weaker reception, use an external antenna such as that used on a motor vehicle. If you are using the larger vehicle-style aerial, you might find that the plug will not fit to the shield’s connector. For example, consider the following:


On the left is the end of the lead from the carphone aerial, the right is the lead from the GSM shield. Problem! The solution is in the centre: an FME male to SMA male adaptor. This one came from element-14, part number 1826209 (it is a Multicomp R23-014-00-002611000).

Furthermore, care needs to be taken with your GSM shield with regards to the aerial lead-module connection, it is very fragile:


And finally, download this document (.pdf). It contains all the AT and ERROR codes that will turn up when you least expect it. Please review it if you are presented with a code you are unsure about.

Wow – all those rules and warnings?

The sections above may sound a little authoritarian, however I want your project to be a success. With the previous iterations of the tutorial people just didn’t follow the instructions – so I hope you do :)

Are you using an Arduino Mega or Leonardo board?

Things are a little different for you. Those boards don’t support SoftwareSerial on digital pins 2 and 3 thus rendering the GSM shield a little trickier to use. Instead, bend back the D2 and D3 pins on the GSM shield as such (click image to enlarge):

Then run jumpers from D2 on the attached shield to D10 and another from D3 to D11. If you’re using the aforementioned power shield it would be on top of the GSM shield however the jumper wires would be the same. Finally in all the sketches, change the line SoftwareSerial cell(2,3);  to SoftwareSerial cell(10,11); . If you have a Leonardo, get a Uno.

Initial check – does it work?

This may sound like a silly question, but considering the cost of the shield and the variables involved, it is a good idea to check if your setup is functioning correctly before moving on. From a hardware perspective for this article, you will need your Arduino board, the GSM shield with activated SIM card and an aerial, and a range of previously used components.

Make sure your SIM card is set to not require a PIN when the phone is turned on. You can check and turn this requirement off with your cellphone. For our initial test, upload the following sketch:

Then connect the GSM shield, aerial, insert the SIM card and apply power. Open the serial monitor box in the Arduino IDE and you should be presented with the following:


It will take around fifteen to thirty seconds for the text above to appear in full. What you are being presented with is a log of the GSM module’s actions. But what do they all mean?

  • +SIND: 1 means the SIM card has been inserted;
  • the +SIND: 10 line shows the status of the in-module phone book. Nothing to worry about there for us at the moment;
  • +SIND: 11 means the module has registered with the cellular network
  • +SIND: 3 means the module is partially ready to communicate
  • and +SIND: 4 means the module is registered on the network, and ready to communicate

From this point on, we will need to use a different terminal program, as the Arduino IDE’s serial monitor box isn’t made for full two-way communications. You will need a terminal program that can offer full two-way com port/serial communication. For those running MS Windows, an excellent option is available here.

It’s free, however consider donating for the use of it. For other operating systems, people say this works well. So now let’s try it out with the terminal software. Close your Arduino IDE serial monitor box if still open, then run your terminal, set it to look at the same serial port as the Arduino IDE was. Ensure the settings are 9600, 8, N, 1. Then reset your Arduino and the following should appear:


The next step is to tell the GSM module which network frequency(ies) to use. Please download this document (.pdf), and view page 127. There is a range of frequency choices that our module can use. If you don’t know which one to use, contact the telephone company that your SIM card came from. Australia – use option 4. Choose your option, then enter

(where X is the value matching your required frequency) into the terminal software and click SEND. Then press reset on the Arduino and watch the terminal display. You should hopefully be presented with the same text as above, ending with +SIND: 4. If your module returns +SIND: 4, we’re ready to move forward.

If your terminal returned a +SIND: 8 instead of 4, double-check your hardware, power supply, antenna, and the frequency band chosen. If all that checks out call your network provider to see if they’re rejecting the GSM module on their network.

Our next test is to call our shield. So, pick up a phone and call it. Your shield will return data to the terminal window, for example:


As you can see, the module returns what is happening. I let the originating phone “ring” twice, and the module received the caller ID data (sorry, blacked it out). Some telephone subscribers’ accounts don’t send caller ID data, so if you don’t see your number, no problem. “NO CARRIER” occurred when I ended the call. +SIND: 6,1 means the call ended and the SIM is ready.

Have your Arduino “call you”

The document (.pdf) we downloaded earlier contains a list of AT commands – consider this a guide to the language with which we instruct the GSM module to do things. Let’s try out some more commands before completing our initial test. The first one is:

which dials a telephone number xxxxxx. For example, to call (212)-8675309 use

The next one is

which “hangs up” or ends the call. So, let’s reach out and touch someone. In the terminal software, enter your ATDxxxxxxxx command, then hit send. Let your phone ring. Then enter ATH to end the call. If you are experimenting and want to hang up in a hurry, you can also hit reset on the Arduino and it will end the call as well as resetting the system.

So by now you should realise the GSM module is controlled by these AT commands. To use an AT command in a sketch, we use the function

for example, to dial a phone number, we would use

To demonstrate this in a sketch, consider the following simple sketch which dials a telephone number, waits, then hangs up. Replace xxxxxxxx with the number you wish to call.

The sketch in example 26.2 assumes that all is well with regards to the GSM module, that is the SIM card is ok, there is reception, etc. The delay function in void setup() is used to allow time for the module to wake up and get connected to the network. Later on we will read the messages from the GSM module to allow our sketches to deal with errors and so on.

However, you can see how we can simply dial a telephone. You could now have a home alarm system that can call you upon an event happening, etc.

Send an SMS from your Arduino

Another popular function is the SMS or short message service, or text messaging. Before moving forward, download and install Meir Michanie’s SerialGSM Arduino library from here. Sending a text message is incredibly simple – consider the following sketch:

It’s super-simple – just change the phone number to send the text message, and of course the message you want to send. The phone numbers must be in international format, e.g. Australia 0418 123456 is +61418123456 or USA (609) 8675309 is +16098675309.

Reach out and control something

Now let’s discuss how to make something happen by a simple telephone call. And the best thing is that we don’t need the the GSM module to answer the telephone call (thereby saving money) – just let the module ring a few times. How is this possible? Very easily. Recall Example 26.1 above – we monitored the activity of the GSM module by using our terminal software.

In this case what we need to do is have our Arduino examine the text coming in from the serial output of the GSM module, and look for a particular string of characters.

When we telephone the GSM module from another number, the module returns the text as shown in the image below:

We want to look for the text “RING”, as (obviously) this means that the GSM shield has recognised the ring signal from the exchange. Therefore need our Arduino to count the number of rings for the particular telephone call being made to the module. (Memories – Many years ago we would use public telephones to send messages to each other.

For example, after arriving at a foreign destination we would call home and let the phone ring five times then hang up – which meant we had arrived safely). Finally, once the GSM shield has received a set number of rings, we want the Arduino to do something.

From a software perspective, we need to examine each character as it is returned from the GSM shield. Once an “R” is received, we examine the next character. If it is an “I”, we examine the next character. If it is an “N”, we examine the next character. If it is a “G”, we know an inbound call is being attempted, and one ring has occurred.

We can set the number of rings to wait until out desired function is called. In the following example, when the shield is called, it will call the function doSomething() after three rings.

The function doSomething() controls two LEDs, one red, one green. Every time the GSM module is called for 3 rings, the Arduino alternately turns on or off the LEDs. Using this sketch as an example, you now have the ability to turn basically anything on or off, or call your own particular function.

And now for a quick video demonstration. The first call is made, and the LEDs go from red (off) to green (on). A second call is made, and the LEDs go from green (on) to red (off). Although this may seem like an over-simplified example, with your existing Arduino knowledge you now have the ability to run any function by calling your GSM shield:

Control Digital I/O via SMS

Now although turning one thing on or off is convenient, how can we send more control information to our GSM module? For example, control four or more digital outputs at once? These sorts of commands can be achieved by the reception and analysis of text messages.

Doing so is similar to the method we used in example 27.1. Once again, we will analyse the characters being sent from the GSM module via its serial out. However, there are two AT commands we need to send to the GSM module before we can receive SMSs, and one afterwards. The first one you already know:

Which sets the SMS mode to text. The second command is:

This command tells the GSM module to immediately send any new SMS data to the serial out. An example of this is shown in the terminal capture below:

Two text messages have been received since the module was turned on. You can see how the data is laid out. The blacked out number is the sender of the SMS. The number +61418706700 is the number for my carrier’s SMSC (short message service centre). Then we have the date and time. The next line is the contents of the text message – what we need to examine in our sketch.

The second text message in the example above is how we will structure our control SMS. Our sketch will wait for a # to come from the serial line, then consider the values after a, b, c and d – 0 for off, 1 for on. Finally, we need to send one more command to the GSM module after we have interpreted our SMS:

This deletes all the text messages from the SIM card. As there is a finite amount of storage space on the SIM, it is prudent to delete the incoming message after we have followed the instructions within. But now for our example. We will control four digital outputs, D9~12. For the sake of the exercise we are controlling an LED on each digital output, however you could do anything you like.

Although the sketch may seem long and complex, it is not – just follow it through and you will see what is happening:

And now for a video demonstration:


So there you have it – controlling your Arduino digital outputs via a normal telephone or SMS. Now it is up to you and your imagination to find something to control, sensor data to return, or get up to other shenanigans. If you enjoyed this article, you may find this of interest – controlling AC power outlets via SMS.

And if you enjoyed the tutorial, or want to introduce someone else to the interesting world of Arduino – check out my book (now in a third printing!) “Arduino Workshop” from No Starch Press.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

The following two tabs change content below.

John Boxall

Founder, owner and managing editor of tronixstuff.com.

87 Responses to “Tutorial – Arduino Uno and SM5100B GSM Cellular”

  1. Bruce says:

    Thanks for ths tutoral, John, I found t very helpful. I have a few questons I’m hopng you (or someone) mght be able to answer: 1. When I frst ran example 26.1 I got all the rght SIND messages, but after a few weeks of runnng varatons of the code the module now only returns 11 (and occasonally 7), even on the orgnal code. Do you know why the other messages are no longer appearng? 2. The AT Command manual notes that the SIND messages are stored n flash memory. Does ths mean that they are accessble by means other than cell.read()? 3. When I sent AT+ADCM t return the value 3979. Is ths 3.979 V and does t correspond to the range 3.3 to 4.2 referred to n the SM5100B manual (Table 1)? Thanks for your help.

    • John Boxall says:

      H Bruce
      1) If you’re gettng 11 there’s somethng on the network sde that’s stoppng full regstraton (e.g. account ssues). 7 means you can’t regster on your SIM’s network, but the module s fndng another network. Check your account, SIM, antenna, recepton etc. Or the module s playng up – t happens. (2) You can read SIND status by sendng “AT+SIND?” so yeah, ether cell.read or your own code to montor what’s comng back from the module va seral. (3) AT+ADCM s readng the ADC on the module – page 32 of AT command gude says t vares between 0~5000.

  2. Phil says:

    Man..when tred example 26.3 got SeralGSM does not a name type error..please help

  3. Carlos says:

    Hello, John.

    Frst I want to thank for ths Tutoral whch s very explaned, but, I just I have any doubt, f the GSM cell can perform a conventonal callng vos to vos snce my personal cell phone to the GSM Cell and If I can conect a speaker to ths sheld.?

  4. David says:

    H John,
    Man I’m lovng your tutorals, they are everythng that I need n one place…thankyou!!!
    Wth example 26.3 I’m assumng that t s a typo on lne two where there s nothng appended to your #nclude statement.
    I added the header fle SoftwareSeral and everythng seemed to work fne. Is that what s supposed to be there?

  5. Bogdan Nilă says:

    why do get ths message and t does not connectng to network?? what s +stn :9 ??

  6. threelegs says:

    If you have a mega do you stll need the extra 5v power supply or wll t be able to provde enough to power the sheld ?

  7. Emilio says:

    con respecto al conector que menconas para el cable de la antena, ¿ Así lo tengo que pedr pedr..?
    en el lugar donde lo quero comprar (un macho FME a SMA adaptador macho), o tendrá algún otro nombre.
    y que otro cable le puedo conectar en ves del que mensonas arrba (cable de la antena del teléfono del coche), por que en el lugar donde la requero poner, no tene mucha señal.

    Lo mas cercano que encontré de un conector para la antena fue una que se llama conector macho tpo “F” PermaSeal-II, no se s sea smlar.

    gracas. Me sacaras de un apuro que tengo.

  8. Diego Ch says:

    Why loadng the confguraton code to arduno and run the termnal returns me these values:

    +SIND:10, “SM”,1,”FD”,1,…..(all wth 1)

  9. Diego Ch says:

    Okay, I’ll try that. One more queston, t s normal that I return termnal + SIND: 0 or who s ths?

  10. Sun Hwi Bang says:

    Hello john

    I got my SM5100B today and I have a trouble wth connectng a smcard and module. I have a smcard that works for my phone and f I hook t up to module and check the seral montor, then I get followng message:

    Startng SM5100B Communcaton…
    +SIND: 8

    +SIND: 8 means that “the network s lost”. Do you know a way to fx ths? Perhaps t s because ths smcard requres the pn code and I have no dea how I can nput the pn code.

    Thank you and my team wll not forget your generous help

    Sun Hw Bang

    • John Boxall says:

      You can remove the requrement for a PIN by puttng the SIM n a normal handset and turnng t off through the securty (e.g.) menu.
      Make sure you have selected the approprate band as well.

  11. Sun Hwi Bang says:

    Hello John. Thank you so much for your help, but I am havng another trouble:

    Startng SM5100B Communcaton…
    +SIND: 1

    +SIND: 10,”SM”,1,”FD”,1,”LD”,1,”MC”,1,”RC”,1,”ME”,1

    +SIND: 3

    +SIND: 8

    +SIND: 4

    I am usng AT&T sm card and t seems that t does not fnd the network. Could you tell me how I can fx ths problem?

    • John Boxall says:

      If your last SIND s 4 then t should be workng.

      • Sun Hwi Bang says:

        Hello John

        I fxed my antenna and now I am gettng
        Startng SM5100B Communcaton…
        +SIND: 1

        +SIND: 10,”SM”,1,”FD”,1,”LD”,1,”MC”,1,”RC”,1,”ME”,1

        +SIND: 3

        +SIND: 4

        +SIND: 8

        and f I run SMSsend code then I am gettng CME = 313 error. am so desperate wth ths module, but sorry for botherng you agan

      • John Boxall says:

        CME = 313 means “SIM falure”. However your SIND results are stll the same. Dd you call AT&T about the IMEI or account?

      • Sun Hwi Bang says:

        Hello John Thank you so much for your help. It fnally works and I am super happy. I would not make ths happen wthout your help. I thnk the problem was power supply. Also, quck queston about sendng SMS. Could you tell me a correct syntax to send SMS to multple recpent?

      • John Boxall says:

        Good news. I can’t help you wth multple SMS.

      • Sun Hwi Bang says:

        Thank you so much for ths postng. I was so happy that I fnally made ths module workng.

  12. Steve says:

    H John, thanks so much for the nfo on ths page. Very useful ndeed. I’m followng your drectons and I’m up to the pont where I need to do the two-way communcatng between the termnal software and the cellular sheld. As I have a Mac however I’ve not been able to follow the nstructon on the OS X download you provded the web lnk for above, “http://syncterm.bbsdev.net/”. Any chance you could offer some gudance for Mac users? Otherwse, perhaps there are other ways to troubleshoot the +SIND: 8 error? My connectons to the module look good.

    • John Boxall says:

      The Syncterm lnk s stll actve but I don’t have a Macntosh so not sure about that one. You can use any other termnal software that can communcate wth the seral/USB port.
      However a +SIND: 8 means network s lost. Check your hardware, the frequency band aganst your GSM carrer and f t stll returns 8 call your provder as they may need the IMEI of your GSM module or not allow 3rd party devces on your network.

      • sunhwi says:

        Hello John. I sncerely respect your patence and tme for answerng my nqures. I am n Costa Rca and I am tryng to use the GSM module va Costa Rcan moble network. I am usng the same sm card that I tested n US but dfferent GSM module (I have two SM5100B and I left “workng” GSM module n US and brought the new one here)

        However, ths s what I am gettng on my Arduno Seral:

        Startng SM5100B Communcaton…
             r›áŸ”1)’@«–0 ˜A8)ä ̨Å;)”a„!Pëž!”þ ƒÐÍD0 ………

        I kept gettng bunch of ramdon characters, whch opens to two possbltes.
        1) GSM module doesn’t not work n Costa Rcan network (However, the same SIM card works n smartphone here)
        2) GSM module s already broken somehow (I ddn’t put any external power, so I hardly beleve that I would have burnt the module)

        Thank you for consderng my questons agan. Have a great Saturday eveng.

        Sun Hw Bang

      • John Boxall says:

        1) The module may be faulty however wth the random characters t may be one of the few ones that were set to 115200 bps that Sparkfun let slp through a year or so ago – so try alterng the data rate n your sketch.
        1a) Your smartphone may support a frequency that’s used n Costa Rca whch the SM5100 does not.
        2) Use power as descrbed n the tutoral.

      • Andre Celere says:

        John, even f the network operates wth a frequency not supported by the SM, would t not recognze that a SIM has been nserted? I only get +SIND: 0 and I tred wth 2 dfferent SIMs, from 2 dff operators… :(((

      • John Boxall says:

        Yes, It wll recognse a SIM ns’t nserted.

  13. John says:

    I really apprecate your work.
    I’m from Romana and work for my lcense.I buy ths sheld.Example 26.1 works fne.
    But tryed example 26.3 and doesn’t work.Seral Montor box s blank.
    cell.Rcpt(“+xxxxxxxxx”); // replace xxxxxxxxx wth the recpent’s cellular number
    +40 represents code of my country.
    What can do? I saw n examples of arduno–>lbrares the code s dfferent as aganst ths. I tred dfferent varants but….stll not workng. I need help.

  14. Abishai says:

    H, very nce tutoral. I am usng sm 300 module along wth arduno and I want to control my arduno through GPRS by turnng arduno nto web server. Can you gve some suggestons to me for dong t.

  15. benson domingo says:

    Good Day author, just want to ask how to connect the gsm sheld to my arduno on breadboard.what pns do the sheld connected n atmega328? by the way, your tutoral s a bg help for me. ‘ve learned a lot snce start readng. Thank you for your consderaton for a newbe^^.

  16. gili says:

    Thanks for the tutorals. They are really helpful.I Followed your tutoral and can talk to the SM5100B and get response from hm but don’t get +SIND 11 or rarely get t. It s plugged to an external 5V power supply wth 3A ratng.
    It usaslly looks lke ths:
    +SIND: 1

    +SIND: 10,”SM”,1,”FD”,1,”LD”,1,”MC”,1,”RC”,1,”ME”,1

    +SIND: 7

    +SIND: 3

    +SIND: 4

    Then occasonaly I do get SIND 11

    +SIND: 1

    +SIND: 10,”SM”,1,”FD”,1,”LD”,1,”MC”,1,”RC”,1,”ME”,1

    +SIND: 7

    +SIND: 3

    +SIND: 4

    +SIND: 11

    And then the all process start all over. I guess t because of the loop. So my queston s f get only SIND 4 s t ok?
    and the second problem s that f run the sms sketch, the module doesn;t send an sms.
    Is t related to the SIND 11?
    What can do to make the SIND 11 consstent?
    Thanks n advence

    • John Boxall says:

      The last SIND should be 4, f t skps 11 that’s ok. It could be a recepton ssue – check your antenna connecton. Or t could be the network doesn’t allow 3rd party devces – call them to check.

      • gili says:

        Thank you for the reply. Actually the problem was that I connected the external power to the 5V pn nstead of the VIN pn. I’ve notced somethng werd. Your example of the SMS sendng s workng properly, but the SERIALGSM example of the SMS sendng sn’t. Can you tell why? Is t because of the delay or the fact that you made t a standalone functon? also what s the do->whle loop functon? Why do you say t’s rsky to take t out?

        Thanks agan for your tme and answers. It s most apprecated.

      • John Boxall says:

        The do-loop s there just to ensure the sketch only sends one SMS. It’s a demonstraton sketch, to show how t works whch people can modfy to do what they lke wth.

  17. gili says:

    H John,

    Sorry for the late reply, set t a sde for a whle. Frst of all thanks for the answer. t made sense after deleted the loop and got lots of sms’s…
    I have another queston though, I’m usng pn 2 for nterrupt n the UNO, so tred to set the software seral to other pns (lke 4,5) but t ddn’t work. Does the sheld hard wred to pns 2,3 ? I have to use jumpers from other pns to make t work?
    how do I use the hardware seral pns (tx-1,rx-0)? f I can’t use other pns for the software seral?

    • John Boxall says:

      Sheld s hard-wred to 2 and 3, you’ll need to use some jumpers or solder some replacement wrng.

  18. gili says:

    H john,

    I would lke your advce please. I worked wth the module and all was well. And then for some reason t started to sometmes work and sometmes don’t. So I went back to the termnal to look at the basc sketch, and after the “start communcaton…” nothng happens.
    It has external power supply of 5V 3A,So t s not power related, and connected to the arduno pn 2,3 for comms.
    What can I do to see f the module s defeceted or not?

    • John Boxall says:

      Hard to say wthout beng there – so I’d pull everythng apart and re-assemble t, checkng the connectons and the voltage from the power supply wth a multmeter.

  19. Alex says:

    H John, thanks for the nfo, Im gettng the followng problem when run “verfy”,

    ‘SeralGSM’ does not name a type

    sketch_sep19a:3: error: ‘SeralGSM’ does not name a type
    sketch_sep19a.no: In functon ‘vod setup()’:
    sketch_sep19a:8: error: ‘cell’ was not declared n ths scope
    sketch_sep19a.no: In functon ‘vod sendSMS()’:
    sketch_sep19a:13: error: ‘cell’ was not declared n ths scope

    Thanks n advance!

    • John Boxall says:

      Dd you nstall the SeralGSM lbrary?

      • Alex says:

        John, thanks for the response… I found another way… and ts workng!!! :) Thanks…
        Here s the code,

        // Include the GSM lbrary

        #defne PINNUMBER “”

        // ntalze the lbrary nstance
        GSM gsmAccess;
        GSM_SMS sms;

        vod setup()
        // ntalze seral communcatons and wat for port to open:
        whle (!Seral) {
        ; // wat for seral port to connect. Needed for Leonardo only

        Seral.prntln(“SMS Messages Sender”);

        // connecton state
        boolean notConnected = true;

        // Start GSM sheld
        // If your SIM has PIN, pass t as a parameter of begn() n quotes
        notConnected = false;
        Seral.prntln(“Not connected”);

        Seral.prntln(“GSM ntalzed”);

        vod loop()

        Seral.prnt(“Enter a moble number: “);
        char remoteNum[20]; // telephone number to send sms

        // sms text
        Seral.prnt(“Now, enter SMS content: “);
        char txtMsg[200];

        // send the message

        Read nput seral
        nt readSeral(char result[])
        nt = 0;
        whle (Seral.avalable() > 0)
        char nChar = Seral.read();
        f (nChar == ‘\n’)
        result[] = ”;
        return 0;
        result[] = nChar;

  20. Robert Benson says:

    My name s Robert and Im dong a senor project on the arduno cellular sheld and Im gettng ths error message. can you help?

    ” Startng SM5100B Communcaton…

    +SIND: 1

    +SIND: 10,”SM”,1,”FD”,1,”LD”,1,”MC”,1,”RC”,1,”ME”,1

    +SIND: 3

    +SIND: 8

    +SIND: 4

    +CME ERROR: 4 “

  21. Eric says:

    I thnk I’m havng some problems gettng the Arduno to communcate wth the module. The +SIND codes are comng n all rght (sequence: 1, 10, 3, 4, 8), but when I sent t AT+SBAND? t ddn’t return anythng, so I’m not sure f I’m even on the rght frequency. I have an H2O SIM card.

    • John Boxall says:

      You don’t want SIND 8 – that means the network s lost. If you get 4 then 8, the network most lkely doesn’t want your SIM and IMEI combnaton. I see that H20 resells AT&T, who have GSM 850MHz and 1900 MHz. However H20 mght not offer access to that network as part of ther reseller agreement wth AT&T. So call H20 and ask them 1) do they resell 2G GSM and 2) do they let any IMEI number on the network or just ther own suppled devces.

  22. Iosif says:

    Thank you for your tutoral. A basc queston. Whch Arduno boards are compatble wth ths GSM module?

    • John Boxall says:

      For smplcty, a Uno or compatble. However you can use others as long as you have the seral and power wrng correct.

  23. gili says:

    H John,

    I have replaced the snce t ddn’t communcate back. Meanng t ddn’t send back any responses over seral. Do you have any dea why t could be?
    Also, wth the new module get the snd:4 but when try to make a call t says “NO CARRIER”. Do you have any dea why? On the other handwhen call t, t rngs and can answer the call…
    My sm s pre-pad, s t possble the recharge of the sm ddn’t went through although the servce provder sad t was succesfully?

    • gili says:

      I forgot to ask how do send ctrl-z through the termnal? I can’t fgure t out. I know ctrl-z s 26 n DEC or 0x1A n hex but cant fgure out how to ncorporate t to the sms sequence va termnal? Could you please wrte down the sequence after the “at+cmgs=”xxxxx” command?
      Thanks a lot!!!

      • John Boxall says:

        Depends on your termnal emulator. Wth the one n the tutoral just ensure the “+CR” box s selected.

    • John Boxall says:

      Possbly, put the SIM n a phone and try to call someone etc.

  24. hameedullah says:

    I need such type of code but want to control relay va sms usng gsm and arduno pls wrte such type of code extremly need ths thanks

  25. Örjan says:

    Thanks for your tutorals. I have a problem. If I receve an SMS I do not get the text content but I get the followng: + CMTI: “SM”, 4
    I can’t then use the nformaton n my programmng to perform actons. Am I dong somethng wrong?

    • John Boxall says:

      Please see chapter 27 where we deal wth recevng SMSs. Are you usng AT+CMGF=1 and AT+CNMI=3,3,0,0?

  26. Ushan says:

    h need a make a wrst watch sze devce to send sms usng gsm module and aurdnos s there any avalbale devces to complete my project?

  27. Sergio Monsalve says:

    H, very nce tutoral. I am usng SM5100B module n GPRS mode and I want to control my system through GPRS by turnng arduno nto web server. Can you gve some suggestons to me for dong t.

  28. Sergio Monsalve says:

    Thanks for your soon answer.

  29. Ed says:

    H. I have used your tutoral and used the GSM module sucessfully.
    I now want to use the GSM module from another seral devce. Can you tell me how to access and use the external pns.
    Many thnaks, Ed

    • John Boxall says:

      It’s just seral data on pns 2 and 3 of the sheld. So communcate wth your devce at 9600 bps, 8N1 wth the AT commands as used n the examples here.

  30. Minko says:

    H, John!

    I followed your tutoral and t was workng great. Nevertheless, today I run example 26.1 agan and there was somethng wrong. After SIND 1,10,11 and 3 (when SIND: 4 s supposed to come n) t just prnts random symbols. I suppose t s some change n the baud rate but I don`t really know. Could you gve me some advce?

    • John Boxall says:

      It won’t change the baud rate durng operaton, just check all your wrng, the antenna and external power supply, etc. Otherwse you mght have a faulty sheld.

  31. sam says:

    h John,

    based on the great tutoral above, I had successfully mplemented the GSM shed and DF Robot power sheld a few months ago.

    yesterday whlst connectng my Arduno controller (complete wth shelds) nto my project, I nadvertantly swtched on/off the external power supply whlst the laptop USB was stll connected to the Arduno. (yes, you warn aganst ths n the tutoral)

    now the Arduno wll not excecute the sketch. pn13 LED remans on all the tme. Other test sketches won’t work ether, I tred (Blnk) and a pn HIGH sketch where I measured only a trckle voltage at the HIGH pn. The IDE appears to upload to Arduno ok as the Tx & Rx led’s do ther flashng.

    I suspect I have damaged the board, s there any way to repar?

    Dngley VIC, AUST

    • John Boxall says:

      You could try a new mcrocontroller wth Arduno bootloader f you have one spare, otherwse t’s new board tme :\

  32. gili says:

    H John,

    Frst my apprecaton for the gudes (even though sad t before) I keep comng back to t as a reference.
    I Want to move on beyond SMS’s and do the GPRS part of the module. Do you f there’s any lbrary/gude/ a really good and clear explanaton about how to do t? what are the steps needed n order to get t work?
    I couldn’t fnd any reference, and the ones dd fnd are offlne…
    Thank you very much.

  33. gili says:

    H John,

    I have seen those. And stll no Luck…I thnk I wll try wth the termnal frst…
    I would apprecate t very much f you could do a tutoral about GPRS also.


    • John Boxall says:

      Maybe, but don’t wat for me to do t.

    • Ben says:


      Ive made a quck nstructable showng how I got http get va gprs


      I would lke to buld on t, also Also would lke to make a lbrary for the GSM module but t mght take me a whle.

      Lke you gll I have had allot of trouble fndng any good nfo

      • gili says:

        H ben,

        Thanks for the nfo. I dd tred t out and there s nconsstency wth the work of the module. Some tmes t connects sometmes not, but mostly t gets werd behavor. Such s ths:
        +SOCKSTATUS: 1,1,0102,0,0,0
        Socket connected
        Sendng HTTP packet…
        Wat, that’s not what we were expectng. We wanted “OK”
        the msg s:+STCPD:1
        Loopng forever dsplayng cell module output…


        Whle through the termnal don’t get t. I don’t even get the +STCPD:1 response from the server. Even though the socket status returns an ACK bytes. And f ‘m trng to read the data that’s the answer:

        +SOCKSTATUS: 1,1,0102,9,9,0




        I dd altered your code as fgure out a better way to get the module to connect. (f t doesn’t connect after 4 tres close the connecton and re-open and t mmedately connects. If you have any suggestons about t, I would love to hear from you.


  34. Ben says:

    Gll – seems lke your not gettng an OK after you fnsh wrtng the http and send the completon character (GSMSeral.wrte(26);)
    I usually see an OK comng back after ths, but your not, t seems the next message your gettng s the “+STCPD:1” – dont know f maybe your usng software seral and ts mssng the OK or what the reason for that mght be but I dont suppose ts a bg deal, why not just remove the watFor(“OK”); that appears mmedately after (GSMSeral.wrte(26);), then t wll stop watng for ok and the next step was just to wat untl a “+STCPD:1” anyway.

    GSMSeral.prnt(“User-Agent: “+useragent+”\r\n\r\n”); // SIZE: 16
    GSMSeral.wrte(26); // ctrl+z character: send the packet
    //watFor(“OK”); – //Try removng ths wat for ok!
    watTl(“+STCPD:1”); // ths means data s receved

    • Ben says:

      Oops, ts Gl not Gll, sorry.

      Message me va the Insructables post f you want to have a chat about t as I have had some more success recently and have gotten a far bt of the lbrary gong for ths GSM module.

      Excuse me John, not tryng to hjack your page here, just hopng Gl and I can help each other nut out ths module properly:)


    • gili says:

      Thanks Ben,

      I wll.

  35. gili says:

    H Ben,

    I’ve sent you a message on nstructable. My problem s that I don’t get the STCPD:1 from the server. Could t be that a dns server may be confgure wrong? I also dont see the request on the server (john, I’m postng the queston here for other users sake…)

  36. rocker switch says:

    I have an excted synthetc attenton pertanng to detal and may foresee problems before they wll take


Subscribe via email

Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: