Microcontroller › PIC › HOME AUTOMATION USING GSM WITH PIC16f877a
- This topic has 33 replies, 10 voices, and was last updated 8 years, 10 months ago by sreeja devashisa.
-
AuthorPosts
-
January 24, 2013 at 9:11 am #9042nidhin.kParticipant
hai maxwell…
u will get circuit and code from this site…..
all the best
January 26, 2013 at 10:38 am #9061AmyParticipanthi nidgin.k,, can i ask where is the command that says that the PIC already recieved the SMS from the phone?? also where is the command in the program were in the GSM modem decodes the SMS? thank you very much )
January 26, 2013 at 10:38 am #9062AmyParticipanthi nidkin.k,, can i ask where is the command that says that the PIC already recieved the SMS from the phone?? also where is the command in the program were in the GSM modem decodes the SMS? thank you very much )
January 28, 2013 at 4:58 am #9071nidhin.kParticipanthi amy….
u must studied the AT commands for gsm modem.
AT+CNMI=2,2,0,0,0 /* this command is for receiving the msg and delete. */
u can give AT+CMGR=1 for reading the msg…. but it will save in sim memory….
using AT+CNMI=2,2,0,0,0… it will read and delete the msg..
the received msg will stored in RCREG register…..
January 30, 2013 at 7:20 am #9078AmyParticipantnidhin.k thank you again.. you’ve been so helpful in our project.. i have another question.. can i directly connect the GSM’s rx and tx to my PIC(PIC16f877a). i will not use rs232.. thank you again
January 30, 2013 at 7:43 am #9079nidhin.kParticipanthai amy….
u can connect…
GSM TX pin (5V) to PIC RX pin
GSM RX pin (5V) to PIC TX pin
and connect a common ground….
all the best….
January 30, 2013 at 11:46 am #9081AmyParticipantthank you again nidhin.k.. our project is like this only the phone that we will use will be notify that the command has been executed.. in that command we will use AT+CMGS??
January 31, 2013 at 5:58 am #9083nidhin.kParticipanthai amy….
i think, in your project u r just receiving the msg and on/off the appliances…
so there is no need for AT+CMGS.
if u need confirmation sms… u can use AT+CMGS command
all the best…
February 5, 2013 at 9:39 am #9096AmyParticipanthi sir nidhin. k,, can i ask if we will connect the GSM modem to the PIC16f877a without a computer, will we use RS232?? thank you
February 5, 2013 at 12:29 pm #9098nidhin.kParticipanthai AMY….
for interfaceing GSM and PIC16F877A, there is no need for RS232, u can directly connected,
GSM TX(5V)- PIC RX pin
GSM RX(5V)- PIC TX pin
RS232 is used for interfacing PC and serial devices( GSM, RFID, BLUETOOTH,GPS,etc,.)
all the best…
February 6, 2013 at 6:57 am #9101AmyParticipanthi i’ve been tying to create a new program but it’s not working properly in proteus… i used PROTON IDE.. basic language THANK YOU AGAIN
‘****************************************************************
‘Home Automation controlled by Android Mobile Phones
‘****************************************************************
Device 16F877A ‘define device used
Declare Xtal = 4 ‘define oscillator used
‘****************************************************************
‘define configuration word bits
Declare Reminders OFF
Config XT_OSC,WDT_OFF,PWRTE_ON,BODEN_OFF,LVP_OFF,CP_OFF,DEBUG_OFF
Declare Reminders On
‘****************************************************************
‘assign values to serial communication
Hserial_Baud = 9600 ‘set BAUD rate to 9600 BAUD
Hserial_Clear = On
‘****************************************************************‘set port assignments 1-input ; 0-output
TRISB = %00000000 ‘set all PORTB as outputs
TRISA = 0
TRISC = 0
‘****************************************************************
‘microcontroller declarations
RCSTA = $90 ‘ 10010000 Enable serial port & continuous receive
TXSTA = $24 ‘ 00100100 Enable transmit, BRGH = 1
‘SPBRG = 25 ‘ 9600 Baud @ 4MHz, 0.16%
ADCON1 = 7 ‘disables ADC
CMCON = 7 ‘disables Comparators
T1CON = $01 ‘00000001, 1:1 prescale value, enable TMR1
PIR1.0 = 0 ‘must be cleared: TMR1 overflow interrupt flag bit
PIE1 = $01 ‘enable TMR1 overflow interrupt
‘****************************************************************
‘program constants
‘assigned string values will be used instead of actual port assignments
‘for more convenient programming
Symbol app1 = PORTB.0
Symbol app2 = PORTB.1
Symbol app3 = PORTB.2
Symbol app4 = PORTB.3
Symbol app5 = PORTB.4
Symbol app6 = PORTB.5
Symbol app7 = PORTB.6
Symbol app8 = PORTB.7
Symbol mnum = 09157003397
‘****************************************************************
‘program variables
‘variables for global time
Dim SMS As Byte
‘Str mnum = “09157003397”,0
Clear ‘clear all RAM contents at startup
‘****************************************************************
‘initialize comm to GSM Module
gsm:
HSerOut [“AT”] ‘start serial communication
‘HSerIn 5000,sms ‘wait for GSM Module response OK
HSerOut [“AT+CFUN=1”]
DelayMS 2000
HSerOut [“AT+CMGF=1”] ‘set text mode
DelayMS 2000
HSerOut [“AT+CNMI=1,1,0,0,0”]
DelayMS 2000
‘****************************************************************
main:
While 1
HSerIn 5000,
HSerOut[“AT+CMGR=”,SMS]
DelayMS 2000
‘Hserin [“+CMGR”,SMS]
GoSub execute
‘GoSub deleteSMS
Wend
‘****************************************************************
execute:
If SMS = 10 Then
PORTB.0 = 1
GoSub replyOnSMS
EndIf
If SMS = 11 Then
PORTB.1 = 1
GoSub replyOnSMS
EndIf
If SMS = 12 Then
PORTB.2 = 1
GoSub replyOnSMS
EndIf
If SMS = 13 Then
PORTB.3 = 1
GoSub replyOnSMS
EndIf
If SMS = 14 Then
PORTB.4 = 1
GoSub replyOnSMS
EndIf
If SMS = 15 Then
PORTB.5 = 1
GoSub replyOnSMS
EndIf
If SMS = 16 Then
PORTB.6 = 1
GoSub replyOnSMS
EndIf
If SMS = 17 Then
PORTB.7 = 1
GoSub replyOnSMS
EndIf
If SMS = 21 Then
PORTB.1 = 0
GoSub replyOffSMS
EndIf
If SMS = 22 Then
PORTB.2 = 0
GoSub replyOffSMS
EndIf
If SMS = 23 Then
PORTB.3 = 0
GoSub replyOffSMS
EndIf
If SMS = 24 Then
PORTB.4 = 0
GoSub replyOffSMS
EndIf
If SMS = 25 Then
PORTB.5 = 0
GoSub replyOffSMS
EndIf
If SMS = 26 Then
PORTB.6 = 0
GoSub replyOffSMS
EndIf
If SMS = 27 Then
PORTB.7 = 0
GoSub replyOffSMS
EndIf
‘***************************************************************
End
‘***************************************************************
‘subroutines
deleteSMS:
HSerOut [“AT”]
DelayMS 2000
HSerOut [“AT+CMGD=”,SMS]
DelayMS 2000
Return
‘***************************************************************
replyOnSMS:
HSerOut [“AT”]
DelayMS 2000
HSerOut [“AT+CMGS=”,mnum]
‘ Write = Your appliance is ON
DelayMS 2000
Return
‘***************************************************************
replyOffSMS:
HSerOut [“AT”]
DelayMS 2000
HSerOut [“AT+CMGS=”,mnum]
‘ Write = Your appliance is OFF
DelayMS 2000
Return
‘***************************************************************December 4, 2013 at 5:42 pm #10695EhsanParticipanthello nidhin.k bhai… thanx 4 this code … can u plz upload the schematic and proteus diagram of this project
i will be very thank full to you.. plzzzzzzzzzzzzzDecember 31, 2013 at 9:12 pm #10807faisal zulfiqarParticipantI am doing a project of home automation using pic microcontroller.can u send me protoues simualtion and code for this.
January 22, 2014 at 2:06 am #10876OluwaseyiParticipantHi, pls my project topic is gsm based home automation. I need u to tell me all the components I wil use apart from PIC16f877A. That is the only component that I just got. Pls I seriously need your assistance. God will help you too
January 22, 2014 at 2:35 am #10878OluwaseyiParticipantHi, pls I just wanna start this project as my final year project and i’m given just 2 months to implement it. Pls what are the components that I will use including the kind of phone to use. My supervisor said I should not use LCD. I’m a nigerian. pls help me out. I need the complete circuit diagram
-
AuthorPosts
- You must be logged in to reply to this topic.