Sie sind auf Seite 1von 39

tronixstufffunandlearningwith

electronics
Home
Tronixlabs
ArduinoTutorials
KitReviews
Projects
Reviews
About
ContactUs

Categorized|arduino,CEL00675,CEL09607,cellphonehacking,cellular,GSM,
lesson,SMS,tronixstuff,tutorial

TutorialArduinoUnoandSM5100BGSMCellular
Postedon19January2011.Tags:1800,850,900,arduino,ATT,call,card,CEL09607,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
ConnectyourArduinoUnoorcompatibletothecellularnetworkwiththeSM5100GSMmodule
shield.
ThisischaptertwentysixofaseriesoriginallytitledGettingStarted/MovingForwardwith
Arduino!byJohnBoxallAtutorialontheArduinouniverse.Thefirstchapterishere,thecomplete
seriesisdetailedhere.
IfyouarelookingfortutorialsusingtheSIMCOMSIM900GSMmodule,clickhere,andhereifyou
haveanArduinoMega.
Updated15/01/2014
Introduction
ThepurposeofthistutorialistohaveyourArduinotocommunicateoveraGSMmobiletelephone
networkusingtheSM5100BGSMCellularShield:

MygoalistoillustratevariousmethodsofinteractionbetweenanArduinoandtheGSMcellular
networkusingtheSM5100BGSMshieldfromSparkfun,withwhichyoucanthenuseyourexisting
knowledgetobuilduponthosemethods.Doingsoisnteasybutitisntthatdifficult.
Stop!Pleasereadfirst:
ItisassumedthatyouhaveasolidunderstandingofhowtoprogramyourArduino.Ifnot,start
fromchapterzero
SendingSMSmessagesandmakingphonecallscostrealmoney,soitwouldbeverywiseto
useaprepaidcellularaccountoronethatallowsafairamountofcalls/SMS
TheGSMshieldonlyworkswith2GGSMmobilenetworksoperatingonthe850,900and
PCS1800MHzfrequencies.Ifindoubt,askyourcarrierfirst
AustraliansyoucanuseanycarriersSIMcard
CanadiansthisdoesntworkwithSasktel
NorthAmericanscheckwithyourcellularcarrierfirstifyoucanusethirdpartyhardware(i.e.
theshield)
Icannotofferdesignadviceforyourprojectnortechnicalsupportforthisarticle.
Ifyouareworkingonacollege/universityprojectandneedspecifichelptalktoyourtutorsor
academicstaff.Theygetpaidtohelpyou.
Pleasedontmakeanautodialler

Gettingstarted
Asmentionedpreviously,wereusingtheSparkfunGSMshieldwiththeSM5100Bmodule.When
youordertheshield,dontforgettoorderthestackingheaderpinsetastheyrenotincludedwiththe
shield,andyoullneedtosolderthemonyourself.PowertheGSMshieldcanoftenrequireupto2A
ofcurrentinshortburstsespeciallywhenturnedon,reset,orinitiatingacall.
HoweveryourArduinoboardcanonlysupplyjustunder1A.Itishighlyrecommendedthatyouuse
anexternalregulated5Vpowersupplycapableofdelivering2AofcurrentfromanACadaptor,
largebatterywithpowerregulator,etc.Otherwisethereisaverystrongprobabilityofdamagingyour
shieldandArduino.
Ignorethisatyourownrisk
WhenconnectingthissupplyDONOTusetheDCsocketontheArduino.Instead,connectthe5V
(positive)fromthesupplytothe5VpinontheGSMshield,andthenegativetotheGNDpin.
Ifyourelookingforamorepermanentoreasytowiresolution,getyourselfaDFRobotpower
shield:

ThisshieldsitsontopofyourGSMshield(whichsitsontopofyourArduino).Beforeuseyouneed
tosetitup:
1. Theonlyjumpersthatshouldbeonthepowershieldareasshownintheimageabove
2. Connectapowersupplyofbetween9and35VDCtotheblueterminalblockatthebottomleft
oftheshield
3. Connectavoltmeter/multimetertotheotherblueterminalblockatthetopleftandadjustthe
potentiometer(bluethingbetweentheterminalblocks)untilthevoltagemeasuredis5volts
ignoretheLEDsontheshieldastheyrenotthataccurate
4. Runawirefromthepositivepoweroutputtothe5Vpinontheshield,andrunanotheronefrom
thenegativepoweroutputtoaGNDpinontheshield
5. IfyouhavetheUSBcableconnectedtoyourprojectwhileoperatingtheGSMshield,remove
theUSBcablebeforeturningoffexternalpowertotheproject.
Hereswhatitlookslikeonceassembledwiththeantenna:

Nextuseanantenna!Thewirehangingfromtheshieldisnotanantenna.YOUNEEDTHE
ANTENNA!Therearetwochoices.Eitherusethesmalleroneforareaswherehandheldmobile
receptionisacceptable,suchasthisone:

Orifyouareinanareaofweakerreception,useanexternalantennasuchasthatusedonamotor
vehicle.Ifyouareusingthelargervehiclestyleaerial,youmightfindthattheplugwillnotfittothe
shieldsconnector.Forexample,considerthefollowing:

Ontheleftistheendoftheleadfromthecarphoneaerial,therightistheleadfromtheGSMshield.
Problem!Thesolutionisinthecentre:anFMEmaletoSMAmaleadaptor.Thisonecamefrom
element14,partnumber1826209(itisaMulticompR2301400002611000).
Furthermore,careneedstobetakenwithyourGSMshieldwithregardstotheaerialleadmodule
connection,itisveryfragile:

Andfinally,downloadthisdocument(.pdf).ItcontainsalltheATandERRORcodesthatwillturnup
whenyouleastexpectit.Pleasereviewitifyouarepresentedwithacodeyouareunsureabout.
Wowallthoserulesandwarnings?
Thesectionsabovemaysoundalittleauthoritarian,howeverIwantyourprojecttobeasuccess.With
thepreviousiterationsofthetutorialpeoplejustdidntfollowtheinstructionssoIhopeyoudo

AreyouusinganArduinoMegaorLeonardoboard?
Thingsarealittledifferentforyou.ThoseboardsdontsupportSoftwareSerialondigitalpins2and3
thusrenderingtheGSMshieldalittletrickiertouse.Instead,bendbacktheD2andD3pinsonthe
GSMshieldassuch(clickimagetoenlarge):

ThenrunjumpersfromD2ontheattachedshieldtoD10andanotherfromD3toD11.Ifyoureusing
theaforementionedpowershielditwouldbeontopoftheGSMshieldhoweverthejumperwires
wouldbethesame.Finallyinallthesketches,changethelineSoftwareSerialcell(2,3)
toSoftwareSerialcell(10,11).IfyouhaveaLeonardo,getaUno.
Initialcheckdoesitwork?
Thismaysoundlikeasillyquestion,butconsideringthecostoftheshieldandthevariablesinvolved,
itisagoodideatocheckifyoursetupisfunctioningcorrectlybeforemovingon.Fromahardware
perspectiveforthisarticle,youwillneedyourArduinoboard,theGSMshieldwithactivatedSIM
cardandanaerial,andarangeofpreviouslyusedcomponents.
MakesureyourSIMcardissettonotrequireaPINwhenthephoneisturnedon.Youcancheckand
turnthisrequirementoffwithyourcellphone.Forourinitialtest,uploadthefollowingsketch:
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

