Close
0%
0%

$20 Wireless Arduino Home Automation w/ OpenHAB

Integration of cheap wireless Arduino sensor nodes with an awesome home automation platform called OpenHAB. Explore interface options.

Similar projects worth following
There are plenty of "Arduino Home Automation" examples on the net, but they didn't fit my needs - the parts are expensive, or they don't give you a good interface, or you have to write a lot of your own code for the interface. They might be tethered to ethernet, or have poor wireless range, or can't be battery powered.

The goal of this project is to provide all the information others would need to integrate wireless Arduino nodes into a full-featured home automation system, with polished Android/iPhone apps as well as browser-based user interface. In addition, the automation gateway can historize and chart sensor data, react to sensor values (send emails, do android push or iphone prowl notification, etc...), as well as control existing commercial products you may already own (Sonos speakers, WEMO, Insteon, z-wave devices).

I've made the design as flexible as I know how. This project is an enabler, by extensibly connecting two great open source platforms: Arduino & OpenHAB.

******************  Entry Requirements *******************************

System Design Document:  https://electronichamsters.files.wordpress.com/2014/08/system_design.pdf

Phase 1 of this project is to provide an over-all design and examples for home automation sensors.  Below, you'll find my progress with video demos of each sensor.  The basic architecture has been built.

I'll work on providing more example Arduino sensor nodes to fill up a home automation system.

Phase 2 is an experiment with physical computing.  Once I have all the sensors set up, I'd like to build a doll-house size replica of my house, with servo controlled windows and doors, and LEDs.  When a door opens up in the real house, the replica house's door also opens. Basically, I'd like to come up with a replica house analog for all the sensors I have in the real house.

Here's a video of the garage door monitor that's in this tutorial.

1)  "Mailbox Sentinel" - a battery powered Arduino monitors your postal mailbox, and the raspberry pi plays the old AOL "you've got mail" sound clip when the mailbox is opened.  It also emails you, and sets the mailbox status on the webpage, reports the time stamp of the last opening, and lets you know the Arduino battery voltage.

Mailbox Sentinel quick demo video

Mailbox Sentinel - Detailed Explanation

2)  "Baby Room Sentinel" - same thing, except monitor the temperature in the baby room and alarms when it's too hot or cold.  I have a 6 month old.

3)  "Washer / Dryer Sentinel" - same idea, have the raspberry pi announce when laundry is done.

4)  "Water Leak Sentinel" - email yourself when your house is flooded

5)  "Home Intrusion....um...Sentinel" - basically just a twist on the mailbox sentinel, using a PIR sensor instead of a reed switch, and plays a loud alarm noise instead of the AOL sound clip.

6)  "Runaway Dog Sentinel" - Emails / alarms when your dog wonders off the yard

7)  Hydroponics, home HVAC control, security system, aquarium automation...

_____________________________________________________________________________

What problem does this project solve?

If you googled "Arduino Home Automation", there is no shortage of examples of Arduino being used in some kind of home automation. When I first started looking into using Arduino as sensor nodes to do home automation, none of the examples I found really fit my idea of home automation. Some of the Arduino examples didn't use wireless transceivers, only used ethernet shield. Or they used expensive wireless transceivers, or used transceivers that had very short range. Sometimes the examples couldn't easily be extended to do the breadth of home automation ideas I had, or couldn't easily interface with non-Arduino systems. Some of them required too much programming on the server side (hard programming), or locked you in on the Arduino side (easy programming).  There's some cynicism that Arduino can only "kind of" do home automation and IoT, but not completely.  From here, I begin to form a list of requirements:

Sensor nodes must:
1)  be cheap to make, cost less than $20
2)  be power efficient enough to run on batteries
3)  have good wireless range

Server must:
1)  able to run on windows, mac, or Linux on low power SBC
2)  provide encryption and authentication on the web interface
3)  provide rules engine (if this, then that)
4)  historize and chart data
5)  be flexible, accommodate different types of inputs and outputs

