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

3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

Student Companion
Empowering you with skills

<< SMS Home Alarm System with PIR and GSM - MikroC | 2 Reasons Search Here
Why Business Plans Are A Waste Of Time >>

Search

Interfacing GSM Modem with PIC


Microcontroller - MikroC
22. August 2014 Bitahwa Bindu Tutorials , MikroC Pro for PIC Comments (0) SelectLanguage

Poweredby Translate
Like 5 2 Tweet 0
StumbleUpon

Category list
CompanyMessaging
CompanyIMBuiltForTeams.Powerful,Safe&Secure.TryNow! Projects (18)
Flowcode Projects (1)
MBLAB X Projects (6)

http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 1/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

MikroC Projects (8)


P1 and P2 (5)
Tutorials (85)
Career Guidance (8)
Entrepreneurship (17)
Flowcode for PIC (16)
Graphical User Interface (6)
MikroC Pro for PIC (26)
MPLAB XC8 (20)

Figure1:ControllingandMonitoringdeviceswithaCellphone

AGSMmodemisawirelessmodemthatworkswithaGSMwirelessnetwork.GSM
standsforGlobalSystemforMobilecommunications,thisarchitectureisusedfor
mobilecommunicationinmostofthecountriesintheworld.

Awirelessmodemactsbasicallylikethetraditionaldialupmodem,themain
differenceisthatadialupmodemsendsandreceivesdatathroughafixed
telephonelinewhileawirelessmodemsendsandreceivesdatathroughradio
waves.Besidesthedialupconnection,GSMmodemcanalsobeusedforsending
andreceivingSMSwhichisalsooneofthekeyfeaturesofGSMmodem.

SomemodemsareGSM/GPRSmodems,thesemodemsadditionallysupportthe
GPRStechnologyfordatatransmission.GPRSstandsforGeneralPacketRadio
Service.ItisapacketswitchedtechnologythatisanextensionofGSM.Akey
advantageofGPRSoverGSMisthatGPRShasahigherdatatransmissionspeed.

http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 2/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

TheoperationofaGSMmodemrequiresaSIM(SubscriberIdentityModule)card
justlikemobilephonestoidentifyasubscribertothecellularnetworkandtostore
thesubscriberinformation.AlsotheyhaveIMEI(InternationalMobileEquipment
Identity)numbersimilartomobilephonesfortheiridentification.

Applications
THERE WILL BE HATERS
Remote System Monitoring:Inaremotesystemmonitoringapplication,a
Microcontrollerforexamplecouldbeusedtoconstantlymonitorthestatusof
aremotesensors,letsaytemperatureormoisturesensors.Ifacertain
conditionisreached,theprogramwillsendanSMStonotifythesituation,if
thesesensorsareinstalledinafarmforexample,thefarmercouldbe
notifiedofanysituationhappeninginthefarmaboutheat,moisture,drought,
etc.
HomeAlarmSystem:Whenamotionsensordetectsamovementofan
intruder,anSMSwillbesenttoapredefinednumberwhichcouldbeyouor
yoursecurityreactioncompanyandasirenoranyothersounddevicecould
betriggeredintheprocessaswell.
RemoteControllingSystem:AmobilephonecanbeusedtoSendanSMS
toswitchON/OFFremotedevices.Youcouldcontrolyourentirehome
devices,switchingON/OFFlights,fans,poolmotor,garagemotorandsoon
withjustasimpleSMSfromadistance.
SecurityAccessControl:Asecurityaccesscanbeimplementedat
apartmentsorhousingcomplexes.Asecurityguardcouldinformbyintercom
Hover to Expand

aresidentifhe/shehasavisitoratthemaingate.witharepliedSMS,the
residentcouldopenremotelythegateforhis/hervisitor.
Vehicletracking:AGSM/GPRSmoduletogetherwithaGPSmodulecanbe

http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 3/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

