In this article I will discus a device that can switch on/off any home appliance like fan, lights, fridges etc upon receiving commands from any remote mobile phone. The device is made using a PIC18F4520 microcontroller chip, an LCD to show various messages to the user, a GSM Module and few relays to switch AC 230V loads. GSM module accepts a SIM card (like a normal mobile phone) and provide GSM connectivity to embedded system thus enabling them to send and receive SMSs. Since it accepts a SIM card, it gets its own mobile number where you can send commands. Our device accepts only two commands :-
- ON command: ON x (where x can be 1,2,3 or 4 example ON 2 will switch on load number 2)
- OFF command: OFF x (where x can be 1,2,3 or 4 example OFF 2 will switch off load number 2)
On successful operation the system will respond with a success message as show below.
If command is not understood by the system, it will send appropriate reply using SMS.
Block diagram of the system
The block diagram show below will help you easily understand the major parts of the system.
Fabrication of the Project
Since this project is based around the 40 pin PIC18F4520 MCU, we have chosen a development board for 40 PIN PIC MCU which has an built-in LCD module. This will make the prototyping very rapid and less prone to errors and save you from frustration. All we need to do is to connect GSM module to this board, which is a very simple task of just connecting three pins from the GSM module to the main board. For this we have used single pin f/f burg wires. The image below points out the connectors and their connections with GSM module and LEDs.
The images below makes clear the various parts of GSM module and location of important connectors like RX and TX.
Connection of load status indicator LEDs are made clear from the image shown below. The resistors on the board acts as a current limiting resistors for the LEDs.
The whole setup looks like this
Please use a SIM card which has free memory for SMS, SIM cards have very limited space for message storage, so please delete some of the messages from it while it is in your mobile phone. Otherwise the system wont be able to receive SMSs.
About the program
The program is written in C language and is compiled using the XC8 compiler which is available free of cost from Microchip (company behind PIC microcontrollers). MPLAB X IDE is used for project creation and management tool.
The program makes uses of the LCD library and the SIM300 Modem library to the interfacing. In the main program we use high level functions to control the LCD and the Modem.
The program starts by initializing various systems like LCD, GSM Modem i/o ports for relay driving. Then it does some vital checks on the system like if the modem is connected and responding properly, SIM card is properly installed on the modem and has free space for new message and if the modem is connected to the GSM network or not. If the system finds any problem, it informs the user about it so that he/she can make required corrections to get the system up and running.
We cordially thanks the following peoples who shared this page on various social networks and insprided us to develop more quality contents!
Andre Swartz, Sumesh, Amir Hamza Khan, ZN, Percival, Jedd, Sethupathi, Danialb, Munlaiji, Achala, Dawd Fekadu, Bernard , Uttam, Mahdi, KEN, Vinay, Lingesh Nanban, , Ajit, John Aung Khant, Jagjit Singh, SEUN, Dickson, Opeyemi Oluwaseun, Manoj,