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
- 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 is skipped and takes line1 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) 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.
PIC microcontroller program code
The project program codes can be found in our Embedded Program Store. Please have a look and request for SMS based device control using GSM Modem Program.