I then came across the OpenHAB platform - an existing, sophisticated, well-supported open sourced home automation solution with a full web interface, data historization capability, rules engine, and more communication options than you can shake a stick at.  Unfortunately, there weren't any good examples of how to make Arduino talk to OpenHAB.  In the mean time, I still wrestled with getting a hardware design and a wireless solution that was cheap...

Read more »

  • 3 × Arduino Uno, $10 PIck one of the Arduino Uno clones with a 3.3V/5V switch, and use it only in the 3.3V mode. I've used the "Buono" with great success, and you can find it readily available on ebay. Then buy a real Arduino Uno just to support the project :)
  • 2 × RFM69HW, $4 915MHz wireless transceiver. The HW (high power) version has the most range, over 700 feet without any complicated antenna design. Find it on ebay or anarduino.com. Use the 915MHz version for US/Canada, and 868MHz version for EU.
  • 1 × Wiznet 5100 shield, $8 Ethernet shield for the Arduino ethernet gateway. Buy the fancy version if you got the cash, but the cheap ones seem ok too.
  • 1 × Raspberry Pi, $40 Get your pie.
  • 1 × For battery powered units 1) MCP1702-3302E/TO, voltage regulator, 3.3V, good quiescent current. The other components are just your run of the mill capacitors and oscillator.

View all 10 project logs

View all instructions

Enjoy this project?

Share

Discussions

a.schoenherr wrote 10/11/2016 at 17:27 point

wiring a bunch of sensors around your house isn't actually automating anything, even using a faulty tilt detection to determine where your dog pooped isn't automating anything. you've come up with a great home monitoring system here however.


turn a dishwasher on remotely, turn lights on/off remotely... those are home automation tasks.
lock doors, pour dog food from dispenser, let dog out/in (open/close door). those are again home automation tasks.


I feel the reason you NEED " to write a lot of your own code for the interface." is because often with home automation you either 1. need to spend a lot of money to buy a connected device (such as a fridge) or b. interface with it yourself. (tie into the existing circuit)


for a fridge, minimum would be to read the internal temperatures (2) and give warnings if they exceed a level for x amount of time (fridge is broken), but you could also tie into the door sensor and read voltage, so you can check if the door is open. and and tie into the thermostat to control temperature. 


another example would be controlling a garage door opener, not just checking the status of the door. and in general, control over lights in a house (with Optocouplers and MOSFET).
now I don't mean this as a negative criticism here, I certainly hope you can create something you're both proud of and able to inspire others with. reading over my comment I can see how it would be taken negatively, so i to mention that you have done a good job exploring the possibilities.

$20 won't get you far for UL certified equipment to get an electrician to sign off on installing. you'll be mostly limited to VDC

  Are you sure? yes | no

George I Fomitchev wrote 08/12/2016 at 11:56 point

Eric, if you would like to use our platform, we will be more than happy to share a project with you

  Are you sure? yes | no

Charles Lakins wrote 02/08/2016 at 17:16 point

wow cool project!! I'm all pooped after reading it all :D

  Are you sure? yes | no

chimera wrote 05/18/2015 at 09:47 point

Solid stuff Chris. Have you ever tried to put OpenHab2 on the Yun? I did install jamvm and allowed OpenHab2 to consume max 38MB by adding the -Xmx28M argument to the http://start.sh script. (more is not possible). It stops where osgi command line is available. On a more powerful machine with the Oracle SE JRE it runs immediately thru. You did not install OpenHab on the Yun itself. Did you try before? I dislike the idea of maintaining boards for the Gateway/Dispatcher (MQTT on Yun) and one for OpenHab.

  Are you sure? yes | no

rm65453 wrote 03/30/2015 at 00:58 point

The step by step instructions link is dead. Could some provide an alternate link?

Thanks

  Are you sure? yes | no

mark.hortman wrote 11/29/2014 at 17:37 point
Has anyone considered how you would add functions to the garage door opener to make this truly automated. I am thinking it would be nice to some how make this thing open the garage door when you arrive home automatically, and close when you leave. I was thinking an approach might be to some how use google map tracking abilities and the system could open the garage door when it knows you are near. Has anyone attempted something like that?

  Are you sure? yes | no

