Sie sind auf Seite 1von 23

tronixstuff

fun and learning with electronics


Home
About
Arduino Tutorials
Electronics Education
Kit Reviews
Other Reviews
Projects

Tutorial: Arduino and GSM Cellular Part One


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. Please note from November 1, 2010 files from tutorials will be found here.
*** Update 19th October 2011 ***
This tutorial is no longer supported and for entertainment purposes only. If you have a problem with your shield, or need technical assistance, contact
Sparkfun or the retailer that sold you the board.
If you have a problem getting your module to work, please re-read the tutorial and ensure you have the correct power supply, and a working antenna matched to your
cellular networks frequency. Americans this shield doesnt work with Verizon; and it has been reported that AT&T GoPhone SIM cards may not work. If you
have an Arduino Mega use the Mega sketches. If you think your shield is faulty contact the company that sold it to you. Otherwise have fun and enjoy yourselves.
Welcome back fellow arduidans!
Today we are going to start using our Arduino to communicate over a GSM mobile telephone network using the SM5100B Cellular Shield:

This will be the first of several articles related to the SM5100B GSM shield. [Part two is here] The available documentation for this unit was abysmal, so please be
patient. My goal is to illustrate different ways of interacting using the shield, with which you can then use your existing knowledge to build upon those ways. For this
article I want to get a few things out of the way first, which may sound a little harsh, but are necessary.
Firstly telephone calls and text messages (SMS) can cost real money, so if your sketch goes bonkers and blasts out a few hundred text messages while youre in the
kitchen having tea, you will have to pay for them. It may be prudent to use a prepaid cellular account for testing purposes.
Secondly, the current draw. Sending an SMS (a tiny burst of data) will generally draw around less than 400 mA, which is within our normal Arduino specification. If
you are using your shield to make or receive actual telephone calls, the shield can draw up to two amps of current. The actual current draw will vary depending on the
strength of network reception in your location. For example, I live in direct line-of-sight of a network tower, use a carphone aerial and have full reception. When using
the shield to make a call the current draw is around 420 mA. If in doubt, use the ammeter function of a multimeter to monitor current draw.
However if I was 25km east of Sydney Harbour, the shield would use maximum transmit/receive power and pull the two amps. Therefore if communicating in this way
you cannot run your Arduino and this shield from the USB port or the DC socket. And dont be lazy by trying it anyway.
Instead, power your project with a high-capacity 5V 2 amp power supply to the 5V and GND pins on your shield.
Thirdly, you will need an aerial. These can range from the small rubber ducky types, to full carphone models. If you are using the larger vehicle-style aerial, you
might find that the plug will not fit to the shields 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 Farnell/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, please do not try to recreate the following:

From a software perspective we will need the NewSoftSerial Arduino library, so please download and install that before moving on.
Are you using an Arduino Mega board?
Mega users things will be slightly different for you. Please make sure the TX and RX pins of your GSM shield DO NOT plug into your Mega. Furthermore, run a
jumper wire from GSM shield pin D2 to Mega pin 19, and a jumper from GSM shield pin D3 to Mega pin 18, as shown below:

Finally, the example sketches will be different. Mega will not use the NewSoftSerial library, instead we use the Serial1 port. Please use the following Mega-equivalent
sketches for this article: Example 26.1, 26.2, 26.3 and 26.4.
Now, on with the show
Why would you want to connect your Arduino to the mobile phone network anyway? To send and receive data across the mobile network, and to transmit or receive
instructions or commands. More specifically, within the scope of this article we will do so mainly using text or SMS messages.
When shipped as new, our shield does not include the 6-pin and 8-pin headers (though it should for the price cheapskates). So you will need to source your own and
solder them in by inserting them onto the pins of another shield and drop the shield on top, then solder the shield in nicely.
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 :
Example 26.1
/* SparkFun Cellular Shield - Pass-Through Sample Sketch
SparkFun Electronics Written by Ryan Owens CC by v3.0 3/8/10
Thanks to Ryan Owens and Sparkfun for sketch */

Thanks to Ryan Owens and Sparkfun for sketch */


#include <NewSoftSerial.h>

//Include the NewSoftSerial library to send serial commands to the cellular module.

#include <string.h>

//Used for string manipulations

char incoming_char=0;
NewSoftSerial cell(2,3);

//Will hold the incoming character from the Serial Port.


//Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.

void setup()
{
//Initialize serial ports for communication.
Serial.begin(9600);
cell.begin(9600);
Serial.println("Starting SM5100B Communication...");
}
void loop()
{
//If a character comes in from the cellular module...
if(cell.available() >0)
{
incoming_char=cell.read();

//Get the character from the cellular serial port.

Serial.print(incoming_char);

//Print the incoming character to the terminal.

}
//If a character is coming from the terminal to the Arduino...
if(Serial.available() >0)
{
incoming_char=Serial.read();

//Get the character coming from the terminal

cell.print(incoming_char);

//Send the character to the cellular module.

}
}

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 modules 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
If your terminal returned a +SIND 8 instead of 4, that is OK, well sort that out in a moment.
From this point on, we will need to use a different terminal program, as the Arduino IDEs serial monitor box isnt 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. Its free,
however consider donating for the use of it. For other operating systems, people say this works well.
So now lets 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 dont know which one to use, contact the telephone company that your SIM card came from. Australia use option 4. Choose
your option, then enter
AT+SBAND=x

