Вы находитесь на странице: 1из 38

2/26/2015

GSM,GPS|alselectro

alselectro
AllaboutMicrocontrollers,TipsonPc,Androidphone,Electronics

GSMHandlingReceivedSMS
Filedunder:GSM,GPSLeaveacomment
September19,2013
ThispostisintendedtoillustratethereceivedSMSbyaGSMmodulelikeSIM900.ATcommands
tohandlethereceivedSMSareexplainedindetail.
WeshalluseaSIM900moduleonRS232breakoutboard&anUSBUARTconverterboardto
connectittothePC.
FollowingisthesetuptotestreceivedSMSusingSIM900.

AterminalsoftwarelikePUTTYisusedtoreadouttheCOMportwhereGSMisconnectedtoPC
throughUSBUARTboard.

AsyouconnecttheUSBUARTboardtoPC,thePCallotsaCOMportwhichcanbeseenunder

https://alselectro.wordpress.com/category/gsmgps/

1/38

2/26/2015

GSM,GPS|alselectro

AsyouconnecttheUSBUARTboardtoPC,thePCallotsaCOMportwhichcanbeseenunder
Devicemanager.OpenthePUTTYterminal&setthistoreadtheserialport.

OpenthePuttyterminal&typeinAT.Ifyourmodemsettings&connectionsarefineyougetan
OKresponsefromthemodem.
PreferredStorageArea

ToselecttheStorageareaforSMStypein
AT+CPMScommand.ThissetsthePreferredMessageStoragearea.
ToknowtheMessageareassupportedbyourGSM,entertheATcommand
AT+CPMS=?

https://alselectro.wordpress.com/category/gsmgps/

2/38

2/26/2015

GSM,GPS|alselectro

Asseenabove,ourmodemreturnsall3messagestorageareasasSM,whichreferstothe
MessagestorageareaontheSIMcard.
ThefirstSMspecifiesthemessagestorageareathatwillbeusedwhileReadingorDeletingSMS.
ThesecondSMspecifiestheareathatwillbeusedwhensendingSMSfrommessagestorageor
writingSMStostorage.
ThethirdSMspecifiesthepreferredmessagestorageareaforstoringnewlyreceivedSMS.
Inourcase,SMisthepreferredstorageareaforallSMSfunctions,Read,Send&Receive.
TheotherstorageareasareME(storageareaonGSMModem/Mobilephone),MT(readfromall
storageareaassociatedwithGSM),BM(incomingBroadcastmessagestoragearea),SR(status
report)&TA(Terminaladapter)

ToknowtheSMSServicecenteraddress(SMSC)
AT+CSCA?
Themobilenetworkoperatorsservicecenternumberwillbedisplayed.

Thenumber145in+CSCAistheaddresstype.145referstoInternationalnumberstartingwith+.
SMSModes

ThenextATcommand
AT+CSMS=?
reportstheSMSmodessupportedbytheGSM.0isforTextmode&1isforProtocolDataUnit
(PDU)mode.Ourmodemreports(0,1)supportingbothSMSmodes.
https://alselectro.wordpress.com/category/gsmgps/

3/38

2/26/2015

GSM,GPS|alselectro

Tocheckifyourmodemsupportsthetextmode,youcantrythefollowingcommand:
AT+CMGF=1
IfthemodemrespondswithOKthistextmodeissupported.Itispossibletosendonlysimple
textmessagesinthismode.
Toknowthecurrentmessageformatusethecommand
AT+CMGF?

ReadingMessagesfromStorageArea

ToreadmessagesfromSIMstoragetypein
AT+CPMS=SM

TheModemrespondswith+CPMS:followedbyUsedspace&Maximumspace.
Inourmodemtherearecurrently2messagesinmemory(usedspace)&maximumstorage
capacityisfor30messages.
TolistoutallmessagesintheSMstoragetypein
AT+CMGL=ALL
Themodemrespondswithalistofallmessagesinthestoragearea.

https://alselectro.wordpress.com/category/gsmgps/

4/38

2/26/2015

GSM,GPS|alselectro

+CMGL:1istheMemoryIndexnumberusedtoreadordeletemessage
RECREADisthestatusmessage.IfthemessageisnotReaditshowsRECUNREAD
+91xxxisthephonenumberfromwherethemessageoriginated.
,Nextcolumnisthereferencenumberofthemessage.Generallythisfieldisempty.
13/09/19istheDate&timeofreceivedSMSinyy/mm/dd,hh:mm:ssformat
Finallytheactualmessageintextformatisdisplayed.

Tolistoutaparticularmessage,usetheCMGRcommandwiththeindexnumberofthemessage
toberead.
AT+CMGR=2tolistthemessageatindex2
AT+CMGR=4tolistthemessageatindex4

https://alselectro.wordpress.com/category/gsmgps/

5/38

2/26/2015

GSM,GPS|alselectro

DeletingMessages

TodeleteamessageuseCMGDcommandwiththeindexnumberofmessagetobedeleted.
AT+CMGD=1todeletethemessageatindex1.

