Close
0%
0%

Low Cost Home Automation

A home automation solution that utilizes a Raspberry Pi server, 433MHz radios, and an Android app.

Similar projects worth following
Home automation has always been a vision of the future. Many companies make systems that cost thousands of dollars, and require complex installations into a home owners house. Our goal is to make a simple and low cost solution that can be installed and maintained by the average home owner.

Since most interactions with a Home Automation System will be from a remote location, naturally,  the best interface would be a smartphone App. But with the goal of making a system anyone is capable of installing, it was clear that all aspects from setup to management also had to be done from the App. Software development began from the beginning, setting up a network.

Working behind the scenes is an Apache Server and an MySQL database running on an inexpensive RaspberryPi computer. The server and database are simple to set up, and completely mange the Home Automation Network. Currently, our Home Automation Network can be set up by installing a few packages from the Linux repositories and moving a few files to the right directory.

Now the fun part! To begin using a new wireless module, simply plug the module into a standard wall outlet and the module will begin to power up. The wireless modules are equipped with an AVR micro controller and a radio transceiver which after a quick boot up, enable them to communicate with the Hub (RaspberryPi Server). Running on the Hub are several scripts, which make the setup and management of the wireless slave modules a breeze. In order to add an uninitialized slave module to the hub, the home owner will initiate an inquiry via the Android app. A python script running on the server scans and identifies these uninitialized modules by reading their unique wireless IDs. Once the Hub has identified a wireless module and has established communication it places this module and its identification information into an "uninitialized" table on the server. At this point the module has an established connection with the hub and can begin receiving commands.

Now this is where the user can begin to "setup" this module. From the app, the user can select to view the list of uninitialized modules stored on the server. Pulling up the list, the user can select a module by its ID and type, and provide a new user-friendly name. Once the user has entered this information, the module has been "setup" by the user and moves from the "uninitialized" table to the "nodes" table, where the user can begin interacting with the module. 


So how is data communicated between the Server, app and modules? As described above, an SQL database running on the server stores all available data associated with the modules. The database acts as a nice middle ground between the modules themselves and the user. The SQL database contains every piece of information necessary for the Hub to communicate with the modules as well as provide easy to understand information to the user. When the app requests data or send a message to the server, it is sent as a JSON Array through a PHP Post method. For those unaware, JSON is a very popular method of communicating data between networks, and is used widely across Android APIs in apps like Google Calendar. A PHP script on the server translates the message and completes the request. On the other end of the server are scripts running to monitor the modules and await commands from the user. When the user requests an action from one of the modules, a flag is set, which triggers a Python script to transmit the message, picked up from the database, to the specified module. 

I'll use an example to illustrate how all these pieces come together. Let's say the user decides they would like to switch off their Outside lights. The user opens the app and is first prompted for a passcode to access their network. Once the user has logged in, the app requests a list of available modules from the server. This list of modules contains data from the "nodes" table we mentioned earlier, and always contains the current status of all associated modules. The available data is sent back to the app as a JSON Array and is displayed to the user as a grid of various buttons. Different types of modules will of course have different functionality but since were dealing with lights lets say they simply turn on or off...

Read more »

  • 1 × Raspberry Pi
  • 2 × HC05 Bluetooth Module
  • 1 × Arduino

  • Switching to 433MHz radios

    Daniel Hankewycz08/21/2014 at 15:58 1 comment

    (07/31) After reviewing our options, the design team has placed an order for an FSK based single chip radio solution (SI4420). These radios fulfill all our previous requirements except the built in feature for data encryption. This actually works out better because now we have full control over the data encryption algorithm that we can incorporate into the microcontroller itself.  

  • Began researching alternative radio options

    Daniel Hankewycz08/21/2014 at 15:47 0 comments

    (07/28) The HC05 bluetooth radios require an overly complicated protocal to connect and disconnect that results in high latency. Due to this , we have decided it would be best to start researching alternatives technologies for our project.

    Here is a list of some of the features we are looking for.

    Read more »

  • First working module prototype

    Daniel Hankewycz08/21/2014 at 02:00 0 comments

    (07/21) Successfully built and tested a working relay based outlet module. This module uses a HC05 bluetooth module to communicate to the central hub.

View all 3 project logs

Enjoy this project?

Share

Discussions

John Loeffler wrote 08/29/2019 at 12:54 point

Like what your doing you may want to switch to the HM-10, HM-11 For 4.0 or HM-16 for 5.0 BLE.  I believe the are backward compatible.

  Are you sure? yes | no

YuanGan wrote 08/12/2019 at 13:42 point

nice work,hope it works perfectly.

  Are you sure? yes | no

mohammad1371431 wrote 08/12/2019 at 06:39 point

nice project.

If the MQTT protocol was used for communicate between mobile and rpi , it would be better.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates