It has been a while since we published electronic engineering projects here due to the busy schedule we had in the past weeks, and this time weβre up with another interesting project. Before going through the details of this one, you may as well check our latest electronics projects for engineering students.
GSM based device monitoring and control system are becoming popular these days. Here I am introducing a system that will make home appliances controlling using mobile phone possible from anywhere in the world. Itβs a PIC microcontroller based system which connects with GSM module to receive SMS for the smart home control. The message is then processed by the microcontroller and output is given through PORTD of PIC microcontroller. All the devices are connected on PORTD through relay.
Also See: DTMF cell phone controlled home appliances
Home appliances controlling using mobile phone circuit
Components Required
- PIC16F877A
- GSM Module
- LCD (2X16)
- Transistor (BC548)
- Resistor (1K, 10K, 470Γ8, 10K(POT))
- Crystal (4MHz)
- Capacitor (22pfx2, 10uF)
- Push button
- LED x8
Working of the circuit
- Serial pin of PIC Microchip (RX and TX) is connected to the GSM module to control it via AT commands so as to receive SMS and set the mode.
- When the system is ON, PIC will initialize the GSM module and wait to receive SMS.
- 2Γ16 LCD display is connected to PORTB of PIC, it will display the status of the system (i.e. it will display what the system is doing).
- Initially GSM module is switched to Text mode by sending the AT command βAT+CMGF=1β. Here β1β indicates text mode and β0β is used to indicate PDU mode.
- After this setting, PIC will display that itβs waiting for SMS and will wait to receive SMS.
- The reception of SMS is detected by checking the received character; it will send all information about the SMS which starts withβ+CMTβ. Message text content will start after sendingβ\nβ and ending withβ\nβ. This is the logic I have used here to receive SMS.
- I have used an infinite loop which continuously checks if a β+β is received, followed by βCβ, βMβ and βTβ.
- Then the system understands that a massage is going to be received and waits for a $ (dollar sign), if done it will store the entire message on a buffer of size 33 named as INFO. Itβs again split and stored on two separate buffers for further processing.
- After this, PIC will display βSMS IS RECEIVEDβon first row and βDEVICE SWITCHINGβ in the second row. It also enables a buzzer for 2 seconds as an audio indication of SMS reception.
- A variable βcountβ is initiated as β1β and the received SMS information is now on the buffer named line1, the letter on line1[0] is skipped and takes line1[1] because the message for ON and OFF is sent as β$ON ABCDEFGH$β and β$OFF ABCDEFGH$β; in both cases Zeroth letter (βOβ) is common, so I skipped it.
- The fist letter indicates that the message is for ON or OFF. Here I have used two βforβ loops, one to set PORTD bits (ON the devices) and other one to reset the PORTD bits(OFF the devices).
- ON and OFF detection is done by checking the first character (line1[1]) of the message, βNβ for ON and βFβ for OFF.
- After detecting the message it will enter into the corresponding loop of SET or RESET pins. Then the relays connected to these pins activate or deactivate.
- For demonstration purposes I have used LEDs and in the circuit diagram I have mentioned how to connect relay in order to connect high current devices.
- To switch ON the devices, you may send SMS as β$ON ABC$β to ON A, B and C; β$OFF B$β to switch OFF B.
- We have designed this system to switch 8 individual devices and you can improve it through simple modification of the program and hardware.
For more detail: SMS Based Device Control using GSM Modem