YoucanissuethecommandAT+CMGL=ALLtoseethatthemessageatindex1isdeleted.
TodeleteallthemessagesinthestorageareathereisnosuchcommandlikeAT+CMGD=ALL.
Usethefollowingnotationtodeleteallmessages.
AT+CMGD=1,4
1istheIndexvalue&4istheflagvalue
Toknowtheindex&flagvaluesallowed
AT+CMGD=?
https://alselectro.wordpress.com/category/gsmgps/

6/38

2/26/2015

GSM,GPS|alselectro

1to30canbeassignedtoindexparameter&allfiveflagvaluesfrom0to4aresupported.
Bydefaultflagvalueis0whichmeansDeletemessageatlocation<index>
Flagvalue1DeleteallREADmessages,ignoringvalueofindex.
Flagvalue2DeleteallREAD&SENDmessages.
Flagvalue3DeleteallRead,Sent&Unsentmessages.
Flagvalue4Deleteallmessages.

YoucanseefromabovescreenshotthatallmessagesaredeletedafterissuingAT+CMGD=1,4.

AT+CNMINewmessageindicationtoTerminalEquipmentTE.
SelectsprocedurehowreceivingofnewmessagesfromthenetworkisindicatedtotheTE.
ThefollowingcommandsetstheindicatorsforreceivinganSMSmessage.

AT+CNMI=1,1,0,0,0Setthenewmessageindicators.
AT+CNMI=<mode>,<mt>,<bm>,<ds>,<bfr>

<mode>=1discardunsolicitedresultcodesindicationwhenTATElinkisreserved.
https://alselectro.wordpress.com/category/gsmgps/

7/38

2/26/2015

GSM,GPS|alselectro

=2controlsprocessingofunsolicitedresultcodes&forwardthemdirectlytoTerminalEquipment
TE

<mt>=1SMSDELIVERsaredeliveredtotheSIMandroutedusingunsolicitedcode.
<bm>=0nocellbroadcastmessageindicationsareroutedtotheTE.

<ds>=0noSMSSTATUSREPORTsarerouted.

<bfr>=0TerminalAdapter(TA)bufferofunsolicitedresultcodesdefinedwithinthiscommandis
flushedtotheTE(Terminalequipment).

ThefollowingcommandsavestheSMSsettings.OncetheSMScommandshavebeensaved,the
initializationcommandsdonotneedtobesentagainuntiltheyarechanged.

AT+CSAS
toSaveSMSsettings.Thismaytakeupto10seconds.

Watchthissupportvideo:

https://alselectro.wordpress.com/category/gsmgps/

8/38

2/26/2015

GSM,GPS|alselectro

HandlingReceivedSMSwithSIM900GSM
Tags:GSMReceivingSMS

Comment

GPSReceiverModulePart2
Filedunder:GSM,GPSLeaveacomment
https://alselectro.wordpress.com/category/gsmgps/

9/38

2/26/2015

GSM,GPS|alselectro

March14,2013

Part1GPStheoryhere

SKYTRAQGPS634Module

TherearenumerousGPSmodulesavailableinthemarket.
Inthispost,IamgoingtouseGPS634RmodulemanufacturedbySKYTRAQ,aTaiwanbased
leadingGPSChipsetmanufacturer.
GPS634RisahighlyintegratedsmartGPSmodulewithaceramicGPSpatchantenna.The
antennaisconnectedtothemoduleviaanLNALowNoiseAmplifier.
Themoduleiswith51channelacquisitionengineand14channeltrackengine,whichbecapable
ofreceivingsignalsfromupto65GPSsatellitesandtransferringthemintothepreciseposition
andtiminginformationthatcanbereadovereitherUARTportorRS232serialport.
BothoftheLVTTLlevelandRS232signalinterfaceareprovidedontheinterfaceconnector,
supplyvoltis3.6to6vDC.ThemodulecanbeusedwithyourDesktopPC,Laptop,ora
microcontroller.ItsupportstheNMEA0183protocol,asdomanyGPSmodules.

WearegoingtostartbyconnectingthemoduletoourPCusinganEvaluationBoardshown
below:
Thisboardwillallowyoutouseastandard12vACadapteranda9pinSerialcabletoconnectthe
GPSmoduletoyourPCorLaptop.InLaptopsyoudonthaveaSerialport.MakeuseofanUSBto
UARTboardtoconnecttoUSBport.
https://alselectro.wordpress.com/category/gsmgps/

10/38

2/26/2015

GSM,GPS|alselectro