usedtocreatearealtimevehicletrackingdevice.AnSMScouldalsobe
Quote of the day
senttonotifythatthecarhasenteredarestrictedarea,notifyaboutthelevel
ofremainingfuelinthecaretc.Ifthevehicleisstolennotonlythesystem
"Quality is more important
canindicatethelocationofthevehiclebutanSMScouldalsobesentto
than quantity. One home run
switchOFFtheengine.
is much better than two
SMSGateway:TosendandreceiveSMSforadvertisements.
doubles"
PrepaidElectricity:Thecustomercanrechargeprepaidelectricityby
Steve Jobs
sendinganSMSwitharechargecoupontoaprepaidelectricityrecharge
server.
Recent Posts
SendSMSPIC16F877AGPRSModuleInterfacing

What Makes an Entrepreneur


GSMConnection
Successful?

ItisveryeasytointerfaceaGSMModemtoaPICMicrocontrollerasmostGSM How to Get Your Ideas to


modemshaveaserialinterface.TheUSARTserialinputpinRXandTXofthe Spread
microcontrollerareconnectedtotheTXDandRXDpinsoftheGSMModem.Some Digital Thermometer -
GSMmodemshavePCMCIATypeIIorUSBinterfaces.Figure2belowshowsa Flowcode
blockdiagramofaGSMmoduleconnectedtoUSARTmoduleofaPIC 10 Golden Rules for Interviews
Microcontroller. What Really Kills
Entrepreneurs In South Africa?

How to Start a Business That
Changes Things?

Top Posts

(44) Top 20 Job Interview


http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 4/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

Questions and Best Answers


(27) Interfacing LCD Display
With PIC Microcontroller -
XC8
(27) Automatic Temperature
Control System using PIC
Microcontroller - MikroC
(22) Analog to Digital
Converter in PIC
Microcontroller - XC8
(20) Interfacing GSM Modem
with PIC Microcontroller -
MikroC
Figure2:GSMmoduleconnectedtoaPICMicrocontroller (19) Interfacing SD Card With
HOME ARCHIVE CONTACT ABOUT US
PIC Microcontroller - MikroC
>>>TolearnmoreonSerialCommunication:PIC Microcontroller

Communication with RS232 Bus


Comments Summary
ThereareGSMboardonthemarketthatonecanusetoquicklyinterfacetoaPIC.
TheSmartGM862BoardfromMikroelekronikaisoneexampleofmanyboards.The
People
SmartGM862isafullfeatureddevelopmenttoolforTelitGM862QUAD
Recent
GSM/GPRSmoduleortheGM862GPSversion.ItfeaturesGM862module
Popular
connector,voltageregulator,antennaholders,speakerandmicrophonescrew
terminalsandmore.DIPswitchisprovidedforconfiguringUARTcommunication Top Commenters
2 lineswiththetargetmicrocontroller.Itcanbeconnectedtodevelopmentboardsvia
IDC10connector.


Student
http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 5/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

0 Companion
45 posts
Tweet

keshena
15 posts

Nam Trung
Dang
13 posts
Figure3:ConnectingtheSmartGM862BoardtoEasyPIC7V7
DevelopmentBoard

GSMCommands joynal
10 posts
TheATcommandsareusedtocontrolmodemswhicharecommunicatedthrough
serialcommunicationwithamicrocontrolleroraPC.ATistheabbreviationfor
ATtention.ThesecommandscomefromHayescommandsthatwereusedbythe
Hayessmartmodemsinlate1970s.TheHayescommandsstartedwithATto Post Tags
indicatetheattentionfromtheMODEMfollowedbyanumberofcharacters
specifyingthecommandtail.
7-Segment ADC C#

ATcommandswithaGSM/GPRSMODEMormobilephonecanbeusedtocheck Career guidance CV


themodemsettings,tochangethemodemsettings,toissuescommandsliketo
Digital Thermometer DS1307
sendanSMS,readanSMSandsoon.

http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 6/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

BelowisashortlistofcommonlyusedgeneralpurposeATcommands.The Entrepreneurship Ethernet


commandshouldbefollowedbyacarriagereturn:
Flowcode Flowcode V5

ATI:Modemproductinformation Goals GSM GUI IC


ATE0:Disableechosothatcharacterstypedbytheuserarenotechoed
Interfacing Job Keypad LCD
backbythemodem.
LED LM35
ATE1:Enabletheechomode
AT+CMGF:SelectSMSmessageformat Microcontroller MikroC
AT+CMGS:SendSMSmessage
MPLAB X
AT+CMGR:ReadSMSmessage
Open a new business
Formoreinfo,youcancheckyourmodemdatasheetortheATCommands
ReferenceGuide
P1 and P2 PIC
PIC Communication Projects
SendinganSMS Relay RS232 RTC SD Card

SendinganSMSfromamicrocontrollerisveryeasy,justfollowthesefewsteps, Success Switch Tutorials


thePIC18F45K22isusedintheseexamplesbutanyotherPICwithaserialmodule USB Wealth XC8
andenoughmemorycouldalsobeusedsuccessfully.

Step1:AT Newsletter
Thefirstcommandistosend"AT"thenenterifyouareusingacomputerorfroma
microcontroller,weshouldsendtheASCIIvalueforENTERwhichis0xDinHex. Subscribers 881
Thepurposeofthiscommandistotestthemicrocontrollerandwaitforaresponse Get notified when a new post
whichshouldbe:OK.Thiscommandcanbeusedtonegotiatethebaudrate,so is published.
thattheGSMmodulecansetitselftothesamebaudrateofthemicrocontroller.
Enter your e-mail
Tonegotiatebaudrate,sendATinawhile(1)loopuntilOKisreceived,thenyou

http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 7/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

canproceedwithothercommands.TomakethingssimpleristosendATthenwait
forashortdelay,thenproceedasitexpectedthatOKshouldhavebeenreceivedin
thatshortdelay. Notify me

//
//Negotiatebaudrate
UART1_Write_Text("AT");//Send"AT"stringthenwaitforasho Join our facebook fan
rtdelay
UART_Write(0x0D);//TerminatationbyCR(ASCIIvalueofEnter page
inHex)
Delay_ms(100);//100milliseconddelay

Step2:AT0

Disableechosothatcharacterssentbythemicrocontrollerarenotechoedbackby
themodem

//
//Disablecommandecho
UART1_Write_Text("AT0");//Send"AT0"todisableechomode
UART_Write(0x0D);//TerminatationbyCR(ASCIIvalueofEnter
inHex)
Delay_ms(100);//100milliseconddelay

Step3:AT+CMGF=1

TherearetwomodesofsendingandreceivingSMSmessageswithATCommands:
TheTextmodeandthePDU(ProtocolDescriptionUnit)mode.InPDUmode,
theSMSissentinaseriesofhexadecimalstringofcharacters,atthereceivingend
thesehexadecimalstringofcharactershavetobedecodedtoextractthemessage
inareadableformat.InTextmode,theSMSissentlikethenormalSMSweare
usedtowithourcellphones.Thetextmessagecanconsistofalphanumeric

http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 8/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

characterswithupto160characterslongwith7bitcodinganduptp140chaacters
in8bitcoding.

TosetthemodetoText,theATcommandis:AT+CMGF=1andtosetthemodeto
PDUthecommandis:AT+CMGF=0

//
//SetmessagetypeasTEXT
UART1_Write_Text("AT+CMGF=1");//Send"AT+CMGF=1"stringtose
tSMSmodetoTEXT
UART_Write(0x0D);//TerminatationbyCR(ASCIIvalueofEnter
inHex)
Delay_ms(100);//100milliseconddelay

Step4:AT+CMGS="0123456789"+theTextmessage

Settherecipientmobilephonenumberandthetextmessagetobesent.Afterthe
AT+CMGS="0123456789"command(Replacethe0123456789withacorrect
recipientcellphonenumber),themodemwillrespondwiththecharacter">",after
receivingthis">"thenthetextmessagecanbeentered,tomakethingssimpler,we
aregoingtousedagainashortdelayinsteadofwaitingforthe">".Attheendof
themessage,"CntrlZ"mustbeenteredtosendthemessage."CntrlZ"ASCII
valueis0x1AinHex.Letussend"HelloWorld"SMSto0123456789number.

