Relay and SIM808 GSM/GPRS/GPS Modem based SMS Controlled Wireless Home Automation System with Auto and Status Reply using ATmega32
In this project, we will learn how to make a Relay and SIM808 GSM/GPRS/GPS Modem based SMS Controlled Wireless Home Automation System with Auto and Status Reply using AVR ATmega32 Microcontroller. Here, we will control home appliances i.e 2 bulbs and 2 fans wirelessly using SIM808 GSM/GPRS/GPS modem and ATmega32 microcontroller. The home appliances are controlled by sending SMS to the SIM808 GSM/GPRS/GPS modem of the Home Automation System and the change in status of the home appliances are displayed in a 16X2 alphanumeric LCD and if the control SMS is executed successfully, then the Home Automation System sends a reply SMS bearing changed state of the home appliance as message through the SIM808 GSM/GPRS/GPS modem to notify the user that the last control SMS has been successfully executed. Also, the current status of all the home appliances can also be inquired at any instant of time by sending a predefined SMS to the SIM808 GSM/GPRS/GPS modem of the Home Automation System.
When the SIM808 GSM/GPRS/GPS modem power is turned on, the ATmega32 microcontroller reads the initial status data sent by the SIM808 GSM/GPRS/GPS modem through USART protocol. After reading the status data, the ATmega32 microcontroller processes the SIM808 GSM/GPRS/GPS modem status data and displays the status of the modem and SIM in the alphanumeric LCD. If SIM card is not present, then "Plz Insert SIM" is displayed, if SIM card is present and modem is ready, then "SIM808 is Ready" is displayed and for other conditions, "SIM808 Error" is displayed in the alphanumeric LCD.
Now, when the SIM808 GSM/GPRS/GPS modem is ready, the LCD displays "Send Ctrl SMS:" in 1st row and "All APPli. OFF " in the 2nd row(As all the appliances are in off state initially). The Home Automation System waits for the control SMS to turn On/Off the home appliances. The control SMS are predefined sets of strings(Message of SMS). The predefined set of strings(Message of SMS) to control the home appliances are shown below:-
|Home Appliance Status
|Bulb 1 On
|Bulb 1 Off
|Bulb 2 On
|Bulb 2 Off
|Fan 1 On
|Fan 1 Off
|Fan 2 On
|Fan 2 Off
|All Appliances On
|All Appliances Off
|All Appliances Status
When the SIM808 GSM/GPRS/GPS modem receives any SMS, it sends new SMS notification to the ATmega32 microcontroller. The ATmega32 microcontroller reads the new SMS notification and displays "New Ctrl SMS" in the alphanumeric LCD. But if the ATmega32 microcontroller receives some other notification(other then SMS like Call and others), then "Unknown Error" is displayed in the alphanumeric LCD. After receiving new SMS notification, the ATmega32 microcontroller will read the SMS from the SIM808 GSM/GPRS/GPS modem memory. If it reads the SMS successfully, then it will compare the content of the SMS with the predefined set of strings else it will display "Empty location" when the read memory location is empty and "Error" when there is error in reading the SMS. When the control SMS is read successfully, the ATmega32 microcontroller compares the message of the received control SMS with the predefined ones, if received control SMS matches with any of the predefined strings, then the microcontroller sends the required control signal to the Relay driver to turn On/Off the home appliance and it displays the new status of the home appliance in the alphanumeric LCD. And if the received control SMS matches with the string "STATUS", then the ATmega32 microcontroller reads the current state of all home appliances and sends the AT command to SIM808 GSM/GPRS/GPS modem to send status SMS bearing the current state of all home appliances as message to the mobile number from where the status query SMS is received. But if the received control SMS does not matches with any of the predefined SMS, then "Invalid SMS" is displayed in the alphanumeric LCD. For all control SMS received by the Home Automation System, the Home Automation System sends a reply SMS to the mobile number from where the control SMS is received through the SIM808 GSM/GPRS/GPS modem. The reply SMS contains changed state of the home appliance as message if the last SMS received is a valid control SMS and reply SMS contains "Invalid SMS" as message if last SMS received is an invalid SMS. The reply SMS is sent to notify the user about the status of the last SMS processed by the Home Automation System. The status of the SMS sending(like SMS Sending, SMS Sent) are also displayed in the alphanumeric LCD.
Now, send different SMS to the SIM808 GSM/GPRS/GPS modem of the Home Automation System and see the change in state of home appliances, check whether status and auto reply SMS are sent by the Home Automation System or not.