WeshalluseaboardmadebyNSKElectronics,whichusesaCP2102SiiconLabsUSBUARTIC,
areliableone.
ConnecttheGPSmoduletothebreakoutboard.Onlyweneed3wiresVcc(pin1),GND(pin2)&
theTX(SerialDataout).TheTXwireshouldbeconnectedtoRxpinontheboard.
The9pinDconnectorofthebreakoutboardisconnectedtotheUSBUARTconverterusinga
Serialcable(straightonenotcross).TheUSBconnectorofUSBUARTboardisthenconnectedto
theLaptopusingaABUSBcable.
Providea12vDCadaptertothebreakoutboard.ThepowerLEDwillglow.
AtthebottomoftheGPSModuleastatusLEDglows.ThisLEDglowsstill(alwaysOn)inNonFix
mode&startsblinkingoncetheGPSmoduleisoutdoorandhasstartedtracking.
WeshallmakeuseofaTerminalSoftwareCOOLTERMtoreadouttheCOMportwhereGPSis
connected.

OpenuptheDeviceManager&notedowntheportnumberallottedtotheUSBUARTboard.

https://alselectro.wordpress.com/category/gsmgps/

11/38

2/26/2015

GSM,GPS|alselectro

NowopentheTerminalsoftwareCOOTERM.Youcandownloadithere
ClickonOptions&thenunderSerialportselecttheportallottedtoyourUSBUARTboardas
seenintheDeviceManager.TheothersettingsareBaudRate9600,DataBits8,ParityNone
&StopBits1(96008N1).

https://alselectro.wordpress.com/category/gsmgps/

12/38

2/26/2015

GSM,GPS|alselectro

IfyouclickCONNECTbuttonyoucanseeyourGPSinaction&NMEASentencesflyingout.

https://alselectro.wordpress.com/category/gsmgps/

13/38

2/26/2015

GSM,GPS|alselectro

https://alselectro.wordpress.com/category/gsmgps/

14/38

2/26/2015

GSM,GPS|alselectro

The$GPRMCSentenceisthemostusefuloneandcontainsthepositionfix.

$GPRMC,054006.999,A,1059.8519,N,07657.4794,E,000.0,166.0,120313,,,A*66
GPisthePrefixforGPSfollowedbyRMCwhichisRecommendedMinimumSentence.
AlldataareseparatedbyCommas.
054006.999isthecurrenttimeinGreenwichMeanTime(notyourlocaltime).Inthisexampleitis
05Hours40Minutes06Seconds&.999MilliSeconds.
NextistheSTATUSCODE:AmeansActive&GPSHASGOTAfix.VmeansVoidorData
Invalid
Next4piecesofDataareGeoLocationData.
1059.8519,N>Latitude10Degrees,59.8519decimalminutesNORTH
07657.4794,E>Longitude76Degrees,57.4794decimalminutesEAST.
https://alselectro.wordpress.com/category/gsmgps/

15/38

2/26/2015

GSM,GPS|alselectro

NextDataisGroundSpeedinKnots.InthisexampleImindoor&notmoving.Soitis000.0
NextDataisTrackingAngle166.0
NextDataistheDATEofFIX120313means12thofMarch,2013
Next2commasindicateEmptyfield.OneisforTimeinsecssincelastDGPSupdated&theother
isDGPSstationIDnumber.Inthisexamplebothfieldsareempty.
Finallyachecksumdataispresentedwhichstartswithan*symbolfollowedby2Hexdigits.

NowweshalluseaGPSSTUDIOSoftwarecalledTRIMBLEtoviewtheMAP.
DownloadTRIMBLEGPSSTUDIOfromhere
http://trl.trimble.com/dscgi/ds.py/Get/File484972/TrimbleStudio.exe

ClickDisconnectintheCOOLTERMwindowtoclosetheport.
StartupTRIMBLESTUDIO
IfWindowsFirewallblocksTrimble,clickAllowAccesstostartTRIMBLE.
UnderNewConnectionSelecttheportCOM6(allottedtoUSBUART).

https://alselectro.wordpress.com/category/gsmgps/

16/38

2/26/2015

GSM,GPS|alselectro

InthenextwindowselecttheBaudRateas9600,ParityNone,DataBits8,&StopBits1

ClickOK.
NowyoucanseetheindividualdatalikeLatitude,Longitude,Date,Time,etc..areextractedfrom
theNMEAsentences&displayedintheirrespectiveboxes.
ToseetheNMEAsentencesclickMonitor>ViewRAWData.
ToviewtheMAPclickonMapbuttonattherighttopoftheMonitorscreen.
ThepositionoftheGPSisseenasaRedDot.ToseeSatelliteorTerrainViewsyoucanclickonthe
respectivebuttons.
IftheGPSisfixedinaCar,theReddotwillmoveonthemapfollowingthemovementoftheCar.

https://alselectro.wordpress.com/category/gsmgps/

17/38

2/26/2015

GSM,GPS|alselectro

NowletustaketheGPSsetupintoaCar.

Thisisthewholesetupwearetakingintoacar.
A9VbatteryisenoughtopoweruptheGPSmodule.TheGPSmoduleisconnectedtoLaptop
usinganUSBUARTboard.TrimbleStudioisstartedandtheCOMportofUSBUARTboardis
enteredintotheportsettingsofTrimbleStudio.
https://alselectro.wordpress.com/category/gsmgps/

