SMS Based Device Control using GSM Modem

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

Home appliances controlling using mobile phone
Click on the image for enlarged view

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.

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.

25 thoughts on “SMS Based Device Control using GSM Modem

  1. which type of relay is been used in gsm based device controlling project… what is its coil resistance n how can we connect a water level sensor to it….

  2. hi,i already made payment to your account for the GSM based control device source code,but didn’t receive any reply from you yet.Please send it to me as soon possible,i need to summit my project soon.Thank you

  3. hai .
    thanks a lot for your valuable assistance. our project was successfully completed.
    once again thanks team circuit gallery…

  4. sir, I want a project about new idea ; that is the automatic mobile silent mode using electronic circuit that means if we entering into a room if that place is mobike sound rectricted area so an electronic device or circuit is placed at the door top side for automatic silent using wifi or bluetooth so please help me about this project…in detailed..please
    iam a daily user of your site…..

  5. may I get all the components of this circuit in the market?
    If I want to buy it what aill be the cist of this project??

  6. Can u please revise a method for payment to people leaving outside India,,,the system is very awesome and I need it for my final year project,can I please have the program code…thankz in advance

  7. Hi
    Your all information really wow the mind.
    Please I want to know to convert ATmega32 micro-controller to PIC16F628A micro-controller… If possible I want to know how
    Thank you

  8. Hello sir
    I already purchased your code on aug 2015. But i have some doubt.Pl let me know which gsm modem you have used in the project ie sim300 or sim900 or we can use both. I have used sim 300 but it is not receiving the sms. Display is showing WAITING FOR SMS. Also pl send the exact form of sms to be send to make the device ON/OFF. Also tell me if their is any password or registration for the mobile through which the sms should be send. Pl reply as soon as possible.Pl help me to solve my problem. I have programmed the PIC with the PIK KIT2 Programmer to the HEX file sent by you to my Email.

  9. Hi
    Thanks for ur assistance.
    My project is succesfully completed and is working 100%
    Team circuits gallery are doing good job
    Again a very thanks and good wishes to Team Gallery

Leave a Reply

Your email address will not be published. Required fields are marked *