Posted on 8 Comments

#12: Building an Arduino home automation controller

Control physical devices using an Arduino based home automation controller that connects to your network and lets you switch things on and off using a web browser. This episode shows the construction sequence of a controller that combines an Arduino-compatible board, Power-over-Ethernet, and relay driver shields to create a self-contained controller that can serve up its own web interface so you can click buttons in your browser to turn devices on and off.

View directly on YouTube: youtu.be/jvuvyiyVqtc

Parts Required

Assemble Hardware

As shown in the video, decide how your device will be mounted and where you want external connections such as the Ethernet cable to be located. Drill suitable holes in the case and mount your Arduino in place. It can be a good idea to use plastic screws as shown in the video to prevent any possibility of short circuits to the outside of the case.

Software

There are many options for software to control the device. For example, you could have it subscribe to an MQTT broker (server) and update its outputs based on publications from other devices. Or you could provide a menu via the serial console to control it manually from a computer connected via USB.

For this example I’ve provided a sketch that runs as a web server via Ethernet, and serves up a web page that includes “on” and “off” buttons for each of 16 outputs. By loading the web page in your browser you can simply click the appropriate buttons to activate and deactivate devices connected to those outputs. This example uses two Relay 8 shields, but it works just fine with a single shield as well. There’s no harm having the extra buttons visible and nothing will be damaged if the Arduino tries to address outputs that don’t exist, but you can trim it down to only 8 outputs if you prefer. It can also be scaled up to 24, 32, etc outputs if required.

You can see the full source code for the sketch at https://github.com/SuperHouse/OutputControllerRelay8x2. There are plenty of comments in it to help explain how it works.

8 thoughts on “#12: Building an Arduino home automation controller

  1. Nice videos on Youtube. Could you please leave links to the items you use for the things you build.
    The linked items above fail.
    Thanks
    Dave

  2. How can I integrate this with Openhab please help me

    1. Curious if you found any good resources in regards to the integration of the two? That is the stage I am currently at.

  3. Hi Jon,

    What software are you currently using on your controller? Looks like the best option to go is to use MQTT so it is easier to integrate with your Light Switch controller and home automation system like openhab (or home assistant in my case).

    If you have switched to MQTT, do you have any plans to revision and film an episode about new version of controller? Your new version of Relay Driver Shield is amazing, no more soldering out pull up resistors – you may mention that in you episode, looks like your subscribers are not aware of that.

  4. I’m a bit new to all this, but I uploaded your sketch, and and it keeps erroring out saying WebServer.h no such file or directory. I don’t even know what libraries I need to have installed. I am running 2 of the freetronics relay shields and a dfrobot W5500 with poe main board.does this only worrk on the freetronics boards? Im very confused and could use some guidance. nothing i do is working

    1. Hi Brad, probably too late but, I followed the installation instructions on https://github.com/sirleech/Webduino . Hope that helps somenone else also in future. 🙂

  5. Hi! Is there any alternative to your https://www.superhouse.tv/relay8 ? Shipping is suspended and I’m stuck with dumb house mode (instead of arduino i connected all to poe adaptor :D) ;(

Leave a Reply

Your email address will not be published. Required fields are marked *