In this article, we are publishing a highly useful home application – GSM based home automation using Arduino. The project consists of a 16×2 LCD module for displaying the status of the home appliances. The status (turn ON or turn OFF) of the connected devices can be changed by sending an SMS from your mobile phone. Upon receiving SMS commands through GSM module, arduino will change the status (turn ON/OFF) of the device that is mentioned in the SMS.

Objectives of the Project

Send/Monitor the status of the connected devices to a specified mobile number using GSM.

Change the status (turn ON/OFF) of the device upon receiving commands through SMS.

Display status of the devices in an LCD using a 16×2 LCD module.

Note: – For demonstration purpose, we are using 3 LED’s to represent 3 different devices. We have also connected a 12Volt dc motor as a 4th device. You can replace these LED’s with actual electrical light bulbs, devices like motor, fan, TV, refrigerator etc. You should use an appropriate supporting circuit to interface these devices to the circuit diagram given below.

Let’s begin to build our project – GSM Based Home Automation Using Arduino.

Circuit Diagram – Home Automation using Arduino

Assemble the circuit as shown in diagram! Important connections are explained below.

Here we are using SIM900 GSM module. The communication between GSM module and arduino is serial. The problem with this connection is that, while programming Arduino uses serial ports to load the program from the Arduino IDE. If these pins are used in wiring, the program will not be loaded successfully to Arduino. So you have to disconnect wiring in Rx and Tx each time you burn the program to Arduino. Once the program is loaded successfully, you can reconnect these pins and have the system working.

To avoid this difficulty, I am using an alternate method in which two digital pins of Arduino are used for serial communication. We need to select two PWM enabled pins of Arduino for this method. So I choose pins 9 and 10 (which are PWM enabled pins). This method is made possible with the SoftwareSerial Library of Ardunio. SoftwareSerial is a library of Arduino which enables serial data communication through other digital pins of Arduino. The library replicates hardware functions and handles the task of serial communication. This will help the programmer to use hardware serial pins for debugging purpose.

Another section of the circuit is the interfacing of Arduino to 16×2 LCD. JHD162A is the LCD module used here. JHD162A is a 16×2 LCD module based on the HD44780 driver from Hitachi. The JHD162A has 16 pins and can be operated in 4-bit mode (using only 4 data lines) or 8-bit mode (using all 8 data lines). Here we are using the LCD module in 4-bit mode. To facilitate communication between Arduino and LCD module, we make use of a built-in library in Arduino <LiquidCrystal.h> – which is written for LCD modules making use of the Hitachi HD44780 chipset (or a compatible chipset).

In order to demonstrate the working of the home appliances, and awe are using three LED bulbs and a DC motor. These are connected to A0- A3 pins of Arand amicro buzzer is connected to A4. The buzzer will produce a beep sound upon receiving a valid SMS. Here we are using a 12V DC motor, which can’t be driven directly from Arduino board (arduino has very limited current capabilities). So a BC547 transistor is used here to drive the DC motor.

The program continuously checks the availability of serial data from GSM module. When a new message arrives, GSM module will pass it to the controller by using software serial method. The controller will decode the command from the arrived data and store it in a string variable named “incomingString”. The decoding is done by simply taking the string that comes between the characters ‘*’ and ‘#’. The sender must send all the commands in between these characters for getting a proper response from the controller. The “incomingString” variable is then compared with the saved strings(for eg. “B1ON”) by using an inbuilt function in Arduino ( incomingString.equals(“B1ON”); ). If the output of this function is true, then the status of the device mentioned in the message will be altered accordingly.

We can check the status of all devices from anywhere in the world by simply sending the word “*STATUS#”. When the controller receives the word, it will send the status of all the connected devices to a specified mobile number. A user-defined function namely “send_deviceStatus()” is declared in the program for doing this. Upon receiving the keyword, the program will call this function. The necessary AT commands for configuring GSM module were written in it along with the mobile number.

Nice, but i am unable to understand the coding. i want to make a project in which if i send light on through sms then led should on and if i send light off then led should off. i am using sim900a gsm module kindly send me code.

commands that alter the device status are set during the programming time.it is known only by the programmer.So in that way it is already secure. You increase it by making the device respond only to the messages from a particular number. This can be acheive by adding a few more steps .Firt you must store that num inside a string variable. Then compare it with the num from wich the command received.