18/38

2/26/2015

GSM,GPS|alselectro

TheGPSModuleisplacedatthefrontofDashBoardtogetaclearskyview.ARelianceDatacard
isusedforprovidingInternetconnectivity.
BelowisthescreenshotoftheMapplottedaccordingtothemovementoftheCar.

Watchthisvideo:

https://alselectro.wordpress.com/category/gsmgps/

19/38

2/26/2015

GSM,GPS|alselectro

GPSMODULESKYTRAQ634Testing&plottingMAP

ForavailabilityofthisGPSmodule&breakoutboardcontact:

https://alselectro.wordpress.com/category/gsmgps/

20/38

2/26/2015

GSM,GPS|alselectro

Tags:GPSMODULE

Comment

GPSReceiverModulePart1
Filedunder:GSM,GPS,UncategorizedLeaveacomment
March13,2013

InthisseriesofpostsIshalldemonstratetheusageofGPSReceivermodule.Ishallmakeitin3
parts.
1.FirstpartexplainsthetheoryofGPS&makeyouunderstandtheJargons/Specificationsused
inGPStechnology.
2.InSecondpartIshallshowyouhowtointerfaceaGPSmoduletoyourPC&readtheNMEA
SentencesusingaTerminalSoftwareCOOLTERM&aGPSTRIMBLESTUDIOsoftware.A
supportVideogivesyouabetterunderstanding.
3.ThirdpartexplainshowtointerfaceaGPSwithArduino
LetusstartwithfirstpartofGPStheory:

https://alselectro.wordpress.com/category/gsmgps/

21/38

2/26/2015

GSM,GPS|alselectro

TheGlobalPositioningSystem(GPS),isasatellitebasedradionavigationsystemownedbythe
UnitedStatesGovernmentandoperatedbytheUnitedStatesAirForce.GPSisfundedand
controlledbytheU.S.DepartmentofDefense(DOD).
TheoutstandingperformanceofGPSoverdecadeshasearnedtheconfidenceofmillionsofcivil
andmilitaryusersworldwide.
GlobalPositioningSystem(GPS)moduleisusedtogetPosition,Altitude,aswellasSpeed,Date&
TimeonUTC.
ItusesthestandardNMEAprotocol(NationalMarineElectronicsAssociation)totransmitthe
positiondataviaserialport.
GPSprovidesspeciallycodedsatellitesignalsthatcanbeprocessedinaGPSreceiver,enabling
thereceivertocomputeposition,velocityandtime.ForanyonewithaGPSreceiver,thesystem
willprovidelocationandtime.GPSprovidesaccuratelocationandtimeinformationforan
unlimitednumberofpeopleinallweather,dayandnight,anywhereintheworld.
GPSsystemcomprisesof3segments:SPACE,CONTROL&USERSEGMENTS.

SPACESegment(SS)CONTROL(CS)USERSEGMENT(US)

TheSpaceSegmentofthesystemconsistsoftheGPSsatellites.TheseSpaceVehicles(SVs)send
radiosignalsfromspace.ThenominalGPSOperationalConstellationconsistsof24satellitesthat
orbittheearthin12hours.
GPSsatellitestransmittwolowpowerradiosignals,designatedL1andL2.CivilianGPSusesthe
L1frequencyof1575.42MHzintheUHFband.L2(1.2276GHz)isusedinMilitary.TheL1
carrierismodulatedwiththeCoarse/Acquisition(C/A)codeandNavigationMessage,usedfor
PPSandSPS,andthemilitaryPcode,usedforPPSonly.TheL2carrierismodulatedonlywith
themilitaryPcode.
TheGPSsystemprovidestwonavigationalservices,themilitaryPrecisePositioningService(PPS),
andthecivilianStandardPositioningService(SPS).
The24satellitesthatmakeuptheGPSspacesegmentareorbitingtheearthabout12,000miles
aboveus.Theyareconstantlymoving,makingtwocompleteorbitsinlessthan24hours.These
satellitesaretravellingatspeedsofroughly7,000milesanhour.
https://alselectro.wordpress.com/category/gsmgps/

22/38

2/26/2015

GSM,GPS|alselectro

GPSsatellitesarepoweredbysolarenergy&theyhavebackupbatteriesonboard.
TheControlSegmentconsistsofasystemoftrackingstationslocatedaroundtheworld.The
MasterControlfacilityislocatedatSCHRIEVERAFB(AirForceBase)inColorado.

TheMasterControlstationuploadsephemerisandclockdatatotheSVs.TheSVsthensend
subsetsoftheorbitalephemerisdatatoGPSreceiversoverradiosignals.
TheGPSUserSegmentconsistsoftheGPSreceiversandtheusercommunity.GPSreceivers
convertSVsignalsintoposition,velocity,andtimeestimates.Foursatellitesarerequiredto
computethefourdimensionsofX,Y,Z(position)andTime.