stephan wrote 10/24/2014 at 08:22 point
Hello Eric, Thanks for sharing this nice project !
This is exactly what I am planning to do at home but mainly to manage a boiler on which the regulation system just died. :(

I planned to used an arduino in the basement with an RFM69HW to communicate with a pi upstairs, running Mosquitto. So the idea is (was?) to not use another arduino as a gateway. Apparently it is complicated mainly due to the lack of library on the Pi to support the RFM69 series. (Hey Iggy! :) ). I want to use MQTT as well as I plan to add many sensor and to use two-direction communication. (thus Mosquitto on the Pi or http://www.pubnub.com/)

Is using Itead SDK on the Pi could solve this issue. https://github.com/itead/SDK ?

I don't know, having an arduino as a RF/MQTT gateway seems so easier..

Your thought ?

Stephan

  Are you sure? yes | no

Eric Tsai wrote 10/26/2014 at 17:13 point
Hi there,
I'm using the RFM69's mostly for applications where space is a constraint. If you want to get going quickly with your project, you could just use an ethernet shield on the boiler controls Arduino. Then use a $20 router running Tomato or DD-WRT to act as your wireless bridge. That way, your boiler Arduino can post and subscribe to MQTT topics directly.

I have an example of one doing garage door control here, but you can easily modify the code to fit your needs, since it's doing both inputs and outputs.

http://www.instructables.com/id/Garage-Genie-Parking-Remote-Control/

  Are you sure? yes | no

Iggy Koopa wrote 09/12/2014 at 13:23 point
If you want to test the python library out, it's pretty much done. Could use some testing though. I haven't tried out communications with it yet (need to hook one up to an atmega). readTemperature doesn't seem to be giving reliable results, and I'm not sure if the way I wrote sendFrame is going to work correctly. The arduino version of spi.xfer will accept a byte, the spidev version will only accept an int, so I had to convert to ord than int...not sure if that's correct.

  Are you sure? yes | no

Iggy Koopa wrote 09/10/2014 at 17:10 point
I started porting the RFM69 library to python. You should be able to skip the arduino's once it's done. I've got all the basics working already, probably 1/2-3/4 done the whole port. If you want to check it out the code is here https://github.com/etrombly/RFM69 . It should let you manage bi-directional communication as well.

  Are you sure? yes | no

Eric Tsai wrote 09/11/2014 at 03:05 point
Woh! No way! I'll be following your github. Thank you, I can't wait.

  Are you sure? yes | no

arnold wrote 09/06/2014 at 12:49 point
Thank you, Eric. I think making the wireless communications bi-directional can make thing more smart. For example, the lights can be turned on when a light sensor detects the approach of night or the windows can be opened when the sensor finds much flammable gas in the room. I think the work flow looks like this: sensor A ---(status)---> Arduino A ---(status)---> Raspberry Pi(OpenHab)---(command)--->Arduino B---(command)--> Target device.
So I have two question about the the wireless communications:
1. Does the RFM69HW support full-duplex?
2. Does Arduino support multi-thread or multi-proccess?
I think if both the answer of the above questions are 'Yes', you do not need to add more Arduinoes to support bi-directional wireless communications. Please tell me if I am wrong.

  Are you sure? yes | no

arnold wrote 09/04/2014 at 15:22 point
Hi Eric, I'm really interested in your project. I have read you code in github. It seems that Gateway_RFM.ino is used for receiving command and status from the nodes w/ arduino. I have a question about your code: How does Gateway_RFM.ino send command to the nodes /w arduino if user wants to control the devices by OpenHAB? For example, if I want to turn on a light by OpenHAB, what is the process? Thanks very much.

  Are you sure? yes | no

Eric Tsai wrote 09/05/2014 at 00:55 point
Hi Arnold,
Right now, I can't send commands to a wireless field node. It's something I want to address eventually.

I'm going to be using an Arduino w/ an ethernet shield to do outputs. This Arduino will subscribe to MQTT topics.

From OpenHAB, you can have a rule like this:

when
Item button_switch changed from OFF to ON //button from Android app
then
executeCommandLine("mosquitto_pub -t garage -m 1")

So the Arduino with ethernet shield subscribes to topic "garage", and if it sees a value of 1, it'll do some kind of output. In my use case, this output is:
1) a relay that closes a garage door remote button contact
2) one of those RF outlets that gets used to remotely turn on an outlet in another part of the house. So I'd use that to turn on lamps and stuff.