//
//Sendmessage
UART1_Write_Text("AT+CMGS=\"0123456789\"");//Sendmessagetoc
ellnumber:0123456789(Enteryourcellphonenumberinsteadof
0123456789)
UART_Write(0x0D);//TerminatationbyCR(ASCIIvalueofEnte
rinHex)
UART1_Write_Text("HelloWorld");//Send"Helloworld"Textmessa

http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 9/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

ge
UART_Write(0x1A);//Cntrl+Z(0x1AASCIIvalueofCntrl+Zin
Hex)
UART_Write(0x0D);//TerminatationbyCR(ASCIIvalueofEnter
inHex)

A quick little survey. SCRUTINEER

1 I am interested in the Cricket World


Cup
Strongly agree
Agree
Neither agree nor disagree
Disagree
Strongly disagree

Privacy

Thatall!!!
Intheaboveexample,itisassumedthattheSMSservicecenternumberhas
alreadybeenprogrammedtotheSIMCard(Thisisnormallydonewithyournetwork
providerwhenanewSIMcardispurchased).TheATCommandtosettheSMS
servicecenternumberis:AT+CSCA

ItisalsoassumedthattheSIMcardhasnosecurityPINnumberassociatedwithit,
iftheSIMhasaPINnumber,usetheATcommandAT+CPINtoenterthePIN
number.

http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 10/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC

SendSMStoPhone
GSMGPRSModem
Interfacing

Tags: GSM , Interfacing , PIC , Microcontroller , Tutorials , MikroC

Related posts
Interfacing GSM Modem with PIC Microcontroller - XC8
A GSM modem is a wireless modem that works with a GSM wireless net

GSM Based Temperature Data Logger with PIC Microcontroller -


MikroC
In this project, The ambient Temperature is read every Hour then sent to

Microcontroller Interfacing - Advanced


Microcontrollers have become very useful in embedded design as they c

3Comments StudentCompanion Login

SortbyNewest Recommend Share

Jointhediscussion
http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 11/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC
Jointhediscussion

VineethCherupalathIllam 3daysago
Sircanutellhowtosendmessagewithuartdata?
i.eineedtosendgpsdatawhichisrecievedthroughhardware
uarttogsmwhichisconnectedtothesoftwareuart..
iusepic16f877a,soonlyoneuartisthere..henceioptsoftuart..
kindlyhelpme
Reply Share

StudentCompanion Mod >VineethCherupalathIllam


3daysago

Hi,ThisishowyousenddatawithSoftwareUART:
charsome_byte=0x0A
...
//WriteabyteviaSoftUART
Soft_UART_Write(some_byte)

Tolearnmore,pleasevisitthislink:
http://www.mikroe.com/download...
Reply Share

VineethCherupalathIllam>Student
Companion 3daysago
Hi,iknowitisthereinmikroChelp...btcantproceed
withtheexample,thatswhyi'mquering......
Reply Share

ALSOONSTUDENTCOMPANION WHAT'STHIS?

InterfacingLCDDisplayWith PICMicrocontrollerInterrupts
PICMicrocontrollerXC8 XC8
18commentsayearago 6comments6monthsago
http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 12/13
3/6/2015 StudentCompanion|InterfacingGSMModemwithPICMicrocontrollerMikroC
18commentsayearago 6comments6monthsago
AlejandroVlezHenao StudentCompanionThanks
Hello,thanksforthetutorialsI
includedthexlcd.hlibrarybuti
getthiserror"error:(500)
undefined
InterfacingLCDDisplay AnalogtoDigitalConverterin
Flowcode PICMicrocontrollerXC8
1commentayearago 2commentsayearago
keshenaGreattutorial. StudentCompanionYouare
thanxguys welcome!

blog comments powered by Disqus

Copyright 2015Student Companion SA all rights reserved Log in

http://www.studentcompanion.co.za/post/InterfacingGSMModemwithPICMicrocontrollerMikroC 13/13

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