Eachsatellitecontinuallytransmitsmessagesthatinclude
Thetimethemessagewastransmitted
Preciseorbitalinformation(theephemeris)
ThegeneralsystemhealthandroughorbitsofallGPSsatellites(thealmanac).

AGPSreceivermustbelockedontothesignalofatleastthreeofthe24satellitestocalculatea2D
position(latitudeandlongitude)andtrackmovement.
Withfourormoresatellitesinview,thereceivercandeterminetheusers3Dposition(latitude,
longitudeandaltitude).Oncetheuserspositionhasbeendetermined,theGPSunitcancalculate
otherinformation,suchasspeed,bearing,track,tripdistance,distancetodestination,sunriseand
sunsettimeandmore
GPSReceiversgiveoutputdataasstandardASCIItextateither4800baudor9600baudandcan
beeasilyreadbytheserialportonanymicrocontroller.

Developments
https://alselectro.wordpress.com/category/gsmgps/

23/38

2/26/2015

GSM,GPS|alselectro

GPSsatellitesnowonorbitareagingquicklyandusersaredemandingmorecapability.To
sustainandmodernizetheconstellation,theU.S.AirForceisbuildingthenextgenerationsatellite
system,knownasGPSIII.
IndianRegionalNavigationalSatelliteSystem(IRNSS1)isunderdevelopmentautonomously
byISRO&willlaunchsevensatellitesfornavigation.Fullconstellationisplannedtoberealized
around2014.
TheChinesehavealreadylaunchedTheBeiDouNavigationSatelliteSystem(BDS).
SpecificationTermsExplained:
AnimportantspecificationistheUPDATERATE,whichindicatesHowoftentheGPSrecalculates
&reportsitsposition.Thestandardis1HZ,i.e.,onlyoncepersecond.5&even10HZupdaterates
areavailable.FasterUpdateRatemeanstherewillbemoreNMEAsentenceflyingoutofthe
module.
NextspecificationistheNumberOfChannels.
ThenumberofchannelsthatyourmodulerunswillaffectyourtimetofirstFix.Sincethemodules
doesntknowwhichsatellitesareinview,themorechannelsyouhave,thefasteryoullfindafix.
12or14channelstrackenginewillworkjustfinefortracking.
Thesatellites(SVs)broadcasttwotypesofdata,AlmanacandEphemeris.Almanacdataiscourse
orbitalparametersforallSVs.EachSVbroadcastsAlmanacdataforallSVs.ThisAlmanacdatais
notverypreciseandisconsideredvalidforuptoseveralmonths.
EphemerisdataisverypreciseorbitalandclockcorrectionforeachSVandisnecessaryforprecise
positioning.EachSVbroadcastsONLYitsownEphemerisdata.Thevalidityofthisdatais
dictatedbytheparticularsatelliteandmaybevalidupto4to6hours.Eachsetofephemerisdata
givesafitindicationwhichtellshowlongtheparticularEphemerisdataisvalid.TheEphemeris
dataisbroadcastbyeachSVevery30secondssoGPSreceivershavefrequentopportunitiesto
receiveandlogthisessentialinformation.
IfyoulookupthespecificationofanyGPSmodule,youcomeacrosstermslikeColdStart,Hot
Start&WarmStart.
ColdStartisperformedeverytimewhentheGPSmoduleisturnedoffwithoutbackuppower
supplyconnected.Itisthelongeststartingtimeoutofthethreeandusuallytakes35secondsin
averageunderopenskyenvironment.DuringColdStart,almanacandephemerisdatahastobe
downloadedfirstfromtheGPSsatellitestoGPSmodulebeforeapositionfixcanbeacquired.
Assumingthataproperbackuppowersourceisprovided,GPSmodulewillperformHotStartif
theGPSmoduleispoweredonanytimewithinthe2hourtimeframeafterGPSwaspreviously
turnedoff,astheephemerisandalmanacdataisstillstoredinsidetheitsflashmemory.

WarmStartisperformediftheabovemoduleisstartedafterthe2hourtimeframe,aspartofits24/38

https://alselectro.wordpress.com/category/gsmgps/

2/26/2015

GSM,GPS|alselectro

WarmStartisperformediftheabovemoduleisstartedafterthe2hourtimeframe,aspartofits
satellitedatahastoberefreshed.