// Example 263.1

#include <SoftwareSerial.h>
char incoming_char=0; //Will hold the incoming character from the Serial Port.
SoftwareSerial cell(2,3); //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx

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.
}
}

ThenconnecttheGSMshield,aerial,inserttheSIMcardandapplypower.Opentheserialmonitor
boxintheArduinoIDEandyoushouldbepresentedwiththefollowing:

Itwilltakearoundfifteentothirtysecondsforthetextabovetoappearinfull.Whatyouarebeing
presentedwithisalogoftheGSMmodulesactions.Butwhatdotheyallmean?
+SIND:1meanstheSIMcardhasbeeninserted
the+SIND:10lineshowsthestatusoftheinmodulephonebook.Nothingtoworryaboutthere
forusatthemoment
+SIND:11meansthemodulehasregisteredwiththecellularnetwork
+SIND:3meansthemoduleispartiallyreadytocommunicate
and+SIND:4meansthemoduleisregisteredonthenetwork,andreadytocommunicate
Fromthispointon,wewillneedtouseadifferentterminalprogram,astheArduinoIDEsserial
monitorboxisntmadeforfulltwowaycommunications.Youwillneedaterminalprogramthatcan
offerfulltwowaycomport/serialcommunication.ForthoserunningMSWindows,anexcellent
optionisavailablehere.
Itsfree,howeverconsiderdonatingfortheuseofit.Forotheroperatingsystems,peoplesaythis
workswell.Sonowletstryitoutwiththeterminalsoftware.CloseyourArduinoIDEserialmonitor
boxifstillopen,thenrunyourterminal,setittolookatthesameserialportastheArduinoIDEwas.
Ensurethesettingsare9600,8,N,1.ThenresetyourArduinoandthefollowingshouldappear:

ThenextstepistotelltheGSMmodulewhichnetworkfrequency(ies)touse.Pleasedownloadthis
document(.pdf),andviewpage127.Thereisarangeoffrequencychoicesthatourmodulecanuse.If
youdontknowwhichonetouse,contactthetelephonecompanythatyourSIMcardcamefrom.
Australiauseoption4.Chooseyouroption,thenenter
1 AT+SBAND=x

(whereXisthevaluematchingyourrequiredfrequency)intotheterminalsoftwareandclickSEND.
ThenpressresetontheArduinoandwatchtheterminaldisplay.Youshouldhopefullybepresented
withthesametextasabove,endingwith+SIND:4.Ifyourmodulereturns+SIND:4,werereadyto
moveforward.
Ifyourterminalreturneda+SIND:8insteadof4,doublecheckyourhardware,powersupply,
antenna,andthefrequencybandchosen.Ifallthatchecksoutcallyournetworkprovidertoseeif
theyrerejectingtheGSMmoduleontheirnetwork.
Ournexttestistocallourshield.So,pickupaphoneandcallit.Yourshieldwillreturndatatothe
terminalwindow,forexample:

Asyoucansee,themodulereturnswhatishappening.Ilettheoriginatingphoneringtwice,andthe
modulereceivedthecallerIDdata(sorry,blackeditout).Sometelephonesubscribersaccountsdont
sendcallerIDdata,soifyoudontseeyournumber,noproblem.NOCARRIERoccurredwhenI
endedthecall.+SIND:6,1meansthecallendedandtheSIMisready.
HaveyourArduinocallyou
Thedocument(.pdf)wedownloadedearliercontainsalistofATcommandsconsiderthisaguideto
thelanguagewithwhichweinstructtheGSMmoduletodothings.Letstryoutsomemore
commandsbeforecompletingourinitialtest.Thefirstoneis:
1 ATDxxxxxx

whichdialsatelephonenumberxxxxxx.Forexample,tocall(212)8675309use
1 ATD2128675309

Thenextoneis
1 ATH

whichhangsuporendsthecall.So,letsreachoutandtouchsomeone.Intheterminalsoftware,
enteryourATDxxxxxxxxcommand,thenhitsend.Letyourphonering.ThenenterATHtoendthe
call.Ifyouareexperimentingandwanttohangupinahurry,youcanalsohitresetontheArduino
anditwillendthecallaswellasresettingthesystem.
SobynowyoushouldrealisetheGSMmoduleiscontrolledbytheseATcommands.TouseanAT
commandinasketch,weusethefunction
1 cell.println()

forexample,todialaphonenumber,wewoulduse
1 cell.println("ATD2128675309");

Todemonstratethisinasketch,considerthefollowingsimplesketchwhichdialsatelephonenumber,
waits,thenhangsup.Replacexxxxxxxxwiththenumberyouwishtocall.
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

// Example 26.2

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

void setup()
{
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);
}

Thesketchinexample26.2assumesthatalliswellwithregardstotheGSMmodule,thatistheSIM
cardisok,thereisreception,etc.Thedelayfunctioninvoidsetup()isusedtoallowtimeforthe
moduletowakeupandgetconnectedtothenetwork.Lateronwewillreadthemessagesfromthe
GSMmoduletoallowoursketchestodealwitherrorsandsoon.
However,youcanseehowwecansimplydialatelephone.Youcouldnowhaveahomealarmsystem
thatcancallyouuponaneventhappening,etc.
SendanSMSfromyourArduino
AnotherpopularfunctionistheSMSorshortmessageservice,ortextmessaging.Beforemoving
forward,downloadandinstallMeirMichaniesSerialGSMArduinolibraryfromhere.Sendingatext
messageisincrediblysimpleconsiderthefollowingsketch:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

// Example 26.3

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

void setup()
{
delay(30000); // wait for GSM module
cell.begin(9600);
}

void sendSMS()
{
cell.Verbose(true); // used for debugging
cell.Boot();
cell.FwdSMS2Serial();
cell.Rcpt("+xxxxxxxxx"); // replace xxxxxxxxx with the recipient's cellular number
cell.Message("Contents of your text message");

20
21
22
23
24
25
26
27
28
29
30

cell.SendSMS();
}
void loop()
{
sendSMS();
do // remove this loop at your peril
{
delay(1);
}
while (1>0);
}

Itssupersimplejustchangethephonenumbertosendthetextmessage,andofcoursethemessage
youwanttosend.Thephonenumbersmustbeininternationalformat,e.g.Australia0418123456is
+61418123456orUSA(609)8675309is+16098675309.
Reachoutandcontrolsomething
Nowletsdiscusshowtomakesomethinghappenbyasimpletelephonecall.Andthebestthingis
thatwedontneedthetheGSMmoduletoanswerthetelephonecall(therebysavingmoney)justlet
themoduleringafewtimes.Howisthispossible?Veryeasily.RecallExample26.1abovewe
monitoredtheactivityoftheGSMmodulebyusingourterminalsoftware.
InthiscasewhatweneedtodoishaveourArduinoexaminethetextcominginfromtheserialoutput
oftheGSMmodule,andlookforaparticularstringofcharacters.
WhenwetelephonetheGSMmodulefromanothernumber,themodulereturnsthetextasshownin
theimagebelow:

WewanttolookforthetextRING,as(obviously)thismeansthattheGSMshieldhasrecognised
theringsignalfromtheexchange.ThereforeneedourArduinotocountthenumberofringsforthe
particulartelephonecallbeingmadetothemodule.(MemoriesManyyearsagowewoulduse
publictelephonestosendmessagestoeachother.
Forexample,afterarrivingataforeigndestinationwewouldcallhomeandletthephoneringfive

timesthenhangupwhichmeantwehadarrivedsafely).Finally,oncetheGSMshieldhasreceiveda
setnumberofrings,wewanttheArduinotodosomething.
Fromasoftwareperspective,weneedtoexamineeachcharacterasitisreturnedfromtheGSM
shield.OnceanRisreceived,weexaminethenextcharacter.IfitisanI,weexaminethenext
character.IfitisanN,weexaminethenextcharacter.IfitisaG,weknowaninboundcallis
beingattempted,andoneringhasoccurred.
Wecansetthenumberofringstowaituntiloutdesiredfunctioniscalled.Inthefollowingexample,
whentheshieldiscalled,itwillcallthefunctiondoSomething()afterthreerings.
ThefunctiondoSomething()controlstwoLEDs,onered,onegreen.EverytimetheGSMmoduleis
calledfor3rings,theArduinoalternatelyturnsonorofftheLEDs.Usingthissketchasanexample,
younowhavetheabilitytoturnbasicallyanythingonoroff,orcallyourownparticularfunction.
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

// Example 26.4

#include <SoftwareSerial.h>
char inchar; // Will hold the incoming character from the Serial Port.
SoftwareSerial cell(2,3); //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx
int numring=0;
int comring=3;
int onoff=0; // 0 = off, 1 = on

void setup()
{
pinMode(12, OUTPUT);
pinMode(13, OUTPUT); // LEDs - off = red, on = green
digitalWrite(12, HIGH);
digitalWrite(13, LOW);
//Initialize serial port for communication.
cell.begin(9600);
}

void doSomething()
{
if (onoff==0)
{
onoff=1;
digitalWrite(12, HIGH);
digitalWrite(13, LOW);
}
else
if (onoff==1)
{
onoff=0;
digitalWrite(12, LOW);
digitalWrite(13, HIGH);
}
}

void loop()
{
//If a character comes in from the cellular module...
if(cell.available() >0)
{
inchar=cell.read();
if (inchar=='R')
{
delay(10);
inchar=cell.read();
if (inchar=='I')

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

{
delay(10);
inchar=cell.read();
if (inchar=='N')
{
delay(10);
inchar=cell.read();
if (inchar=='G')
{
delay(10);
// So the phone (our GSM shield) has 'rung' once, i.e. if it were a real phone
// it would have sounded 'ring-ring'
numring++;
if (numring==comring)
{
numring=0; // reset ring counter
doSomething();
}
}
}
}
}
}
}

Andnowforaquickvideodemonstration.Thefirstcallismade,andtheLEDsgofromred(off)to
green(on).Asecondcallismade,andtheLEDsgofromgreen(on)tored(off).Althoughthismay
seemlikeanoversimplifiedexample,withyourexistingArduinoknowledgeyounowhavethe
abilitytorunanyfunctionbycallingyourGSMshield:

Example26.4

1:00/1:00

ControlDigitalI/OviaSMS
Nowalthoughturningonethingonoroffisconvenient,howcanwesendmorecontrolinformationto
ourGSMmodule?Forexample,controlfourormoredigitaloutputsatonce?Thesesortsof
commandscanbeachievedbythereceptionandanalysisoftextmessages.
Doingsoissimilartothemethodweusedinexample27.1.Onceagain,wewillanalysethecharacters
beingsentfromtheGSMmoduleviaitsserialout.However,therearetwoATcommandsweneedto
sendtotheGSMmodulebeforewecanreceiveSMSs,andoneafterwards.Thefirstoneyoualready
know:

1 AT+CMGF=1

WhichsetstheSMSmodetotext.Thesecondcommandis:
1 AT+CNMI=3,3,0,0

ThiscommandtellstheGSMmoduletoimmediatelysendanynewSMSdatatotheserialout.An
exampleofthisisshownintheterminalcapturebelow:

Twotextmessageshavebeenreceivedsincethemodulewasturnedon.Youcanseehowthedatais
laidout.TheblackedoutnumberisthesenderoftheSMS.Thenumber+61418706700isthenumber
formycarriersSMSC(shortmessageservicecentre).Thenwehavethedateandtime.Thenextline
isthecontentsofthetextmessagewhatweneedtoexamineinoursketch.
ThesecondtextmessageintheexampleaboveishowwewillstructureourcontrolSMS.Oursketch
willwaitfora#tocomefromtheserialline,thenconsiderthevaluesaftera,b,candd0foroff,1
foron.Finally,weneedtosendonemorecommandtotheGSMmoduleafterwehaveinterpretedour
SMS:
1 AT+CMGD=1,4

ThisdeletesallthetextmessagesfromtheSIMcard.Asthereisafiniteamountofstoragespaceon
theSIM,itisprudenttodeletetheincomingmessageafterwehavefollowedtheinstructionswithin.
Butnowforourexample.Wewillcontrolfourdigitaloutputs,D9~12.Forthesakeoftheexercisewe
arecontrollinganLEDoneachdigitaloutput,howeveryoucoulddoanythingyoulike.
Althoughthesketchmayseemlongandcomplex,itisnotjustfollowitthroughandyouwillsee
whatishappening:

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

// Example 26.5

#include <SoftwareSerial.h>
char inchar; //Will hold the incoming character from the Serial Port.
SoftwareSerial cell(2,3); //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the T

int led1 = 9;
int led2 = 10;
int led3 = 11;
int led4 = 12;

void setup()
{
// prepare the digital output pins
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
//Initialize GSM module serial port for communication.
cell.begin(9600);
delay(30000); // give time for GSM module to register on network etc.
cell.println("AT+CMGF=1"); // set SMS mode to text
delay(200);
cell.println("AT+CNMI=3,3,0,0"); // set module to send SMS data to serial out upon receipt
delay(200);
}

void loop()
{
//If a character comes in from the cellular module...
if(cell.available() >0)
{
inchar=cell.read();
if (inchar=='#')
{
delay(10);
inchar=cell.read();
if (inchar=='a')
{
delay(10);
inchar=cell.read();
if (inchar=='0')
{
digitalWrite(led1, LOW);
}
else if (inchar=='1')
{
digitalWrite(led1, HIGH);
}
delay(10);
inchar=cell.read();
if (inchar=='b')
{
inchar=cell.read();
if (inchar=='0')
{
digitalWrite(led2, LOW);
}
else if (inchar=='1')
{
digitalWrite(led2, HIGH);

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

}
delay(10);
inchar=cell.read();
if (inchar=='c')
{
inchar=cell.read();
if (inchar=='0')
{
digitalWrite(led3, LOW);
}
else if (inchar=='1')
{
digitalWrite(led3, HIGH);
}
delay(10);
inchar=cell.read();
if (inchar=='d')
{
delay(10);
inchar=cell.read();
if (inchar=='0')
{
digitalWrite(led4, LOW);
}
else if (inchar=='1')
{
digitalWrite(led4, HIGH);
}
delay(10);
}
}
cell.println("AT+CMGD=1,4"); // delete all SMS
}
}
}
}
}