(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, were ready to move forward.
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 dont send caller ID data, so if you dont 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.
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. Lets try out some more commands before completing our initial test. The first one is:
ATDxxxxxx

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

The next one is


ATH

which hangs up or ends the call. So, lets 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
cell.println()

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


cell.println("ATD2128675309");

cell.println("ATD2128675309");

To demonstrate this in a sketch, consider:


Example 26.2
A simple sketch to dial a telephone number, wait, then hang up. Replace xxxxxxxx with the number you wish to call.
/*

Example 26.2

GSM shield making and ending a telephone call

http://tronixstuff.com/tutorials > chapter 26 */ #include <NewSoftSerial.h>


NewSoftSerial cell(2,3);

//Include the NewSoftSerial library to send serial comm

//Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.

void setup()
{

//Initialize serial ports for communication.


cell.begin(9600);
delay(25000); // give the GSM module time to initialise, locate network etc.
// this delay time varies. Use example 26.1 sketch to measure the amount
// of time from board reset to SIND: 4, then add five seconds just in case

}
void loop()
{
cell.println("ATDxxxxxxxxx"); // dial the phone number xxxxxxxxx
// change xxxxxxx to your desired phone number (with area code)
delay(20000); // wait 20 seconds.
cell.println("ATH"); // end call
do // remove this loop at your peril
{

delay(1);

while (1>0);
}

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.
Another popular function is the SMS or short message service, or text messaging.
Sending text messages from our Arduino
The AT commands for sending text messages are a little more involved, but nothing to worry about. First, we need to tell the module our SMS will be ASCII text, this is
done with:
AT+CMGF=1

Then we need to give the mobile phone number to send the message to:
AT+CMGS="xxxxxxxxx"

At this stage, there needs to be a small delay, around half a second. Then the module will expect the contents of the message (maximum 160 characters) followed by the
ASCII equivalent of Ctrl-Z. After sending the message, the module needs around fifteen seconds to finalise the procedure, so if sending multiple messages, allow for
this with a delay() function.
Do not use cell.println() on the function that sends the message text. Doing so will lock up your SMS module.
Example 26.3
So lets send a text message. I have tried to simplify the process as much as possible, so the following sketch is my simple Send an SMS example:
/*

Example 26.3 GSM shield sending a SMS text message

http://tronixstuff.com/tutorials > chapter 26 */


#include <NewSoftSerial.h>
NewSoftSerial cell(2,3);

// We need to create a serial port on D2/D3 to talk to the GSM module

char mobilenumber[] = "xxxxxxxxx";

// Replace xxxxxxxx with the recipient's mobile number

void setup()
{

//Initialize serial ports for communication.


cell.begin(9600);
delay(35000); // give the GSM module time to initialise, locate network etc.
// this delay time varies. Use example 26.1 sketch to measure the amount
// of time from board reset to SIND: 4, then add five seconds just in case

}
void loop()

void loop()
{
cell.println("AT+CMGF=1"); // set SMS mode to text
cell.print("AT+CMGS=");

// now send message...

cell.print(34,BYTE); // ASCII equivalent of "


cell.print(mobilenumber);
cell.println(34,BYTE);

// ASCII equivalent of "

delay(500); // give the module some thinking time


cell.print("They call me the count... because I like to count! Ah ha ha ha");
cell.println(26,BYTE);

// our message to send

// ASCII equivalent of Ctrl-Z

delay(15000); // the SMS module needs time to return to OK status


do // You don't want to send out multiple SMSs.... or do you?
{
delay(1);
}
while (1>0);
}

Now we can consider sending data and a fixed text message. To do so, we need to split the procedure of sending a text message into three parts: the sending data, the
message and any data, and ending the procedure. This is done in the following example. The sketch generates a random number between 0 and 99. Then it counts from
0 to 99, and when the count reaches the random number, it sends the text message containing an initial note and the random number.
Example 26.4
/*

Example 26.4

Send a text message upon an event occurring

http://tronixstuff.com/tutorials > chapter 26 */


#include <NewSoftSerial.h>
NewSoftSerial cell(2,3);

// We need to create a serial port on D2/D3 to talk to the GSM module

char mobilenumber[]="xxxxxxxx";

// Replace xxxxxxxx with the recipient's mobile number

char textmessage[160]; // used to hold contents of message to send


int b=0;
void setup()
{

//Initialize serial ports for communication.


cell.begin(9600);
delay(35000); // give the GSM module time to initialise, locate network etc.
// this delay time varies. Use example 26.1 sketch to measure the amount
// of time from board reset to SIND: 4, then add five seconds just in case
pinMode(13, OUTPUT); // use the LED for status
randomSeed(analogRead(0));

}
void startSMS()
// function to send a text message
{
digitalWrite(13, HIGH);
cell.println("AT+CMGF=1"); // set SMS mode to text
cell.print("AT+CMGS=");
cell.print(34,BYTE); // ASCII equivalent of "
cell.print(mobilenumber);
cell.println(34,BYTE);

// ASCII equivalent of "

delay(500); // give the module some thinking time


}
void endSMS()
{
cell.println(26,BYTE);

// ASCII equivalent of Ctrl-Z

delay(15000); // the SMS module needs time to return to OK status


digitalWrite(13, LOW);
}
void loop()

void loop()
{
b=random(0, 99);
for (int a=0; a<100; a++)
{
if (a==b)
{
startSMS();
cell.print("The random number is: ");
cell.print(b);
endSMS();
}
}
do
{
delay(1);
} while (1>0);
}

The result is shown in this quick video:


No se ha podido establecer conexin con Internet
Google Chrome no puede mostrar la pgina web porque tu ordenador no est conectado a Internet.
Puedes intentar realizar un diagnstico del error siguiendo estos pasos:
Accede a Aplicaciones > Preferencias del Sistema > Red > Asistente para comprobar tu conexin.

Error 106 (net::ERR_INTERNET_DISCONNECTED): Se ha perdido la conexin a Internet.

So now you can see the basic procedure for sending mixed data in a text message. For the purpose of the video, and to save my sanity the GSM shields telephone
number is stored as a phone book entry, that is why the sender is shown as Arduino GSM.
Well that is all we have time for in this instalment. Thank you for your patience in awaiting this series of articles. Although getting it together was a little tricky, it was a
lot of fun. I hope you enjoyed reading it as much as I did writing it for you. Now you can move onto GSM and Arduino part two!

Otherwise, have fun, stay safe, be good to each other and make something!
Please share with
others:
Like this:

Twitter

Email

StumbleUpon

Facebook

Reddit

Digg

LinkedIn

Print

Like 3 bloggers like this post.

January 19, 2011 - Posted by John Boxall | arduino, cellphone hacking, cellular, GSM, microcontrollers | 1800, 850, 900, arduino, ATT, call, card, CEL-09607,
cellphone, cellular, control, education, electronics, GPRS, GSM, GSM1800, GSM850, GSM900, guide, guides, hacking, lesson, lessons, message, MHz,
microcontrollers, mobile, monitor, network, optus, PCS, project, projects, remote, shield, SIM, SM5100, SM5100B, SMB5100B, SMS, sparkfun, spreadtrum,
telephone, telstra, text, tutorial, tutorials, VHA, vodafone

124 Comments
1. this is excellent! Although the procedure looked tricky, its quite do-able with your tutorial.
Thanks John!

Thanks John!
Russ
Comment by Russ | January 19, 2011
Hello Russ
Thank you for your comment, I really appreciate it. What drove me to write the article (and the future two) is the complete lack of any usable tutorial
elsewhere. People would post bits of their code, but not a simple, working example. So here you are. Enjoy!
cheers
john
Comment by John Boxall | January 19, 2011
2. Hi John,
This is great, except that I am using an Arduino Mega. I am trying to complete the initial check, and I did every exactly as you described, except I have to
manually connect the shield pins to the Mega. I get the Starting SM5100B Communication line, but I never get the +SIND response. Ive also tried just about
every other way. Could it be that Im using a Mega? I am using an AT&T 3G sim card.
Comment by Peter Li | January 20, 2011
Yes, the Mega is slightly different. I have emailed you directly, and will update the tutorial now.
Thank you for bringing this to my attention
cheers
john
Comment by John Boxall | January 20, 2011
Interesting point about the Mega 1280.
Ive resoldered the jumpers for the Cellular shield so that it uses HW Serial pins 0 and 1 instead of SW pins 2 and 3. For some reason it wont work on the
Mega.
The exact same code works on an Arduino Uno!
But I cannot seem to communicate with the cellular board using Serial0 on the Mega
Ive also tried using Serial1 on the Mega as well, but this doesnt work either. Very strange that this happens on the Mega. I know these serial ports work
because I can communicate to a Uno over serial and I can communicate within the Mega from Serial 0 to Serial 1 for example.
I havent tried using the SW serial on the Mega for the cellular shield.
Is the Mega doing something odd with its serial communication that makes it necessary to use the SW serial?
Comment by staropram | May 26, 2011
Hello
If you have soldered the GSM shield up to force it to use pins d0 and d1 for serial, the Mega should definitely work using Serial.begin(9600) etc for
comms with the GSM shield. Only catch is that if you need to use the terminal window you cant as it requires the first serial i/o (as it is the only one
through the FTDI>USB trail). There is no need to use software serial on the Mega.
Comment by John Boxall | May 27, 2011
3. Thank you so much for sharing your knowledge, this is an awesome tutorial as always.
Im not playing with GSM right now but I keep in mind the possibilities.
The hardest thing for a beginner like me is to find good documentations but fortunately you are here to make things a lot easier. Thank you
Comment by virtualmix | January 22, 2011
4. Hi John,
Many thanks for posting this. Its exactly what Ive been looking for for the past few weeks.
Just one question though, did you have to change the baud rate yourself? My understanding is that the GSM shields originally shipped with the baud rate set to
115200, instead of 9600.
Ive been trying to use the Sparkfun FT232RL breakout board (BOB-00718) to reset mine, but as Im a relative newbie to electronics, I have been unsuccessful.
Any advice or comments you could offer would be greatly appreciated.
Best,
Roki
Comment by Roki | January 25, 2011
Hello
The units should be shipped as being set to 9600, at least for the last six or so months.
Do you have an Arduino Duemilanove/Uno/compatible board? If necessary, you could change the baud rate using USB via the Arduino and the terminal
software.
John
Comment by John Boxall | January 25, 2011
Hi,
Its a compatible board (based on the Duemilanove).
Yes, Ill give that a try. Do I have to remove the ATMega chip for that (perhaps its a dumb question, but Ive seen it listed before)?
Thanks,
Roki
Comment by Roki | January 25, 2011

Comment by Roki | January 25, 2011


No, the chip stays in
John
Comment by John Boxall | January 25, 2011
5. Hi John.. your tutorial is awesome. i m working on my final year project by using arduino uno with sm5100B. my problem is that i m not getting response from
module. I only get the Starting SM5100B Communication line, but I never get the +SIND response. i have connected modem 2 and 3 pin to Tx and Rx pin
of uno, but ouldnt find any response from modem. Plz reply as soon as possible
Comment by engrstudent | February 3, 2011
Do you have an aerial connected, an activated SIM card and an appropriate 2 amp power supply connected (see tutorial)?
Comment by John Boxall | February 3, 2011
6. Hi,
Very good tutorial indeed!
On my side, I have an Arduino Mega, which works perfectly for sending one SMS. If I send a new one, I get +CME ERROR: 4 , then OK, then another +CME
ERROR: 4.
I either have to reset or close and re-open the com monitor (!) to be able to send a sms again. Do you have any ideea why it does that ?
Comment by Catalin | February 3, 2011
Hi
Thanks for your feedback and question. +CME: ERROR 4 means operation not supported. If you are sending multiple SMSs in one sketch, put a delay
of at least 5 seconds between each send attempt. The module needs time between sending SMSs.
cheers
john
Comment by John Boxall | February 3, 2011
Hi,
Thanks for your quick reply!. As I remember when I tried (I cant try now because I think Ive burned the cell shield due to use with the antenna
shield wire broken) I did wait around 10 seconds after I retried. I have even added a status check, and I dont do an attempt until the status is back to
OK. Can there be anything else?
Comment by Catalin | February 5, 2011
If you think your GSM module is dead, try example 26.1 again. if that works you should be ok.
Some others have mentioned having the same problem, so I suggest sending AT+CFUN=1,1! after the SMS sending has finished. This AT
command will reset the module.
john
Comment by John Boxall | February 6, 2011
7. Im having the same problem as catalin. Once a get or send an SMS, any further attempts have a CME ERROR 4. Ive waited 30 seconds or more before doing
anything. It gets locked into the error mode and the only way I can clear it is to re-cycle power. Any suggestions?
Comment by timb | February 5, 2011
A few people have mentioned this to me, but I cant work out why it is happening.
My only suggestion at the moment is to send a AT+CFUN=1,1! to the module about ten seconds after the SMS has been sent. This will reset the GSM
module for you. Then allow time for it to restart before moving forward in the sketch.
cheers
john
Comment by John Boxall | February 6, 2011
8. Nice mention of this article on hackaday.com
Good stuff!
Comment by Jason | February 6, 2011
Thanks!
Comment by John Boxall | February 6, 2011
9. Dumb question but will any SIM card work? Im looking to grab an AT&T sim card for GO Phone from ebay for ~$10 or TMobile refill/prepaid SIM
Is there one kind that I should get or steer away from? TIA!
Comment by Douglas Mauro | February 7, 2011
Hello
As long as the account attached to your SIM card can send and receive SMS you should be fine whether it is prepaid or postpaid should not make any
difference.
Have fun
John
Comment by John Boxall | February 7, 2011
I would advise you Prepaid card, because if your code is wrong, you pay what you loaded the card with.
with postpaid, while(1) sendsms() can cost you big bucks.

with postpaid, while(1) sendsms() can cost you big bucks.


There is absolutely no code difference when using Prepaid or Postpaid for SMS and Voice.
Comment by Wolf | February 7, 2011
10. in the loop section you have this fragment:
for (int a=0; a<100; a++){
if (a==b){
}
}
is there a reason for this? it only runs the code once whie dont you just run the code?
Comment by Pedro Pinheiro | February 7, 2011
Hi Pedro
The purpose for doing it that way was to demonstrate how you can integrate the sending of an SMS within code for detecting a certain condition. (e.g.
when something equals something, send out an SMS).
cheers
john
Comment by John Boxall | February 7, 2011
11. Has anyone tried this with canadian provider SIM cards? I got it workign fine with Rogers, but I am in Saskatchewan and our provider Sasktel SIM cards will
not even get detected by thisget SIND: 0 everytime, yet Rogers SIM works fine. I tried 4 different Sasktel Sim cards and no go.
Anything else I can try changing to get it to read these cards?
Comment by Keenan | February 9, 2011
Sasktel does not seem to offer a 2.5G GSM cellular network, only 3.5G. The GSM module used in the Sparkfun shield therefore will not work with
Sasktel.
cheers
john
Comment by John Boxall | February 9, 2011
Thanks for the prompt response, sorry I should have caught that but I am just getting started. Is there another shield or cellular module that would
work with 3.5G and this code?
Comment by Keenan | February 10, 2011
To be honest I have not seen a 3G GSM shield on the market. With regards to your other question, it is not the SIM card 2G and 3/3.5G are
physically separate networks, Sasktel doesnt run a 2G network.
Looks like youd have to use Rogers in your area.
cheers
john
Comment by John Boxall | February 10, 2011
12. Thanks John I appreciate the help, I have wrapped my head around how the module works now and without your response I never would have known why
Comment by Keenan | February 11, 2011
13. Did you have to do anything special to interface the 5v Arduino soft serial pins to the 3.3v pins on the cell chip?
Comment by Patrick | February 11, 2011
Hi Patrick
No, the Sparkfun GSM shield takes care of the voltage regulation for you.
cheers
john
Comment by John Boxall | February 11, 2011
14. solution for +CME: ERROR 4!
there is a bug in the text message sample code.
cell.println(26,BYTE);
needs to change to
cell.print(26,BYTE);
the println screws up things by adding a carriage return, it seems.
see this thread:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1250396340/27
Comment by Dennis | February 18, 2011
Yes, this is a fix. But note that there are timing issues for those of you using a terminal. I could not get it to work by just sending byte 26 after a text field.
Then the unit waited around for a CR before sending the message. Then the message was sent but unit went into broken state, just returning +CME
ERROR: 4!.
Comment by Chris | May 16, 2011

Comment by Chris | May 16, 2011


15. Hello Jhon
Im trying to conect Arduino Uno with a GSM module and run your aplication example 26.1.
When I connect with module gsm only obtain Starting SM5100B comunication and a few list of ilegible character, always the same. Could you help me?
Thanks anticipated
Comment by Trudi | February 21, 2011
Hello Trudi
It looks like your GSM module is set to a different serial speed. The model I have used (the SM5100B) from Sparkfun should be set to 9600bps. However
this may not be the case with yours. Try changing the data rate in your terminal window starting from 115200 bps and see what happens. If the output is
still illegible, try the next slower speed and so on.
cheers
John
Comment by John Boxall | February 21, 2011
Hi John
Thanks for faster reply. I have a SM5100b for Sparkfun buy in Spain. I test every baudrate 115200 and slowers and its the same. In cose of 9600bps
I obtain Starting SM5100B Communication !J!
What can I do?
Comment by Trudi | February 22, 2011
Ok. Please be sure you have the external power connected as described (5V up to 2 amps), and the aerial connected. Then try example 26.1 again.
If this still doesnt work at any terminal speed then I can only suggest that you have a faulty module.
cheers
john
Comment by John Boxall | February 22, 2011
16. I dont work with adruinos but I do work with AVRs and XMegas. I was just wondering what the digitalwrite(13, High) and Lo are doing do the sm1500b
module.
Nice work btw, great tutorial.
Comment by Daryll Donais | March 24, 2011
Hello
Thanks for your positive feedback.
(Most) Arduino boards have an LED hard wired to digital output 13. I am just turning the LED on and off to indicate progress in the sketch for
troubleshooting. You can ignore it.
cheers
john
Comment by John Boxall | March 24, 2011
Ok thanks. I thought perhaps it was connected to the reset of the smb5100B or something.
Comment by Daryll Donais | March 24, 2011
17. How can I read the incoming number? (caller id)
So like your ring example I can use the incoming number for example:
if incoming_number == 555555123!
{do this or that
Comment by Theo | April 11, 2011
Good question working on it now, but am rather busy with the day job. Keep an eye out for GSM III.
cheers
john
Comment by John Boxall | April 11, 2011
18. I have some trouble in getting the shield to work with my Arduino Mega 2560, the issue is similar to the one the earlier commenter, Trudi is having. A prepaid
sim is inserted and an antenna connected to the shield. I have connected the D2 & D3 to Serial 1 on the Arduino. And I have connected a 5V (3A max) power
supply to the cellular shield and have made a connection between the GND of the shield and the Arduino. When the 26.1 sketch for Mega is is loaded just a string
continuous of blank characters show up on the serial output of the Arduino. I have tried changing the baudrate of the shield, changing serial ports and trying
connecting the Vin, 3V of shield to the Arduino and using the same power supply for both the Arduino and the shield but I cant get any recognisable text to
come up. Any ideas as to what else I should try?
Thanks John,
Tanaka
Comment by Tanaka | April 21, 2011
Hello
Please dont connect anything to the 3V pins, that is unnecessary. When you said that you changed the baud rate of the shield did you change the baud
rate in the serial monitor box, or the actual baud rate the shield operates on? The shield should be preconfigured to 9600 bps however a few slipped out of
Sparkfun with the rate set at 115200. Try this fix from Sparkfun Fix: Connect to pins 2/3 with any serial TTL connection (FT232 breakout, FTDI cable,
etc) Connect at 115200 baud, and you should see some commands output by the 5100 (+SIND: 4", etc..) type in this command to reset the baud rate to
9600: AT+IPR=9600" It should respond with OK. (This setting is saved in non-volatile memory.)
john

john
Comment by John Boxall | April 21, 2011
Hello John,
Thanks for quick response. I changed the baud rate on Serial1 to 115200 when it is initialised (the one to which the the shield is connected) but still
nothing happened, ie. I got a bunch of blank characters in the serial monitor after Starting SM5100B Communication. I will try the sparkfun fix,
but I dont see why it would change anything as the serial connections on the mega should be able to run at 115200.
Tanaka
Comment by Tanaka | April 21, 2011
Ok. If you can replicate example 26.1mega exactly both in hardware and software (trying both serial port speeds) and the blank characters still
appear, then you must have a faulty module.
john
Comment by John Boxall | April 22, 2011
19. I am using the code from Example 26.3 and it works. But it cant send the second message consequently. Then after a while it will send message again. This is
my code for sms:
while(c<=3){
Serial1.println("AT+CMGF=1");
Serial1.println("AT+CMGS=\"+6593958587\"");
Serial1.print("Hi?\n");
Serial1.println(26,BYTE);
delay(1000);
Serial.println("\nMsg sent");
delay(15000);
c++;
}
Is there any missing?
Comment by Hao | May 18, 2011
Hello
Yes, change
Serial1.println(26,BYTE);
to
Serial1.print(26,BYTE);
have fun
john
Comment by John Boxall | May 19, 2011
20. Hi John, I tried to interface my Arduino Duemilanove Board and ATMega328P with a SIMCOM SIM300EVB and SIM900BE. I uploaded the example 26.1
and it seems work fine, it get Call Ready, but if i try to send any AT command to the module, it doesnt answer. I tried 26.2 and nothing happens. Have you any
advice?
Thanks
Comment by NicolaG | May 19, 2011
Hello
I dont have access to one of those modules so cannot test it out. However general advice includes ensuring the power supply is correct with regards to
voltage and current, you have an appropriate antenna connected, and your cellular network supports the frequency of your module. Finally, some modules
use different AT commands than that of the SM5100b used in my tutorial, so you would need to find the equivalent in your data sheet and substitute them
in the sketch.
John
Comment by John Boxall | May 19, 2011
21. This is great tutorial John
I have a question, i use wavecom with wismo gsm module inside. This gsm modem have an internal rs232 serial link connection. Should I use additional rs232
circuit before I connect this modem to my arduino kit?
any help will be appreciate
thanks
Comment by mirws | June 6, 2011
No idea. Need a link to your module so I can read about it first.
Comment by John Boxall | June 6, 2011
John, as you wish, this is a documentation about my modem gsm
http://www.ozeki.hu/attachments/588/M1206B_Manual.pdf
Comment by wiro | June 6, 2011
Ah.
You will need an Arduino RS232 interface board. For example http://shieldlist.org/cutedigi/rs232
Please note I dont support this GSM module.
John
Comment by John Boxall | June 6, 2011

Comment by John Boxall | June 6, 2011


Thanks John, Ill trying
Comment by wiro | June 6, 2011
22. NewSoftSerial cell(2,3);
Can you use any other pins than pins 2 and 3 for the communication between the Arduino and the shield? When I tried changing those numbers, the application
wont work anymore. I will appreciate any comments or directions on this. Thank you
Comment by Eric | June 23, 2011
Hi Eric
The shield has TX/RX hard-wired to digital pins d2/d via the jumper switch. See the schematic
http://www.sparkfun.com/datasheets/DevTools/Arduino/cellular%20shield-v12.pdf
You can use other digital pins but you will need to physically rewire your shield.
cheers
john
Comment by John Boxall | June 23, 2011
Thank you John for your prompt answer. I have a GPS shield that I would like to connect to the Arduino board but that shield also requires the use
of pins 2 and 3. So the only way I can connect those two shields on the same board is to change the physical wiring of the shield?
Comment by Eric | June 24, 2011
Yes
Comment by John Boxall | June 24, 2011
23. Sorry to bother you again John but can you provide some guidance on how I could rewire those pins? It seems like they are internally connected and there is no
external wires that I could physically disconnect and reconnect to the pins that I want.
Comment by Eric | June 25, 2011
You will need to keep the shields physically separate and run wires between them for GND, 5V etc.
Comment by John Boxall | June 25, 2011
24. Hi John.
Ive said it before but Ill say it again Great Tutorial.
You have assisted me no end on my path from neverevenheardofduino to vagueconceptofwhatishouldbedoingduino and the progress continues.
Can I run this one past you
Id like to be able to extract specific data from an SMS such as the date-stamp or the senders number.
Now, while I can see these quite clearly as a human being reading from my terminal, to get the sketch to see the right parts Im scratching my head somewhat.
My thinking is at the moment that I should import the entire SMS into an array (can an array have numbers and letters ??) and then by knowing which slots in the
array holds the date stamp, extract these and Serial.println them.
Is my logic correct so far ?
My ultimate goal is to set the time and date of a real time clock using a sent-to-self SMS.
This would mean as long as the phone networks clock was correct, mine would be to (within a second or so)
Id love to hear your thoughts.
Thanks in advance.
Tom
Comment by Tom Mudd | June 30, 2011
Yes you could use an array of characters. Although that method would work, personally I would use a GPS module and take the time from that. The only
catch would be that you have to have the sketch allow for daylight-savings time if you have it in your area. But even a GPS module, DS1307 real-time
clock IC is cheaper than GSM module etc.
Comment by John Boxall | June 30, 2011
Hi John.
I appreciate what youre saying but since a GSM module is an inherent part of my project anyway, Im still planning to use GSM and not GPS.
Can I run my sketch past you please ?
Ive got it 98% working.
Using this sketch I can extract the time and the data and also the senders number. Where it all falls down though is the process of loading the actual
text content of the message into the array.
At this point, of the array loading procedure, the data put into the array slots appears to be nothing more that full stops (periods) or whatever theyre
called.
My theory at the moment is that the array loading is upset by a Carriage Return character.
How do you think I can avoid this ?

How do you think I can avoid this ?


Heres my sketch:
/*
Tom Mudds first attempt at an array-loading sketch. 08/07/2011
This sketch reads in the cell serial data from the Sparkfun GSM module into a 201 slot array.
By then recalling specific slots in the array, data can be extracted from the SMS such as the senders number
the time and the date.
This is then constructed into serial messages and sent to the PCs serial monitor program.
PLEASE NOTE for the 1st run of the array loading loop, the array fills with gibberish from the GSM boot up.
Once the array has finished filling, the arrival of an SMS will trigger the loop for a second time, this time filling up the array with valid data.
Heavily influenced and inspired by John Boxalls amazing GSM tutorials from http://tronixstuff.wordpress.com. Thanks John !
*/
#include //Include the NewSoftSerial library to add extra Arduino serial ports (to serial commands to the cellular module)
NewSoftSerial cell(2,3); //Create a fake serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
void setup()
{
cell.begin(9600);
Serial.begin(9600);
Serial.println(***WELCOME***);
Serial.println();
Serial.println (Booting up the GSM module);
delay(5000); // 15 seconds boot up time (with a 3,2,1 counter) before sending the setup AT commands to the GSM module
Serial.print(3.);
delay(5000);
Serial.print(2.);
delay(5000);
Serial.println(1.);
cell.println(AT+CMGF=1!); // set the GSM module to text message mode.
Serial.println(sending AT+CMGF=1!); // report the same to the PC for debugging
delay(200);
cell.println(AT+CNMI=3,3,0,0!); // set the GSM module to output SMS data to its serial port and not SIM card
Serial.println(sending AT+CNMI=3,3,0,0!); // report the same to the PC for debugging
delay(200);
cell.println(AT+CMGD=1,4!); // delete any old SMS messages
Serial.println(sending AT+CMGD=1,4!); // report the same to the PC for debugging
delay(2000);
}
void loop()
{
/* the first process below is intended to capture the serial data from the GSM module and load it into an array*/
char message[200]; //create a 201 slot array to hold the incoming text message characters
if(cell.available() >0 ) //wait for serial data to appear from the GSM module
{
int i;
Serial.println(Data coming in from the GSM module); //debug reporting to the PC user
Serial.println();
for (i = 0; i < 200; i++) { //for loop to run through all the slot values of the array
message[i] = cell.read(); //load whatever character is coming from the GSM module into the relevant slot of the array
Serial.print (i); //debug reporting for the PC user
Serial.print (" is "); //debug reporting for the PC user
Serial.println (message[i]); //debug reporting for the PC user
delay(50); //included just to make sure the for loop doesnt run too fast for the serial data to load fr
m the GSM module
}
/* This second process is now intended to select parts of the array data and Serial.print it out to the PC*/
//cell.println("AT+CMGD=1,4"); // delete all SMS
Serial.println("");
Serial.print ("The sending number was ");
Serial.print (message[7]);
Serial.print (message[8]);
Serial.print (message[9]);
Serial.print (message[10]);
Serial.print (message[11]);
Serial.print (message[12]);
Serial.print (message[13]);
Serial.print (message[14]);
Serial.print (message[15]);
Serial.print (message[16]);
Serial.print (message[17]);

Serial.print (message[17]);
Serial.print (message[18]);
Serial.print (message[19]);
Serial.println ("");
Serial.print ("The date was ");
Serial.print (message[45]);
Serial.print (message[46]);
Serial.print (message[44]);
Serial.print (message[42]);
Serial.print (message[43]);
Serial.print (message[41]);
Serial.print (message[40]);
Serial.print (message[39]);
Serial.println ("");
Serial.print ("The time was ");
Serial.print (message[48]);
Serial.print (message[49]);
Serial.print (message[50]);
Serial.print (message[51]);
Serial.print (message[52]);
Serial.print (message[53]);
Serial.print (message[54]);
Serial.print (message[55]);
Serial.println ("");
Serial.println("waiting at end of cell serial available loop");
//cell.println("AT+CMGD=1,4"); // delete all SMS
cell.flush();
delay (3000);
}
}
Comment by Tom Mudd | July 9, 2011
Hi
Two things spring to mind
0) message[i] = cell.read(); to message[i] = char(cell.read()); or
1) Change int i to char i
Im running from memory at the moment as I lent my GSM shield to someone else
cheers
john
Comment by John Boxall | July 10, 2011
25. Im trying to get this to work with an arduino mega.
Ive followed the tutorial a number of times, but when I go into the terminal to start communication, I get this back:
Starting SM5100B Communication
!!
+SIND: 1
+SIND: 10,SM,1,FD,1,LD,1,MC,1,RC,1,ME,1
+SIND: 8
+SIND: 3
+SIND: 4
The three digits of special characters change depending on which AT+SBAND command I use, but nothing changes besides that, and Ive not been able to find
google for any clues as to what, if anything, I can do.
Really stumped.
Comment by David Hendry | July 11, 2011
hi David
+SIND:4 means the module has registered with the network and is ready to go. Can you get it to make a test call? Such as in example 26.2-Mega
(https://sites.google.com/site/tronixstuff/home/arduino-tutorial-series-files/example26p2mega.pde)
Comment by John Boxall | July 11, 2011
I cannot.
it does not seem to want to do anything other than what Ive already described.
Comment by David Hendry | July 11, 2011
Thats really weird, it should be good to go at +SIND: 4. If you like, could you please email me the sketch your are trying, and a description of how
you have the hardware setup, etc? john at tronixstuff dot com.
cheers
john
Comment by John Boxall | July 12, 2011
Any luck figuring out what the problem was. I am using a tmobile account and am having the same problem.

Any luck figuring out what the problem was. I am using a tmobile account and am having the same problem.
Comment by oydshaan | August 16, 2011
26. You know to make a GPRS connection to a server using tcp gprs shield
Comment by lourival | July 18, 2011
Due to time constraints I cannot help with GPRS data projects.
Comment by John Boxall | July 18, 2011
27. Additional info If I use the SIM from my Iphone i get the following:
Starting SM5100B Communication
+SIND: 1
+SIND: 10,SM,1,FD,1,LD,1,MC,1,RC,1,ME,1
+SIND: 3
+SIND: 4
+SIND: 8
Comment by Builder | July 18, 2011
It seems to be making a successful connection, (SIND 3 then 4), but then losing it (SIND 8). Please check all connections to shield, including your antenna
and shield pins are soldered well; check your power supply is capable of delivering up to 2 amps of current; and finally the reception. Finally, AT&T may
have an issue with using GoPhone SIM cards in non-phone devices, it would pay to check with them.
Cheers
John
Comment by John Boxall | July 18, 2011
Does the system need the battery pack just to register and be on the system? Currently I do not have the battery connected becasue the Arduino and
5100B are already powered by the computer and I am not making or receiving any calls. Do I simply disconnnect the power pins on the 5100B
leading to the Arduino and connect to the battery to the 5100B? It would probably cause an issue if I feed a 5v battery to the same power source as
the USB?
Comment by Builder | July 19, 2011
Yes, you need the external supply at all times. I cannot stress this enough. The module communicates with the cellular network even when not in a
call or transceiving data.
Comment by John Boxall | July 19, 2011
28. Im a little confused how to hook up the battery at the same time the GSM Shield is plugged into the Arduino. Do i smply plug the + and of the battery into the
Vin and gnd of the GSM shield while it is connected to the Arduino.. Do I disconnect the shield from the arduino and only connect pins 2&3. The Arduino
already has 5v coming in from the computer. Im concerned about shorting something or sending 10V to the wrong part.
Comment by Builder | July 19, 2011
You need a regulated 5V power supply with the capacity to deliver up to 2 amps of current. + goes to the 5V pin, goes to GND. Its ok to leave the USB
connected.
Comment by John Boxall | July 19, 2011
Ive got a lithium backpack connected as you specified, tightened the antenna a bit I now get:
Starting SM5100B Communication
+SIND: 1
+SIND: 10,SM,1,FD,1,LD,1,MC,1,RC,1,ME,1
+SIND: 3
+SIND: 0
+SIND: 10,SM,0,FD,0,LD,0,MC,0,RC,0,ME,0
+SIND: 7
It looks like SIND: 7 indicates that its ready for an emergency call. This is with the GoPhone Sim
with the Iphone results are:
Starting SM5100B Communication
+SIND: 1
+SIND: 10,SM,1,FD,1,LD,1,MC,1,RC,1,ME,1
+SIND: 3
+SIND: 4
+SIND: 8

+SIND: 8
+SIND: 11
OK
Comment by Builder | July 20, 2011
Your experience with the iPhone SIM shows your hardware is OK. I have some anecdotal evidence that AT+T could be blocking non-handset GSM
from using GoPhone accounts. Call AT+T and check this for yourself.
Comment by John Boxall | July 21, 2011
29. Tried T-mobile SIM and system worked flawlessly. Dont buy AT&T GoPhone
Thanks for your help.
Comment by Builder | July 21, 2011
30. Hello Iam Agung from Bali Indonesia..
I want to ask, Is usb modem is used as a substitute shielt GPRS by using the usb converter ttl? and what coding is the same as in example 3.26?
sorry for my english to bad. I cant speak english well..but I hope you can help me to this problem
Comment by celulux | July 23, 2011
Hello
Good question. I found this on my to-do list:
http://finch.am/projects/arduinogsm/
which may be of interest, however have not tried it myself yet.
have fun
john
Comment by John Boxall | July 23, 2011
yes, Ive read the article. but if I can, I wish not to dismantle the modem. Is converter USB to TTL can be used? and use the coding as an example
26.3 ?
or Is coding example for 26.3 can be used on the application of that article?
Comment by celulux | July 23, 2011
You really need to follow their instructions I have not tried this yet, so will not comment. Please direct your questions to the publisher of the article.
Comment by John Boxall | July 24, 2011
31. Im fairly new to working with the Arduino and GSM modules, so i have kind of a dumb question. I wanted to know, if this module can be used to receive and
display text messages as well, say on an LCD display
Comment by Sagar | July 28, 2011
Yes, that can be done. People use the string functions to extract the SMS data in the serial line from the GSM module.
Comment by John Boxall | July 28, 2011
32. Im new to working with Arduino and Gsm modules so i would like to know how i would end the text message with . I know that the ASCII value of it is 26 but
do i finalise my message with 26 or do i add it?
Please let me know.
Thankyou
Comment by Feda Adel | August 13, 2011
Have a look at example 26.3 sketch in chapter 26 it is self-explanatory. Anyhow, we use
cell.println(26,BYTE); // ASCII equivalent of Ctrl-Z
Comment by John Boxall | August 13, 2011
Yes i understand that, I mean through the terminal program. After i send this command AT+CMGS=xxxxxxxxxx, i get this prompt > .. do i just
put the text there dont i need to finalise it with the equivalent of too? If so how do i do it? I have been trying yet it aint giving me any error responses
nothing.
Comment by Feda Adel | August 14, 2011
Yes, enter the text and finish it with Ctrl-Z
Comment by John Boxall | August 15, 2011
33. Ctrl-Z just undoes what i just wrote .. tried it not working. Do i end it with its ASCII equivalent like the sketch 26.3? OR > Its a beautiful day today i press ctrlz right after it without pressing enter and nothing happens. Just undoes the command i had to the previous doesnt really end the text i send . Am i missing
something?
Comment by Feda Adel | August 15, 2011
Which terminal software are you using?
Comment by John Boxall | August 15, 2011
34. The same on you used in this tutorial, i downloaded it and i managed to make calls but i cant get the texting working ..

34. The same on you used in this tutorial, i downloaded it and i managed to make calls but i cant get the texting working ..
Comment by Feda Adel | August 15, 2011
Can you run example 26.3 successfully?
Comment by John Boxall | August 16, 2011
35. For any one interested, I have used the cellular shield with an Arduino for DIY gate access control:
http://dinofizz.wordpress.com/projects/diy-gsm-enabled-gate-access-control-system/
Comment by dinofizz | August 19, 2011
Congratulations, very well done
Comment by John Boxall | August 19, 2011
36. Im thinking of creating something like this for my senior project! Is it totaly fine for you to use some of the codes you posted here? Also if there is any trouble
can i contact you?
Comment by Besmir | August 31, 2011
Have fun with your project. I am happy to answer general questions about basic operation but cannot delve into the depths of custom sketches with you.
cheers
john
Comment by John Boxall | September 1, 2011
37. I did manage to find some help at local Radio Shack this afternoon. They sold me an ac-to-dc power adapter for 3/5/6/6.5/7/7.5 VDC, 2A, and an adapter pigtail
that gives me bare wires I can plug into my Arduino. I checked its output with my multimeter, and its 5.24V (which I guess is close enough?). I plug the wires
into the GND and VIN pins on the shield. The red LED on the shield lights up nice and bright. I have a correctly provisioned SIM (AT&T). I have an antenna.
When I power everything up, I still only get Starting SM5100B Communication in the terminal. With my multimeter, Im not reading any amperage readings,
but Im not surprised because I dont think my chip is doing any work.
I guess my biggest question is still about the power supply. Am I dont the correct thing by plugging it into VIN and GND? Should I buy and adapter to it that
will allow me to plug it into the DC socket on my Arduino instead? Or perhaps Im completely off base and should be doing something entirely different.
Any other suggestions for how I can troubleshoot this? Im learning a lot (which is awesome, thanks again for the great tutorial!), but Im scratching my head.
Thanks!
Comment by Greg | September 7, 2011
As stated in article, please use the 5V and GND pins, not Vin. Do not plug into Arduino DC socket.
Comment by John Boxall | September 7, 2011
Thanks for the continuing responses to your great tutorial. I think I am doing everything as described, but am continuing to have no luck with the
example. Im using an Arduino Uno, the SparkFun shield, a Radio Shack power supply rated 2 amps, set to 5V, plugged into the 5V and GND pins
on the shield. I have a working SIM and an antenna. I have tried with 2 different GSM chips one that came with the cellular shield, and one
purchased separately. I have tried 2 different SIM chips an AT&T postpaid and a newly activated TracFone prepaid. I have soldered the long
Arduino headers to the shield and inserted the shield in the Arduino. There are no other connections between the shield and Arduino, or the shield
and anything else. I have the USB cable between the Arduino and the computer to monitor the Serial traffic. My serial monitor is set to 9600. I copypasted the code from the tutorial, cleaned up formatting that was lost in the copy-paste, and uploaded it to the Arduino.
When I start up everything, the LED on the cellular shield glows bright red, the LED on the Arduino glows bright green. In the serial monitor, I get
Starting SM5100B Communication, followed by a newline, followed by whitespace, followed by unprintable characters. (!!Ra!!!!).
I have tried adjusting the speed in the Serial Monitor. The behavior I described above is what happens at the following speeds:28800, 14400, 9600.
At the other speeds (115200, 57600, 38400, 19200, 4800, 2400, 1200, 300), the Serial Monitor displays a string of unprintable characters. When
doing these tests at different speeds, I did *not* change the code in the Arduino sketch to match the speed in the serial monitor for every
combination. (Should I?) I tried changing Serial.begin() to 14400 and got unprintable characters for every speed setting in the Serial Monitor.
I note that other comments indicate the suggestion of a faulty module after receiving results like I am finding. Are there any further software tests I
can perform that would be helpful for troubleshooting? Are there hardware tests I can perform on the cellular shield independent of the Arduino that I
can perform that would help verify that the module is either functioning correctly or is faulty?
Comment by Greg | September 11, 2011
Kudos for the trouble shooting, but yes sounds like a dead shield.
Comment by John Boxall | September 12, 2011
Interim update: If I go into the NewSoftSerial.cpp and change the interrupt timings for our 16MHz chip to the following I get about 27 characters per
chunk before it loses synchronization. Thats enough to send the AT command to the SM5100B to change its baud rate to something more
manageable. But just in case anyone else runs into this problem, here are the timing values (using NewSoftSerial library version 10):
#if F_CPU == 16000000
static const DELAY_TABLE PROGMEM table[] =
{
// baud rxcenter rxintra rxstop tx
{ 115200, 1, 16, 16, 12, },
( and so on)
Comment by Jens | September 18, 2011

Comment by Jens | September 18, 2011


Allright here is my conclusion: (1) the hardware is overwhelmed, but (2) it can be made well enough to at least change the SM5100B baud rate to
9600. Here are the parameters that worked the best for my NewSoftSerial library:
#if F_CPU == 16000000
static const DELAY_TABLE PROGMEM table[] =
{
// baud rxcenter rxintra rxstop tx
{ 115200, 1, 16, 15, 14, },
and so on. In particular the rxcenter, rxintra, and rxstop parameters have no wiggle room. Note that rxintra and rxstop have to be set different
Depending on the Arduino Uno readout baud rate (9600 versus 115200) there is a two-character artifact at different places of the long +SIND: reply.
That indicatees that the NewSoftSerial library works in principle but that the hardware (the Arduino) just cant process the 115200 SM5100B readout
baud rate.
The command to send to the GSM chip to reset its (default) baud rate is:
AT+IPR=9600
If it works as documented, the setting is persistent. Well see.
Hope this helps Thanks, Jens
Comment by Jens | September 18, 2011
38. How do i send ASCII @ to this module. I tryed with cell.print(64,BYTE); but get i in SMS i receive.
Comment by zerous | September 9, 2011
It may be your phone, can you try a different one? Some phones made for certain language markets dont interpret ASCII symbol characters properly.
Comment by John Boxall | September 10, 2011
ASCII @ is 64, but Shield use different character set GSM 03.38. according to it 64 is lowered . @ is 0 according to GSM 03.38. I must send
0 to the shield, my problem is that shield dont understand 0 when i send it to it.
http://www.csoft.co.uk/sms/character_sets/gsm.htm
Comment by zerous | September 13, 2011
Ah ok. It seems that this may be a limitation of the shield. This I cant help you with, perhaps contact the retailer for more support advice.
Apologies
john
Comment by John Boxall | September 13, 2011
Anyway, thank you so mauch for your tutorial
Comment by zerous | September 14, 2011
Youre welcome
john
Comment by John Boxall | September 14, 2011
Just to answer my own question. To send @, use ASCII 128!, it works. Here in Sweden you can send a SMS to a special number containing a
email adress and text and receiver gets it after few seconds in his email box.
Comment by zerous | September 17, 2011
Fantastic thanks for that information.
Comment by John Boxall | September 17, 2011
39. Hey! Im wondering if the arduino is powered up with a usb will it cause it to be unable to work?
Comment by Clement | September 12, 2011
Do not use USB for power. Please follow instructions in tutorial.
Comment by John Boxall | September 12, 2011
40. Thanks again for the encouragement and the tutorial. I purchased a second shield and am experiencing the same behavior. While possible, I find it unlikely that I
have two dead shields. I hope Im not doing anything that would destroy them. The only modification I made was to solder the Arduino headers to the board, and
I was very careful doing that. Are there any hardware tests I can can perform on the shields that would verify their integrity? Ill also ask this question to the
Google Group tonight since the troubleshooting for this seems to be out of the ordinary. Thanks!
Comment by Greg | September 15, 2011
You could use the continuity function of a multimeter to check for shorts between the pins on the shield, also check that youre getting 5V from the power
supply.
Comment by John Boxall | September 15, 2011
41. Greg thanks for letting me have the hardware over the weekend. Turns out that the SM5100B is trying to communicate with the Uno at 115200 baud. When I
tell NewSoftSerial to try this baudrate it approximately lines up but not quite. Roughly every 10th to 50th bit is not properly aligned, I can manually move the

tell NewSoftSerial to try this baudrate it approximately lines up but not quite. Roughly every 10th to 50th bit is not properly aligned, I can manually move the
bits around and see the five occurrances of the +SIND: sequence from the screenshot above. From the NewSoftSerial source code (.library_version() = 10) I
see that it registers interrupts and listens to individual pins. The tricky part will be to set the default baud rate to something more comfortable, using the
AT+IPR=9600! command for example, while its currently not communicating . Ill tinker around some and will post here what I came up with. It would be
great to have a software solution, of course. I already see hardware hooks in the compiler directives in the NewSoftSerial code, maybe we can update the library
for our hardware (ATMEGA328P-PU at 16MHz).
Comment by Jens | September 18, 2011
42. hello sir, i want to connect Arduino with wavecom modem. question, is the code same with code in example 26.3 ? If yes, am I need to use rs232-ttl converter?
thanks before ..sorry for my english too bad :)
Comment by agung arjaya | September 21, 2011
Sorry, no idea dont have that modem.
Comment by John Boxall | September 21, 2011
43. Hi John,
First of all thanks for your tutorial. Im using an Arduino Uno with the shield to send and receive SMS messages for a project, however when I run the first
sketch, I only get Starting SM5100B Communication.
Ive tried different baud rates, but still get nothing. I have a rubber ducky antenna that I got from Sparkfun and am pretty sure the Sim card works as it is the one I
use from my regular phone. I really want to get this to work an it has been three days. Is there something I might be missing?
Ive also tried this example included with the NewSoftSerial library (if thats worth anything):
#include
NewSoftSerial mySerial(2, 3);
void setup()
{
Serial.begin(57600);
Serial.println(Goodnight moon!);
// set the data rate for the NewSoftSerial port
mySerial.begin(4800);
mySerial.println(Hello, world?);
}
void loop() // run over and over again
{
if (mySerial.available()) {
Serial.print((char)mySerial.read());
}
if (Serial.available()) {
mySerial.print((char)Serial.read());
}
}
It only prints Goodnight moon!, but then again Im really not sure how it is supposed to behave. I really hope that in my naivety Im doing something wrong
and that my module isnt faulty. Any help will be greatly appreciated. Thanks,
Manu
Comment by Manu | October 2, 2011
If you upload example 26.1, connect the antenna, 5V 2A power supply and set the serial monitor box to 9600 (or 115200) and nothing comes up, you have
a faulty shield.
cheers
john
Comment by John Boxall | October 3, 2011

Sorry, the comment form is closed at this time.


Previous | Next

Monthly Competition
Enter now for a chance to win great prizes!

YouTube
Visit tronixstuff on YouTube for our range of videos

Arduino Tutorials
Click for Detailed Chapter Index

Chapters 0 1 2 3 4
Chapters 5 6 6a 7 8
Chapters 9 10 11 12 13
Chapter 14 - XBee
Chapter 15 - RFID
Chapter 16 - Ethernet
Chapter 17 - GPS part I
Chapter 18 - RGB matrix
Chapter 19 - GPS part II
Chapter 20 - I2C bus part I
Chapter 21 - I2C bus part II
Chapter 22 - AREF pin
Chapter 23 - Touch screen
Chapter 24 - Monochrome LCD
Chapter 25 - Analog buttons
Chapter 26 - GSM mobile - part I
Chapter 27 - GSM mobile - part II
Chapter 28 - Colour LCD
Chapter 29 - TFT LCD
Chapter 30 - Arduino + twitter
Chapter 31 - Inbuilt EEPROM
Chapter 32 - Infra-red control
Chapter 33 - Control AC via SMS
Chapter 34 - SPI bus part I
Chapter 35 - Video-out
Chapter 36 - SPI bus part II
Chapter 37 - Timing with millis()
Chapter 38 - Thermal Printer
Chapter 39 - NXP SAA1064
Chapter 40 - Push wheel switches
Chapter 40a - Multiple wheel switches
Chapter 41 - More digital I/O
Chapter 42 - Numeric keypads

Search
Search

RSS Feeds
Subscribe in a reader

Join my update list!


Enter your email address to receive notifications of new posts by email.
Join 378 other followers

Subscribe!

Categories
Select Category

Previous posts
January 2011
M T W T F S S
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Dec
Feb

Archives
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011

May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010

Contact information
Feel free to contact me anytime:
email - john at tronixstuff dot com

How you can help


Check out tronixdeals or any donations are always gratefully appreciated!

Google Group
Why not join our discussion group? Fun and learning with electronics!

Creative Commons
All the original material in this website, unless noted otherwise, is covered under a Creative Commons Attribution-Non Commercial-Share Alike v3.0 license.
Please email me if you see any mis-attributions or would like to use my content in different circumstances.

EEWeb Community
Read my interview on the EEWeb Electrical Engineering Community website.

on twitter
If for some reason you use Microsoft Visual Studio, you can program an Arduino with it... http://t.co/tgKxjwzO 7 hours ago
@AltronicsAU @PerthArtifact Arduino! Yes - what are you waiting for? 11 hours ago
@andrewjand True, but wouldn't work anymore. Why do so many Jaycar staff have beards? 12 hours ago
Pile of Arduinos hooked up in Rube Goldeberg-esque chain reaction (video) http://t.co/BvWTIyBY 13 hours ago
@Uncl_Vernon @alangarf Or the "choke a chicken" toy. 22 hours ago

Flickr Photos

More Photos

Find me on
element 14
facebook
flickr
friendfeed
Google+
posterous
tumblr
Twitter
vimeo
Whirlpool
Youtube

Interesting Sites

Interesting Sites
David L. Jones' eev blog
Freetronics Arduino Geniuses!
Little Bird Electronics Service Powered Electronics!
Silicon Chip magazine Always a great read!
Amazing Arduino Shield Directory
The Amp Hour podcast
EEWeb Elec Engineering Forum
Superhouse.tv High-tech home renovation
Mr Dick Smith OA

Nuclear weapons = global suicide


In a war with nuclear weapons, everybody loses. Please check these out:
Count Down to Zero
The War Game
Threads

Site info
tronixstuff
Theme: Andreas04 by Andreas Viklund. Blog at WordPress.com.

Das könnte Ihnen auch gefallen