NMEA
TheGPSreceiveroutputsdatainNationalMarineElectronicsAssociation(NMEA)format.The
ideaofNMEAistosendalineofdatacalledaSENTENCE.
Thestandardsentenceshaveatwoletterprefixthatdefinesthedevicethatusesthatsentence
type.ForGPSreceiverstheprefixisGP,whichisfollowedbyathreelettersequencethatdefines
thesentencecontents.
InadditionNMEApermitshardwaremanufacturestodefinetheirownproprietarysentencesfor
whateverpurposetheyseefit.AllproprietarysentencesbeginwiththeletterPandarefollowed
with3lettersthatidentifiesthemanufacturercontrollingthatsentence.ForexampleaGarmin
sentencewouldstartwithPGRMandMagellanwouldbeginwithPMGN.
Eachsentencebeginswitha$andendswithacarriagereturn/linefeedsequenceandcanbeno
longerthan80charactersofvisibletext(plusthelineterminators).Thedataiscontainedwithin
thissinglelinewithdataitemsseparatedbycommas.
ThedataitselfisjustASCIItextandmayextendovermultiplesentencesincertainspecialized
instancesbutisnormallyfullycontainedinonevariablelengthsentence.Thedatamayvaryinthe
amountofprecisioncontainedinthemessage.Forexampletimemightbeindicatedtodecimal
partsofasecondorlocationmaybeshowwith3oreven4digitsafterthedecimalpoint.
Programsthatreadthedatashouldonlyusethecommastodeterminethefieldboundariesand
notdependoncolumnpositions.Thereisaprovisionforachecksumattheendofeachsentence
whichmayormaynotbecheckedbytheunitthatreadsthedata.Thechecksumfieldconsistsofa
*andtwohexdigitsrepresentingan8bitexclusiveORofallcharactersbetween,the$and*.

$GPRMCNMEASentence

The$GPRMCSentenceisthemostusefuloneandcontainsthepositionfix.Anexampleis
$GPRMC,054006.999,A,1059.8519,N,07657.4794,E,000.0,166.0,120313,,,A*66
GPisthePrefixforGPSfollowedbyRMCwhichisRecommendedMinimumSentence.
AlldataareseparatedbyCommas.
054006.999isthecurrenttimeinGreenwichMeanTime(notyourlocaltime).Inthisexampleitis
05Hours40Minutes06Seconds&.999MilliSeconds.
https://alselectro.wordpress.com/category/gsmgps/

25/38

2/26/2015

GSM,GPS|alselectro

NextistheSTATUSCODE:AmeansActive&GPSHASGOTAfix.VmeansVoidorData
Invalid
Next4piecesofDataareGeoLocationData.
1059.8519,N>Latitude10Degrees,59.8519decimalminutesNORTH
07657.4794,E>Longitude76Degrees,57.4794decimalminutesEAST.
NextDataisGroundSpeedinKnots.InthisexampleImindoor&notmoving.Soitis000.0
NextDataisTrackingAngle166.0
NextDataistheDATEofFIX120313means12thofMarch,2013
Next2commasindicateEmptyfield.OneisforTimeinsecssincelastDGPSupdated&theother
isDGPSstationIDnumber.Inthisexamplebothfieldsareempty.
Finallyachecksumdataispresentedwhichstartswithan*symbolfollowedby2Hexdigits.
Otherimportantsentencesare
GPGGA,whichprovidesthecurrentFIXdata
GPGSAOverallSatellitestatusData,3D,2DFixdetails&PRN(satellitesareidentifiedbythe
receiverbymeansofPseudoRandomNumbers.)
GPGSVDetailedSatelliteData
GPVTGVectorTrackonspeedovertheGround.
GPRTERouteMessage
FormoredetailsofNMEASentencesvisit
http://www.gpsinformation.org/dale/nmea.htm
Comment

ARDUINOwithGSM
Filedunder:ARDUINO,GSM,GPS24Comments
February7,2013

InthisworkshopweshallseehowtocontrolaGSMboardwithARDUINO
https://alselectro.wordpress.com/category/gsmgps/

26/38

2/26/2015

GSM,GPS|alselectro

Hardwarerequired:
ARDUINOUNOboardGSM300or900board
12vDCadapterforGSMboardConnectingwires

Theconnectionissimple.WeshallusetheHardwareSerialportofARDUINO(pin0&pin1).
Pin0(RX)ofArduinoisconnectedtoRXpinofGSM
Pin1(TX)ofArduinoisconnectedtoTXpinofGSM
GeneralRuleisalwaysTXtoRx&RxtoTx.ButtheGSMboardImusinghasaMAX232level
converterIC&theTx,RxprintedonboardisthatofMAX232sT1IN&R1OUT.
Donotgetconfused.Alwaysensurethat
RxofArduino(pin0)goestopin11(T1IN)ofMax232
TxofArduino(pin1)goestopin12(R1OUT)ofMax232.
AsweuseTTLlevellogicweneednotbotheraboutthepresenceof232IC.
DonotpowertheGSMfromArduino.Useaseparateadapterofminimum1Amprating.
MakeGNDpinsofbothGSM&Arduinocommon.
https://alselectro.wordpress.com/category/gsmgps/

27/38

2/26/2015

GSM,GPS|alselectro

TostartwithplaceavalidSIMtotheholderontheGSMboard.Connectthepoweradapterto
GSM.
NowdialacallfromanotherphonetotheSIMnumber&ensurethatyougetaRingbacktone.
ThisistheinitialtesttoconfirmthatyourGSMisreadytoacceptcommandsfromArduino.

MakingaCallfromGSM