Andnowforavideodemonstration:

Conclusion

SothereyouhaveitcontrollingyourArduinodigitaloutputsviaanormaltelephoneorSMS.Nowit
isuptoyouandyourimaginationtofindsomethingtocontrol,sensordatatoreturn,orgetuptoother
shenanigans.Ifyouenjoyedthisarticle,youmayfindthisofinterestcontrollingACpoweroutlets
viaSMS.
Andifyouenjoyedthetutorial,orwanttointroducesomeoneelsetotheinterestingworldofArduino
checkoutmybook(nowinathirdprinting!)ArduinoWorkshopfromNoStarchPress.

Havefunandkeepcheckingintotronixstuff.com.Whynotfollowthingsontwitter,Google+,
subscribeforemailupdatesorRSSusingthelinksontherighthandcolumn,orjoinourGoogle
Groupdedicatedtotheprojectsandrelateditemsonthiswebsite.Signupitsfree,helpfultoeach
otherandwecanalllearnsomething.

Bio

LatestPosts

JohnBoxall
Founder,ownerandmanagingeditoroftronixstuff.com.

Pleasesharewithothers:

Likethis:

Like
Bethefirsttolikethis.

Kitreview:Freetronics162LCDArduinoShield
ReviewFluke233RemoteDisplayTrueRMSMultimeter

87ResponsestoTutorialArduinoUnoandSM5100BGSMCellular

1.

Brucesays:
March8,2013at7:56am
Thanksforthistutorial,John,Ifounditveryhelpful.IhaveafewquestionsImhopingyou(or
someone)mightbeabletoanswer:1.WhenIfirstranexample26.1IgotalltherightSIND
messages,butafterafewweeksofrunningvariationsofthecodethemodulenowonlyreturns
11(andoccasionally7),evenontheoriginalcode.Doyouknowwhytheothermessagesareno

longerappearing?2.TheATCommandmanualnotesthattheSINDmessagesarestoredin
flashmemory.Doesthismeanthattheyareaccessiblebymeansotherthancell.read()?3.When
IsentAT+ADCMitreturnthevalue3979.Isthis3.979Vanddoesitcorrespondtotherange
3.3to4.2referredtointheSM5100Bmanual(Table1)?Thanksforyourhelp.

JohnBoxallsays:
March8,2013at5:57pm
HiBruce
1)Ifyouregetting11theressomethingonthenetworksidethatsstoppingfull
registration(e.g.accountissues).7meansyoucantregisteronyourSIMsnetwork,but
themoduleisfindinganothernetwork.Checkyouraccount,SIM,antenna,receptionetc.
Orthemoduleisplayingupithappens.(2)YoucanreadSINDstatusbysending
AT+SIND?soyeah,eithercell.readoryourowncodetomonitorwhatscomingback
fromthemoduleviaserial.(3)AT+ADCMisreadingtheADConthemodulepage32
ofATcommandguidesaysitvariesbetween0~5000.

2.

Philsays:
March26,2013at1:57am
Man..whenitriedexample26.3igotSerialGSMdoesnotanametypeerror..pleasehelp

JohnBoxallsays:
March26,2013at8:39am
DidyouinstalltheSerialGSMlibrary?
https://github.com/meirm/SerialGSM

3.

Carlossays:
March28,2013at11:26am
Hello,John.
FirstIwanttothankforthisTutorialwhichisveryexplained,but,IjustIhaveanydoubt,ifthe
GSMcellcanperformaconventionalcallingvoistovoissincemypersonalcellphonetothe
GSMCellandIfIcanconectaspeakertothisshield.?

JohnBoxallsays:
March29,2013at11:08am
Theearpieceandmicrophonelinesfromthemodulearebroughtouttotheedgeofthe
shield(seeJ7intheschematic),sothiscouldbepossible.
Schematichttps://www.sparkfun.com/datasheets/DevTools/Arduino/cellular%20shield
v12.pdf

4.

Davidsays:
April17,2013at4:38pm
HiJohn,
ManImlovingyourtutorials,theyareeverythingthatIneedinoneplacethankyou!!!
Withexample26.3Imassumingthatitisatypoonlinetwowherethereisnothingappended
toyour#includestatement.
IaddedtheheaderfileSoftwareSerialandeverythingseemedtoworkfine.Isthatwhatis
supposedtobethere?

JohnBoxallsays:
April18,2013at12:25am
Yup,bloodyWordPress.
#include

5.

BogdanNilsays:
April23,2013at2:23am
whydoigetthismessageanditdoesnotconnectingtonetwork??whatis+stin:9??

JohnBoxallsays:
April23,2013at10:03am
Haventseenthatbefore.Downloadhttp://tronixstuff.com/wp
content/uploads/2011/01/sm5100batcommands.pdfandseepage84

6.

threelegssays:
May8,2013at6:35am
Ifyouhaveamegadoyoustillneedtheextra5vpowersupplyorwillitbeabletoprovide
enoughtopowertheshield?

JohnBoxallsays:
May8,2013at8:46am
Stillneedtheexternalpower.

7.

Emiliosays:
May21,2013at10:21am
conrespectoalconectorquemencionasparaelcabledelaantena,Aslotengoquepedir

pedir..?
enellugardondeloquierocomprar(unmachoFMEaSMAadaptadormacho),otendralgn
otronombre.
yqueotrocablelepuedoconectarenvesdelquemensionasarriba(cabledelaantenadel
telfonodelcoche),porqueenellugardondelarequieroponer,notienemuchaseal.
Lomascercanoqueencontrdeunconectorparalaantenafueunaquesellamaconector
machotipoFPermaSealII,nosesiseasimilar.
gracias.Mesacariasdeunapuroquetengo.

JohnBoxallsays:
May21,2013at2:41pm
Nosdeningnotronombreparaesaparte.

8.

DiegoChsays:
May22,2013at5:54am
Whyloadingtheconfigurationcodetoarduinoandruntheterminalreturnsmethesevalues:
+SIND:1
+SIND:10,SM,1,FD,1,..(allwith1)
+SIND:0
+SIND:3
+SIND:4
+SIND:7

JohnBoxallsays:
May22,2013at9:17am
LookattheSINDvaluesonpage126ofthemodulemanual(http://tronixstuff.com/wp
content/uploads/2011/01/sm5100batcommands.pdf).Itlookslikeyoumakeconnection
toyournetworkthenitdropsyouoff(SIND4then7).Checkwiththenetworkprovider
thatyoucanusetheGSMshieldwithyouraccounttheymightneedtheIMEInumber
toberegisteredetc.

9.

DiegoChsays:
May22,2013at11:03am
Okay,Illtrythat.Onemorequestion,itisnormalthatIreturnterminal+SIND:0orwhois
this?

JohnBoxallsays:
May23,2013at9:09am