For me, making the wireless communications bi-directional hasn't been a very high priority, since my use case utilizes a remote anyways. I don't really have any where I'm actuating an output on a wireless field node.

But I do plan on addressing this issue eventually. At worst, I can make another pair of gateways for outputs. It just feels silly using four Arduinos. Heck, two was somewhat overkill for a unidirectional gateway.

What did you have in mind for turning lights on/off? Are you thinking of embedding a wireless Arduino node & switching relay directly into some kind of home-made outlet? I've stayed away from messing with mains voltage, as I'm not confident about my electrician skills. Fine line between hobby and house fire :)

  Are you sure? yes | no

Eric Tsai wrote 09/05/2014 at 01:04 point
These are the outlets I had in mind:

http://www.amazon.com/Etekcity-ZAP-5LX-Auto-Programmable-Function/dp/B00DQELHBS/ref=sr_1_1?ie=UTF8&qid=1409878790&sr=8-1&keywords=remote+control+outlet

I can build sensor nodes cheaper than commercial products like SmartThings. But I don't think I can build a wireless outlet cheaper than these RF plugs.

  Are you sure? yes | no

Jasmine Brackett wrote 08/15/2014 at 23:33 point
Hello Eric, thanks for entering The Hackaday Prize. Your project information is coming along well, but please go through the following checklist to see if there is anything missing. Now is the time to check/update your project information to give it the best chance of going through to the next round..

By August 20th you must have the following info on your project page:
- A video. It should be less than 2 minutes long describing your project. Put it on YouTube (or Youku), and add a link to it on your project page. This is done by editing your project (edit link is at the top of your project page) and adding it as an "External Link"
- At least 4 Project Logs
- A system design document. Please highlight it in the project details so we can find it easily.
- Links to code repositories, and remember to mention any licenses or permissions needed for your project. For example, if you are using software libraries you need to document that information in the details.

You should also try to highlight how your project is 'Connected' and 'Open' in the details and video.

There are a couple of tutorial video's with more info here: http://hackaday.com/2014/07/26/4-minutes-to-entry/

Good luck!

  Are you sure? yes | no

Gareth Coleman wrote 08/12/2014 at 01:06 point
Hey Eric great project! I see you arrived at much the same architecture as us - great minds think alike! If only there was an RFM69 library for the Pi that we could use - then we could move from the RFM12B's and take advantage of the extra range and features like encryption. We're committed to making wireless sensors so MQTT over ethernet is a non-starter anyway, plus the wiznet chips are expensive and power hungry!

  Are you sure? yes | no

Jens wrote 07/31/2014 at 15:55 point
Hi Eric, I'm really interested in your project, just starting to set up some Arduino based automation at home.

I haven't gone through it in detail yet, but couldn't you just talk via I2C to the RPi, instead of going through a second Arduino? You wouldn't even need the Ethernet Shield then, and the RPi could then relay the messages to OpenHAB, if necessary with MQTT over the loopback interface (127.0.0.1).

  Are you sure? yes | no

Eric Tsai wrote 07/03/2014 at 02:52 point
Hi Dave,
Yeah, the default OpenHAB interface is a "list" kind of thing, without much room for customization. There are two other interfaces available, and work like plugins to OpenHAB. But OpenHAB does provide an API for you to make your own interface - so you only use OpenHAB as the backend. OpenHAB's backend is powerful, from its rules engine to the number of devices it can easily interface with.

  Are you sure? yes | no

davedarko wrote 07/02/2014 at 22:29 point
Thank you for this post! It's very informative to start with! I've seen a lot of "home automation" projects here, but they kind of all start at zero, there is no unity and it results mainly in switching lights on and off. But I feel this is something so many people thought about that there have to be some open source solutions out there. I'm not happy with the look of the interface of OpenHAB but it should be manageable. I definitely will research some more on this topic.

  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