FirstweshallseehowtoDialanumber.
WemakeuseofATcommandstocontrolaGSM.
HerearetheStepsyoudoformakingacall
1.WakeupGSMbygivingATcommand.
2.DialanumberusingcommandATDphone_no;ATDfollowedbyphonenumber&a
Semicolon.
3.Nowthecallismade.TohangthecallfeedATHcommand.
Theabovestepsareconvertedtocodeasbelow:

//CodeforDiallinganumber
charphone_no[]=9443303461;
voidsetup()
{
Serial.begin(9600);//OpenSerialConnectionatbaudrate9600
delay(2000);
Serial.println(AT);//WakeupGSM
Serial.print(ATD);//DialthephonenumberusingATDcommand
Serial.print(phone_no);
Serial.println(;);//Semicolonisamustattheend
https://alselectro.wordpress.com/category/gsmgps/

28/38

2/26/2015

GSM,GPS|alselectro

delay(10000);
Serial.println(ATH);//Afteradelayof5secsHangthecall
}
voidloop()
{
//emptyloop.Ifyouentertheabovecodehere,thecallwillbemadeFOREVERrepeatedly.
//TakeCautionwhilecodingunderloop.AtsomeconditionyouvetoterminatetheCall
}

PleasenotethatyouvetodisconnectGSMfromArduinowhileUploadingthecodetoArduino
.
WhileissuingATHcommanduseSerial.println&notSerial.print.ThisprintlnistosendCarriage
ReturnaftertheATHcommand.NotethereasonableamountofDelay(10secs)usedafterissuing
theATDcommand.
ThisdelayismandatoryforGSMtorespond.

SendingSMSfromGSM

NowweshallseetheproceduretosendSMSthroughGSM.
1.WakeupGSMbysendingATcommand
2.TheGSMshouldbeputonTextmodebyfeedingcommandAT+CMGF=1
3.NowgivecommandAT+CMGS=Mobile_number
https://alselectro.wordpress.com/category/gsmgps/

29/38

2/26/2015

GSM,GPS|alselectro

4.VerifywhethertheModemrespondswitha>character
5.Aftergetting>symbol,feedyourMessagetoSMS.
6.PressCTRL+ZtosendtheSMS.
TheabovestepsarecodedforArduinotohandleautomatically

//CodetosendSMSfromArduino
inttimesTosend=1;
intcount=0;
charphone_no[]=9443303461;//phonenumber
voidsetup()
{
Serial.begin(9600);//OpenSerialconnectionatbaud9600
delay(2000);
Serial.println(AT+CMGF=1);//setGSMtotextmode
delay(200);
}
voidloop()
{
while(count<timesTosend){
delay(1500);
Serial.print(AT+CMGS=\);
Serial.print(phone_no);
Serial.println(\);
while(Serial.read()!=>);
{
Serial.print(TestMessagefromArduinoGSM.HELLO..!!!);//SMSbody
delay(500);
Serial.write(0x1A);//sendsctrl+zendofmessage
Serial.write(0x0D);//CarriageReturninHex
Serial.write(0x0A);//LinefeedinHex
//The0D0Apairofcharactersisthesignalfortheendofalineandbeginningofanother.
delay(5000);
}
count++;
}
}

https://alselectro.wordpress.com/category/gsmgps/

30/38

2/26/2015

GSM,GPS|alselectro

FeedtheabovecodeinArduinoIDE&uploadit.DonotforgettoDisconnectGSMfromArduino
whileuploadingthecode.
Ifyoucopy&pastetheabovecode,youmaygetcompileerror.Typeinthecodewherevererroris
indicated.
NotetheusageofHexcodes0x1Aforsendingctrl+z
0x0DforCarriageReturn&0x0AforLineFeed.
WatchthisVideoonmakingaCall&SendingSMSusingArduino&GSM:

https://alselectro.wordpress.com/category/gsmgps/

31/38

2/26/2015

GSM,GPS|alselectro

SendingSMSthroughArduino&GSM

TheGSM&ARDUINOboardsareavailableat:

Tags:ArduinowithGSM,ControlGSMwithARDUINO

Comment

GSMTutorial
Filedunder:GSM,GPS,MicroControllers1Comment
January16,2012
InthistutorialIshalldemonstratetheusageofGSMboardtosendSMS.

https://alselectro.wordpress.com/category/gsmgps/

32/38

2/26/2015

GSM,GPS|alselectro

Materialsrequiredforthisworkshopare:
Hardware:
1.GSMModuleBoardwithanactiveSIMcard.
2.12VDC1AadapterforGSMpowersupply.
3.USBUARTconverterwithRS232straightcableandUSBcable.
Software:
1.SerialCommunicationsoftwarePuTTY.Downloaditfrom
http://putty.en.softonic.com/
oryoucanusetheinbuiltHyperTerminalsoftwareincaseyourPCsOSisXP.Itislocatedin
Programs>Accessories>Communication.
WhileusingHyperterminalrememberthefollowingsettings:
UnderFile>Properties>SettingsclickASCIIsetupandcheckmarkEchotypedcharacters
locally.Otherwiseyoucantseewhatyoutype.
AnothersoftwareisTerminalfromhttp://realterm.sourceforge.net/.Terminalisasimple
serialportterminalemulationprogram.
IprefertousePuTTYasitistroublefreestandaloneprogramandresponseisfasterthanothers.
TostartwithinserttheSIMcardintotheholderatthebackoftheboard.
Connectthe12vDCsupplytotheboard.ConnecttheboardtoyourPCsserialportusingaRS232
cable.IncaseyouusetheUSBport,thenaUSBUARTboardisrequired.
https://alselectro.wordpress.com/category/gsmgps/