AgainyoucanlookuptheSINDvaluesyourselfonpage126ofthemodulemanual
(http://tronixstuff.com/wpcontent/uploads/2011/01/sm5100batcommands.pdf).0means
SIMcardnotinserted.

10.

SunHwiBangsays:
May30,2013at1:51pm
Hellojohn
IgotmySM5100BtodayandIhaveatroublewithconnectingasimcardandmodule.Ihavea
simcardthatworksformyphoneandifIhookituptomoduleandchecktheserialmonitor,
thenIgetfollowingmessage:
StartingSM5100BCommunication

+SIND:8
+SIND:8meansthatthenetworkislost.Doyouknowawaytofixthis?Perhapsitis
becausethissimcardrequiresthepincodeandIhavenoideahowIcaninputthepincode.
Thankyouandmyteamwillnotforgetyourgeneroushelp
Sincerely,
SunHwiBang

JohnBoxallsays:
May30,2013at1:55pm
YoucanremovetherequirementforaPINbyputtingtheSIMinanormalhandsetand
turningitoffthroughthesecurity(e.g.)menu.
Makesureyouhaveselectedtheappropriatebandaswell.

11.

SunHwiBangsays:
June4,2013at4:24pm
HelloJohn.Thankyousomuchforyourhelp,butIamhavinganothertrouble:
StartingSM5100BCommunication
+SIND:1
+SIND:10,SM,1,FD,1,LD,1,MC,1,RC,1,ME,1
+SIND:3
+SIND:8
+SIND:4
IamusingAT&Tsimcardanditseemsthatitdoesnotfindthenetwork.Couldyoutellme
howIcanfixthisproblem?

JohnBoxallsays:
June4,2013at7:57pm
IfyourlastSINDis4thenitshouldbeworking.

SunHwiBangsays:
June6,2013at6:45am
HelloJohn
IfixedmyantennaandnowIamgetting
StartingSM5100BCommunication

+SIND:1
+SIND:10,SM,1,FD,1,LD,1,MC,1,RC,1,ME,1
+SIND:3
+SIND:4
+SIND:8
andifIrunSMSsendcodethenIamgettingCME=313error.iamsodesperate
withthismodule,butsorryforbotheringyouagain

JohnBoxallsays:
June6,2013at8:52am
CME=313meansSIMfailure.HoweveryourSINDresultsarestillthesame.
DidyoucallAT&TabouttheIMEIoraccount?

SunHwiBangsays:
June6,2013at9:09am
HelloJohnThankyousomuchforyourhelp.ItfinallyworksandIamsuper
happy.Iwouldnotmakethishappenwithoutyourhelp.Ithinktheproblemwas
powersupply.Also,quickquestionaboutsendingSMS.Couldyoutellmea
correctsyntaxtosendSMStomultiplerecipient?

JohnBoxallsays:
June6,2013at5:24pm
Goodnews.IcanthelpyouwithmultipleSMS.

SunHwiBangsays:
June7,2013at9:24am
Thankyousomuchforthisposting.IwassohappythatIfinallymadethismodule
working.

12.

Stevesays:
June8,2013at10:48am
HiJohn,thankssomuchfortheinfoonthispage.Veryusefulindeed.Imfollowingyour
directionsandImuptothepointwhereIneedtodothetwowaycommunicatingbetweenthe
terminalsoftwareandthecellularshield.AsIhaveaMachoweverIvenotbeenabletofollow
theinstructionontheOSXdownloadyouprovidedtheweblinkforabove,
http://syncterm.bbsdev.net/.AnychanceyoucouldoffersomeguidanceforMacusers?
Otherwise,perhapsthereareotherwaystotroubleshootthe+SIND:8error?Myconnectionsto
themodulelookgood.

JohnBoxallsays:
June8,2013at5:18pm
TheSynctermlinkisstillactivebutIdonthaveaMacintoshsonotsureaboutthatone.
Youcanuseanyotherterminalsoftwarethatcancommunicatewiththeserial/USBport.
Howevera+SIND:8meansnetworkislost.Checkyourhardware,thefrequencyband
againstyourGSMcarrierandifitstillreturns8callyourproviderastheymayneedthe
IMEIofyourGSMmoduleornotallow3rdpartydevicesonyournetwork.

sunhwisays:
June9,2013at11:49am
HelloJohn.Isincerelyrespectyourpatienceandtimeforansweringmyinquires.I
aminCostaRicaandIamtryingtousetheGSMmoduleviaCostaRicanmobile
network.IamusingthesamesimcardthatItestedinUSbutdifferentGSM
module(IhavetwoSM5100BandIleftworkingGSMmoduleinUSand
broughtthenewonehere)
However,thisiswhatIamgettingonmyArduinoSerial:
StartingSM5100BCommunication
r

1)
@

0
A
8))
a
!P
!

D
0
Ikeptgettingbunchoframdoncharacters,whichopenstotwopossibilities.
1)GSMmoduledoesntnotworkinCostaRicannetwork(However,thesameSIM
cardworksinsmartphonehere)
2)GSMmoduleisalreadybrokensomehow(Ididntputanyexternalpower,soI
hardlybelievethatIwouldhaveburntthemodule)
Thankyouforconsideringmyquestionsagain.HaveagreatSaturdayeveing.

Sincerely,
SunHwiBang

JohnBoxallsays:
June10,2013at7:03pm
1)Themodulemaybefaultyhoweverwiththerandomcharactersitmaybeoneof
thefewonesthatweresetto115200bpsthatSparkfunletslipthroughayearorso
agosotryalteringthedatarateinyoursketch.
1a)YoursmartphonemaysupportafrequencythatsusedinCostaRicawhichthe
SM5100doesnot.
2)Usepowerasdescribedinthetutorial.

