Home Automation System


Overview

        I designed a home automation system to control the lights and temperature in my room using a netduino microcontroller. One of the main strengths of this system is its ability to turn on the lights and AC (or heat) in my room as I enter my house. The system can also be controlled using a webserver which allows the user to see the various connected devices (lights, AC, heating, temperature) and their status. In order to further simplify life for the user, the system can also be accessed through RF remote controls or by using the buttons on the base-station. The base-station has an LCD display and RGB LED to give the user information about the status of the various devices.


Technical Details

        In order to sense whether I am at home or not, I look to see whether my cell phone is connected to the wifi network. In order to do this, I use a Raspberry Pi to check my home router’s connected devices page to see whether my cell phone is actively connected. The Raspberry Pi then sends an http request to the netduino to let it know whether the cell phone is present or not. This http request is interpreted by the webserver and the automation system uses this information to determine whether the user is arriving, present, or away from home.

        The webserver is also used to interface with the connected devices such as the lights, AC, and heat and to see their status. It also displays the current temperature and allows the user to change the desired temperature. The webserver is secured by using a specific URL to access the home automation system. Without knowing the complete URL, the webserver will not respond to the request. Furthermore, in my setup, the webserver is on the local network. In order to access it remotely, a VPN into the local network is needed. My Raspberry Pi also runs an OpenVPN server, which allows me to remotely control my home automation system. (Please see useful links section below for more information on setting up an OpenVPN on the Raspberry Pi).

        The system can also be accessed locally using either the RF remote controls or by using buttons on the base-station. An LCD display on the base-station will alter between showing the date and time and temperature settings. In order to accurately show the time, the system checks a NTP time server at startup to obtain the exact time. An RGB LED on the base-station also shows a visual indication of whether the actual room temperature is above or below the desired temperature.

        Since the system uses a lot of different modules, multi-threading is used to keep each task separate. This allows the rest of the system to continue functioning even if one the threads crash. The various threads in the system are: the main thread which starts up the program, a webserver thread, a thread to check whether buttons had been pressed on the base-station, a thread to update the LCD display and RGB LED, and a thread to check whether the lights, AC, or heat should be on or off.


The Hardware

        I use a Netduino Plus 2 as the brains of my home automation system. The netduino is in charge of running the automation system as well as providing a webserver. The Raspberry Pi used in this setup is only used to check to see whether the phone is connected to the network. It should possible to check for the presence of the phone in the network using only the netduino, but this was causing reliability issues so this function was ported to the Raspberry Pi.

        In order for the RF remote control to work, an RF receiver is located in the base-station. The netduino reads the result from the RF receiver or buttons on the base-station to respond to the user using the LCD and RGB LED. Then the lights, AC, and heat are switched on and off using relays that are wired to the base-station. Future versions of this project will include wireless relays to extend the range of this system outside of my dorm room.


Useful Links


Figure 1: Home Automation Base-Station

Figure 2: Control Page from Webserver


Copyright © Victor Ansart 2014