33/38

2/26/2015

GSM,GPS|alselectro

USBtoUARTboard
AssoonasyouconnecttheDCpowertotheboard,thegreenPowerLEDglowsandthenthered
SignalLEDflashesintermittently.NowmakeacalltotheSIMnumberinsertedintheboard.You
canheartheringbacktoneinthecallerphoneandtheRinggreenLEDflashesaccordingtothe
Ring.NowyourGSMboardisreadytocommunicate.
NowopentheControlpanel>DeviceManagerofyourPCandexpandthePorts(COM&LPT)to
verifytheportconnection.IfyouareusingaRS232cabledirectlytoPC,itwillbeCOM1.Elseit
willbedifferent(inourcaseitisCOM6).

DoubleclickthedownloadedPuTTY.
EnterCOM6underseriallineandbaudrate9600underSpeed.
SelectconnectiontypeasSerial.Provideanameandsavethesession.
https://alselectro.wordpress.com/category/gsmgps/

34/38

2/26/2015

GSM,GPS|alselectro

NowselectthesavedsessionandclickOpentofireuptheTERMINAL.
FortheterminaltocommunicatewiththeGSMboardATcommandsareused.
ATisabbreviationofATtention.ThereareBasicandExtendedATcommands.BasicATcommandsdo
notstartwitha+likeATD,ATA,ATH,
ExtendedATcommandsstartwith+.AllGSMATcommandsareextendedcommands.e.g
AT+CMGS,AT+CMGR,AT+CMGF,
TostartwithtypeAT(uppercasepreferred)andhitEnter.
GSMboardwillrespondwithOK.
TypeAT+CPIN?andhitentertoknowwhetherSIMisinserted.
TodialanumbertypeATD9001234567;
ATDfollowedbythemobilenumber&thenaSEMICOLON.HitentertomakeaCall.Todisconnect
typeATH.
TosendSMStypeAT+CMGF=1
ModemconfirmswithOKthatitchangestoTextmode.
ThentypeAT+CMGS=mobile.no
Afterthe>symboltypeyourmessageandpressctrl+ztosendtheSMS.
https://alselectro.wordpress.com/category/gsmgps/

35/38

2/26/2015

GSM,GPS|alselectro

ForamoredetailedtutorialofSMSandATcommandsvisit
http://www.developershome.com/sms
FollowingaresomeofthemostfrequentlyusedATcommands:
AT+CGMITogetthemanufacturersID
AT+CMGF=1SwitchtotextmodebeforesendingSMS
AT+CMGS=mobile.noSendSMSaftertypingthemessage&pressingctrl+z
ATD999xxx1234;Dialtothemobilenumberprovided
ATHDisconnectthecall
AT+CMSSSendSMSfromstorage
https://alselectro.wordpress.com/category/gsmgps/

36/38

2/26/2015

GSM,GPS|alselectro

AT+CMGRReadoneSMSatatime
AT+CMGD=1DeleteaMessage.
AT+CMGL=ALLReadallSMSmessagesinthestoragearea
AT+CMGLListSMSmessages
AT+CSCA?ToknowtheservicecenteraddressofGSMprovider
TosendSMStomultiplenumbersyouhavetowritemessagetomemoryandthenuseCMSS
commandmanytimes.Hereistheprocedure:
AT+CMGF=1enableTextmode
OK
AT+CMGW=9443312345CMGWwritesmessagetoMemory
>TestMessage<ctrl+z>
GSMrespondsas+CMGW:3OKwhere3istheindexnumberspecifyingthelocationofSMS
message.
AT+CMSS=3,NEXT_MOBILE_NO.useCMSStosendmessagefromStorage.
AT+CMSS=3,New_Mobile_no.
Likethisyoucanusetheindexnumberofmessageandsendittomultiplephones.
WatchthisvideoofGSMBoarddemo,usageofPuttyasTerminalandATcommandusageto
communicatewithGSM:

GSMTutorialfromSaravanaElectronics
Tags:GSM300tutorial
https://alselectro.wordpress.com/category/gsmgps/

Comment
37/38

2/26/2015

GSM,GPS|alselectro

CreateafreewebsiteorblogatWordPress.com.|TheMotionTheme.
Follow

Followalselectro
BuildawebsitewithWordPress.com

https://alselectro.wordpress.com/category/gsmgps/

38/38

Вам также может понравиться