AndreCeleresays:
July20,2013at3:41am
John,evenifthenetworkoperateswithafrequencynotsupportedbytheSM,
woulditnotrecognizethataSIMhasbeeninserted?Ionlyget+SIND:0andI
triedwith2differentSIMs,from2diffoperators:(((

JohnBoxallsays:
July20,2013at9:49am
Yes,ItwillrecogniseaSIMinstinserted.

13.

Johnsays:
June15,2013at6:12pm
Hello!
Ireallyappreciateyourwork.
ImfromRomaniaandiworkformylicense.Ibuythisshield.Example26.1worksfine.
Butitryedexample26.3anddoesntwork.SerialMonitorboxisblank.
cell.Rcpt(+xxxxxxxxx)//replacexxxxxxxxxwiththerecipientscellularnumber
+40representscodeofmycountry.
Whatcanido?Isawinexamplesofarduino>librariesthecodeisdifferentasagainstthis.I
trieddifferentvariantsbut.stillnotworking.Ineedhelp.
Thanks!

14.

Abishaisays:
June16,2013at6:10pm
Hi,verynicetutorial.Iamusingsim300modulealongwitharduinoandIwanttocontrolmy
arduinothroughGPRSbyturningarduinointowebserver.Canyougivesomesuggestionsto
mefordoingit.

JohnBoxallsays:
June16,2013at6:31pm
CanthelpyouIdonthaveexperiencewiththatmodule.

15.

bensondomingosays:
July1,2013at11:53pm
GoodDayauthor,ijustwanttoaskhowtoconnectthegsmshieldtomyarduinoon
breadboard.whatpinsdotheshieldconnectedinatmega328?bytheway,yourtutorialisabig
helpforme.ivelearnedalotsinceistartreading.Thankyouforyourconsiderationfora
newbie^^.

JohnBoxallsays:
July2,2013at11:32am
Theshieldusesdigitalpins2and3,5VandGND.

16.

gilisays:
July16,2013at7:21pm
Hi,
Thanksforthetutorials.Theyarereallyhelpful.IFollowedyourtutorialandicantalktothe
SM5100Bandgetresponsefromhimbutidontget+SIND11orrarelygetit.Itispluggedto
anexternal5Vpowersupplywith3Arating.
Itusasllylookslikethis:
+SIND:1
+SIND:10,SM,1,FD,1,LD,1,MC,1,RC,1,ME,1
+SIND:7
+SIND:3
+SIND:4
ThenoccasionalyIdogetSIND11
+SIND:1
+SIND:10,SM,1,FD,1,LD,1,MC,1,RC,1,ME,1
+SIND:7
+SIND:3
+SIND:4

+SIND:11
~
Andthentheallprocessstartallover.Iguessitbecauseoftheloop.Somyquestionisifiget
onlySIND4isitok?
andthesecondproblemisthatifirunthesmssketch,themoduledoesntsendansms.
IsitrelatedtotheSIND11?
WhatcanidotomaketheSIND11consistent?
Thanksinadvence
Gil

JohnBoxallsays:
July17,2013at8:58am
ThelastSINDshouldbe4,ifitskips11thatsok.Itcouldbeareceptionissuecheck
yourantennaconnection.Oritcouldbethenetworkdoesntallow3rdpartydevices
callthemtocheck.

gilisays:
July18,2013at4:56pm
Thankyouforthereply.ActuallytheproblemwasthatIconnectedtheexternal
powertothe5VpininsteadoftheVINpin.Ivenoticedsomethingweird.Your
exampleoftheSMSsendingisworkingproperly,buttheSERIALGSMexample
oftheSMSsendingisnt.Canyoutellwhy?Isitbecauseofthedelayorthefact
thatyoumadeitastandalonefunction?alsowhatisthedo>whileloopfunction?
Whydoyousayitsriskytotakeitout?
Thanksagainforyourtimeandanswers.Itismostappreciated.

JohnBoxallsays:
July19,2013at2:52pm
ThedoloopistherejusttoensurethesketchonlysendsoneSMS.Itsa
demonstrationsketch,toshowhowitworkswhichpeoplecanmodifytodowhat
theylikewith.

17.

gilisays:
August21,2013at9:26pm
HiJohn,
Sorryforthelatereply,isetitasideforawhile.Firstofallthanksfortheanswer.itmade
senseafterideletedtheloopandgotlotsofsmss
Ihaveanotherquestionthough,Imusingpin2forinterruptintheUNO,soitriedtosetthe
softwareserialtootherpins(like4,5)butitdidntwork.Doestheshieldhardwiredtopins2,3
?Ihavetousejumpersfromotherpinstomakeitwork?
howdoIusethehardwareserialpins(tx1,rx0)?ifIcantuseotherpinsforthesoftware

serial?

JohnBoxallsays:
August22,2013at8:28am
Shieldishardwiredto2and3,youllneedtousesomejumpersorsoldersome
replacementwiring.

18.

gilisays:
September8,2013at5:47pm
Hijohn,
Iwouldlikeyouradviceplease.Iworkedwiththemoduleandallwaswell.Andthenforsome
reasonitstartedtosometimesworkandsometimesdont.SoIwentbacktotheterminaltolook
atthebasicsketch,andafterthestartcommunicationnothinghappens.
Ithasexternalpowersupplyof5V3A,Soitisnotpowerrelated,andconnectedtothearduino
pin2,3forcomms.
WhatcanIdotoseeifthemoduleisdefecetedornot?
Thanks.

JohnBoxallsays:
September9,2013at10:10am
HardtosaywithoutbeingtheresoIdpulleverythingapartandreassembleit,
checkingtheconnectionsandthevoltagefromthepowersupplywithamultimeter.

19.

Alexsays:
September19,2013at2:52pm
HiJohn,thanksfortheinfo,Imgettingthefollowingproblemwhenirunverify,

SerialGSMdoesnotnameatype
sketch_sep19a:3:error:SerialGSMdoesnotnameatype
sketch_sep19a.ino:Infunctionvoidsetup()':
sketch_sep19a:8:error:cellwasnotdeclaredinthisscope
sketch_sep19a.ino:InfunctionvoidsendSMS()':
sketch_sep19a:13:error:cellwasnotdeclaredinthisscope

Thanksinadvance!
AR

JohnBoxallsays:

September20,2013at9:53am
DidyouinstalltheSerialGSMlibrary?

Alexsays:
September21,2013at12:20pm
John,thanksfortheresponseIfoundanotherwayanditsworking!!!
Thanks
Hereisthecode,
//IncludetheGSMlibrary
#include
#definePINNUMBER
//initializethelibraryinstance
GSMgsmAccess
GSM_SMSsms
voidsetup()
{
//initializeserialcommunicationsandwaitforporttoopen:
Serial.begin(9600)
while(!Serial){
//waitforserialporttoconnect.NeededforLeonardoonly
}
Serial.println(SMSMessagesSender)
//connectionstate
booleannotConnected=true
//StartGSMshield
//IfyourSIMhasPIN,passitasaparameterofbegin()inquotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected=false
else
{
Serial.println(Notconnected)
delay(1000)
}
}
Serial.println(GSMinitialized)
}
voidloop()
{
Serial.print(Enteramobilenumber:)
charremoteNum[20]//telephonenumbertosendsms

readSerial(remoteNum)
Serial.println(remoteNum)
//smstext
Serial.print(Now,enterSMScontent:)
chartxtMsg[200]
readSerial(txtMsg)
Serial.println(SENDING)
Serial.println()
Serial.println(Message:)
Serial.println(txtMsg)
//sendthemessage
sms.beginSMS(remoteNum)
sms.print(txtMsg)
sms.endSMS()
Serial.println(\nCOMPLETE!\n)
}
/*
Readinputserial
*/
intreadSerial(charresult[])
{
inti=0
while(1)
{
while(Serial.available()>0)
{
charinChar=Serial.read()
if(inChar==\n)
{
result[i]=
Serial.flush()
return0
}
if(inChar!=\r)
{
result[i]=inChar
i++
}
}
}
}

20.

RobertBensonsays:
September25,2013at12:43am
MynameisRobertandImdoingaseniorprojectonthearduinocellularshieldandImgetting
thiserrormessage.canyouhelp?
StartingSM5100BCommunication

+SIND:1
+SIND:10,SM,1,FD,1,LD,1,MC,1,RC,1,ME,1
+SIND:3
+SIND:8
+SIND:4
+CMEERROR:4

JohnBoxallsays:
September25,2013at9:54am
http://tronixstuff.com/wpcontent/uploads/2011/01/sm5100batcommands.pdf
page137.Thaterrorisoperationnotsupported.BythelookofthesequenceofSIND
numbers(page126)thenetworkiskickingyouoff.Callthecellularproviderandask
themiftheyrenotallowingyourmodulesIMEIontotheirnetwork.

21.

Ericsays:
October1,2013at6:30am
IthinkImhavingsomeproblemsgettingtheArduinotocommunicatewiththemodule.The
+SINDcodesarecominginallright(sequence:1,10,3,4,8),butwhenIsentitAT+SBAND?
itdidntreturnanything,soImnotsureifImevenontherightfrequency.IhaveanH2OSIM
card.

JohnBoxallsays:
October1,2013at9:50am
YoudontwantSIND8thatmeansthenetworkislost.Ifyouget4then8,thenetwork
mostlikelydoesntwantyourSIMandIMEIcombination.IseethatH20resellsAT&T,
whohaveGSM850MHzand1900MHz.HoweverH20mightnotofferaccesstothat
networkaspartoftheirreselleragreementwithAT&T.SocallH20andaskthem1)do
theyresell2GGSMand2)dotheyletanyIMEInumberonthenetworkorjusttheirown
supplieddevices.

22.

Iosifsays:
October2,2013at2:01am
Hello,
Thankyouforyourtutorial.Abasicquestion.WhichArduinoboardsarecompatiblewiththis
GSMmodule?

JohnBoxallsays:

October2,2013at9:48am
Forsimplicity,aUnoorcompatible.Howeveryoucanuseothersaslongasyouhavethe
serialandpowerwiringcorrect.

23.

gilisays:
October7,2013at8:28pm
HiJohn,
Ihavereplacedthesinceitdidntcommunicateback.Meaningitdidntsendbackany
responsesoverserial.Doyouhaveanyideawhyitcouldbe?
Also,withthenewmoduleigetthesind:4butwhenitrytomakeacallitsaysNO
CARRIER.Doyouhaveanyideawhy?Ontheotherhandwhenicallit,itringsandican
answerthecall
Mysimisprepaid,isitpossibletherechargeofthesimdidntwentthroughalthoughthe
serviceprovidersaiditwassuccesfully?
Regards,
Gili

gilisays:
October7,2013at9:21pm
Iforgottoaskhowdosendctrlzthroughtheterminal?Icantfigureitout.Iknowctrlz
is26inDECor0x1Ainhexbuticantfigureouthowtoincorporateittothesms
sequenceviaterminal?Couldyoupleasewritedownthesequenceafterthe
at+cmgs=xxxxxcommand?
Thanksalot!!!
Gili

JohnBoxallsays:
October10,2013at8:41am
Dependsonyourterminalemulator.Withtheoneinthetutorialjustensurethe
+CRboxisselected.

JohnBoxallsays:
October10,2013at8:42am
Possibly,puttheSIMinaphoneandtrytocallsomeoneetc.

24.

hameedullahsays:
October11,2013at4:06pm
Ineedsuchtypeofcodebutwanttocontrolrelayviasmsusinggsmandarduinoplswritesuch
typeofcodeiextremlyneedthisthanks

JohnBoxallsays:
October11,2013at4:07pm
Seehttp://tronixstuff.com/2011/04/24/tutorialcontrolacoutletsviasms/

25.

rjansays:
October25,2013at7:55pm
Thanksforyourtutorials.Ihaveaproblem.IfIreceiveanSMSIdonotgetthetextcontentbut
Igetthefollowing:+CMTI:SM,4
Icantthenusetheinformationinmyprogrammingtoperformactions.AmIdoingsomething
wrong?

JohnBoxallsays:
October25,2013at10:30pm
Pleaseseechapter27wherewedealwithreceivingSMSs.AreyouusingAT+CMGF=1
andAT+CNMI=3,3,0,0?

26.

Ushansays:
October29,2013at10:58am
hiineedamakeawristwatchsizedevicetosendsmsusinggsmmoduleandaurdinosisthere
anyavailbaledevicestocompletemyproject?

JohnBoxallsays:
October29,2013at11:00am
Idoubtit.HitGoogle.

27.

SergioMonsalvesays:
November1,2013at7:52am
Hi,verynicetutorial.IamusingSM5100BmoduleinGPRSmodeandIwanttocontrolmy
systemthroughGPRSbyturningarduinointowebserver.Canyougivesomesuggestionsto
mefordoingit.

JohnBoxallsays:
November1,2013at8:09am
SorrywewontbecoveringGPRS.

28.

SergioMonsalvesays:
November1,2013at9:24am
Thanksforyoursoonanswer.

29.

Edsays:
November1,2013at7:57pm
John,
Hi.IhaveusedyourtutorialandusedtheGSMmodulesucessfully.
InowwanttousetheGSMmodulefromanotherserialdevice.Canyoutellmehowtoaccess
andusetheexternalpins.
Manythnaks,Ed

JohnBoxallsays:
November6,2013at7:29am
Itsjustserialdataonpins2and3oftheshield.Socommunicatewithyourdeviceat
9600bps,8N1withtheATcommandsasusedintheexampleshere.

30.

Minkosays:
November5,2013at10:20pm
Hi,John!
Ifollowedyourtutorialanditwasworkinggreat.Nevertheless,todayIrunexample26.1again
andtherewassomethingwrong.AfterSIND1,10,11and3(whenSIND:4issupposedtocome
in)itjustprintsrandomsymbols.IsupposeitissomechangeinthebaudratebutIdon`treally
know.Couldyougivemesomeadvice?

JohnBoxallsays:
November6,2013at7:31am
Itwontchangethebaudrateduringoperation,justcheckallyourwiring,theantenna
andexternalpowersupply,etc.Otherwiseyoumighthaveafaultyshield.

31.

samsays:
November12,2013at11:35am
hiJohn,
basedonthegreattutorialabove,IhadsuccessfullyimplementedtheGSMshiedandDFRobot
powershieldafewmonthsago.

yesterdaywhilstconnectingmyArduinocontroller(completewithshields)intomyproject,I
inadvertantlyswitchedon/offtheexternalpowersupplywhilstthelaptopUSBwasstill
connectedtotheArduino.(yes,youwarnagainstthisinthetutorial)
nowtheArduinowillnotexcecutethesketch.pin13LEDremainsonallthetime.Othertest
sketcheswontworkeither,Itried(Blink)andapinHIGHsketchwhereImeasuredonlya
tricklevoltageattheHIGHpin.TheIDEappearstouploadtoArduinookastheTx&Rxleds
dotheirflashing.
IsuspectIhavedamagedtheboard,isthereanywaytorepair?
Sam
DingleyVIC,AUST

JohnBoxallsays:
November12,2013at12:46pm
YoucouldtryanewmicrocontrollerwithArduinobootloaderifyouhaveonespare,
otherwiseitsnewboardtime:\

32.

gilisays:
November12,2013at5:08pm
HiJohn,
Firstmyappreciationfortheguides(eventhoughisaiditbefore)Ikeepcomingbacktoitasa
reference.
IWanttomoveonbeyondSMSsanddotheGPRSpartofthemodule.Doyouiftheresany
library/guide/areallygoodandclearexplanationabouthowtodoit?whatarethestepsneeded
inordertogetitwork?
Icouldntfindanyreference,andtheonesididfindareoffline
Thankyouverymuch.
Regards,
Gili

JohnBoxallsays:
November12,2013at5:49pm
Ihaventhadtheurgetotryitmyself,andyourerightnottoomuchoutthere.
Howevertheresafewnotesoutthere.Forexample:
https://github.com/tobek/SM5100BGPRSandHadleyhassomenotesaboutit
http://nicegear.co.nz/blog/gprswiththesm5100barduinogsmshield/

33.

gilisays:
November14,2013at12:33am
HiJohn,

Ihaveseenthose.AndstillnoLuckIthinkIwilltrywiththeterminalfirst
IwouldappreciateitverymuchifyoucoulddoatutorialaboutGPRSalso.
Gil.

JohnBoxallsays:
November14,2013at7:22am
Maybe,butdontwaitformetodoit.

Bensays:
November14,2013at3:46pm
Gill,
IvemadeaquickinstructableshowinghowIgothttpgetviagprs
http://www.instructables.com/id/SM5100BGPRSandGeneralNotes/
Iwouldliketobuildonit,alsoAlsowouldliketomakealibraryfortheGSMmodule
butitmighttakemeawhile.
LikeyougillIhavehadallotoftroublefindinganygoodinfo
Ben

gilisays:
November27,2013at11:01pm
Hiben,
Thanksfortheinfo.Ididtrieditoutandthereisinconsistencywiththeworkofthe
module.Sometimesitconnectssometimesnot,butmostlyitgetsweirdbehavior.
Suchisthis:
+SOCKSTATUS:1,1,0102,0,0,0
Socketconnected
SendingHTTPpacket
+STCPD:1
Wait,thatsnotwhatwewereexpecting.WewantedOK
themsgis:+STCPD:1
Loopingforeverdisplayingcellmoduleoutput
OK.
Whilethroughtheterminalidontgetit.Idontevengetthe+STCPD:1response
fromtheserver.EventhoughthesocketstatusreturnsanACKbytes.Andifim
tringtoreadthedatathatstheanswer:
+SOCKSTATUS:1,1,0102,9,9,0
OK

+SDATA:1,0,
OK
Ididalteredyourcodeasifigureoutabetterwaytogetthemoduletoconnect.(if
itdoesntconnectafter4triesiclosetheconnectionandreopenandit
immediatelyconnects.Ifyouhaveanysuggestionsaboutit,Iwouldlovetohear
fromyou.
Gil

34.

Bensays:
November28,2013at2:14pm
GillseemslikeyournotgettinganOKafteryoufinishwritingthehttpandsendthe
completioncharacter(GSMSerial.write(26))
IusuallyseeanOKcomingbackafterthis,butyournot,itseemsthenextmessageyourgetting
isthe+STCPD:1dontknowifmaybeyourusingsoftwareserialanditsmissingtheOKor
whatthereasonforthatmightbebutIdontsupposeitsabigdeal,whynotjustremovethe
waitFor(OK)thatappearsimmediatelyafter(GSMSerial.write(26)),thenitwillstopwaiting
forokandthenextstepwasjusttowaituntila+STCPD:1anyway.
GSMSerial.print(UserAgent:+useragent+\r\n\r\n)//SIZE:16
GSMSerial.write(26)//ctrl+zcharacter:sendthepacket
//waitFor(OK)//Tryremovingthiswaitforok!
waitTil(+STCPD:1)//thismeansdataisreceived

Bensays:
November28,2013at2:21pm
Oops,itsGilinotGill,sorry.
MessagemeviatheInsructablespostifyouwanttohaveachataboutitasIhavehad
somemoresuccessrecentlyandhavegottenafairbitofthelibrarygoingforthisGSM
module.
ExcusemeJohn,nottryingtohijackyourpagehere,justhopingGiliandIcanhelpeach
othernutoutthismoduleproperly:)
Ben

JohnBoxallsays:
November28,2013at4:37pm
Knockyourselvesout.

gilisays:
November28,2013at8:09pm

ThanksBen,
Iwill.

35.

gilisays:
December3,2013at8:59pm
HiBen,
Ivesentyouamessageoninstructable.MyproblemisthatIdontgettheSTCPD:1fromthe
server.Coulditbethatadnsservermaybeconfigurewrong?Ialsodontseetherequestonthe
server(john,Impostingthequestionhereforotheruserssake)

36.

rockerswitchsays:
December11,2013at1:58am
Ihaveanexcitedsyntheticattentionpertainingtodetailandmayforeseeproblemsbeforethey
willtake
place.

JohnBoxallsays:
December11,2013at7:03am
Youshouldprobablyseeadoctoraboutthat.

Trackbacks/Pingbacks

Visittronixlabs.com
HelpingyoumakeitwithAustralia'sbestvalueforsupportedhobbyistelectronicsfromadafruit,
DFRobot,Freetronics,SeeedStudioandmore!

Subscribeviaemail
Receivenotificationsofnewpostsbyemail.
EmailAddress
Subscribe

Searchthesite

Search

tronixstuffforum
Whynotjoinourmoderateddiscussionforum?

ArduinoTutorials
ClickforDetailedChapterIndex
Chapters01234
Chapters566a78
Chapters910111213
Ch.14XBee
Ch.15RFIDRDM630
Ch.15aRFIDID20
Ch.16Ethernet
Ch.17GPSEM406A
Ch.18RGBmatrixawaitingupdate
Ch.19GPSMediaTek3329
Ch.20I2CbuspartI
Ch.21I2CbuspartII
Ch.22AREFpin
Ch.23Touchscreen
Ch.24MonochromeLCD
Ch.25Analogbuttons
Ch.26GSMSM5100Uno
Ch.27GSMSM5100Mega
Ch.28ColourLCD
Ch.29TFTLCDtouchscreen
Ch.30Arduino+twitter
Ch.31InbuiltEEPROM
Ch.32Infraredcontrol
Ch.33ControlACviaSMS
Ch.34SPIbuspartI
Ch.35Videoout
Ch.36SPIbuspartII
Ch.37Timingwithmillis()
Ch.38ThermalPrinter
Ch.39NXPSAA1064
Ch.40Pushwheelswitches
Ch.40aWheelswitchesII
Ch.41MoredigitalI/O
Ch.42Numerickeypads
Ch.43PortManipulationUno
Ch.44ATtiny+Arduino
Ch.45UltrasonicSensor
Ch.46Analog+buttonsII
Ch.47Internetcontrolledrelays
Ch.48MSGEQ7SpectrumAnalyzer
FirstlookArduinoDue
Ch.49KTMS1201LCDmodules
Ch.50ILI9325colourTFTLCDmodules

Ch.51MC14489LEDdisplaydriverIC
Ch.52NXPPCF8591ADC/DACIC
Ch.53TIADS111016bitADCIC
Ch.54NXPPCF8563RTC
Ch.55GSMSIM900
Ch.56MAX7219LEDdriverIC
Ch.57TITLC5940LEDdriverIC
Ch.58SerialPCF8574LCDBackpacks
Ch.59L298MotorControl
Ch.60DS1307andDS3231RTCpartI
ArduinoYntutorials
pcDuinotutorials

AustralianElectronics!
BuyandsupportSiliconChipAustralia'sonlyElectronicsMagazine.

InterestingSites
AmazingArduinoShieldDirectory
DavidL.Jones'eevblog
SiliconChipmagazineAlwaysagreatread!
TalkingElectronics
DangerousPrototypes
TheAmpHourpodcast
Superhouse.tvHightechhomerenovation

Useofourcontent

tronixstuff.combyJohnBoxallislicensedunderaCreativeCommonsAttributionNonCommercial
ShareAlike4.0InternationalLicense.

Das könnte Ihnen auch gefallen