Close

Does this project spark your interest?

Become a member to follow this project and don't miss any updates

$20 Wireless Arduino Home Automation w/ OpenHAB

Integration of cheap wireless Arduino sensor nodes with a awesome home automation platform called OpenHAB. Plus doll house replica.

This project was created on 07/02/2014 and last updated 7 days ago.

Description
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.
Details

******************  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 »

Components
  • 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.

Project logs
  • Prototype Dog Poop Tracker

    7 days ago • 0 comments

    This is a prototype of a dog poop tracker. Working on miniaturizing it. It sets up a virtual fence around the house, warns you if your dog escapes the yard. Also gives you a google map of your dog's poop location, depending on well well your dog's behavior fits in the way it works. Details here:

    http://www.instructables.com/id/Uber-Home-Automation/step15/Dog-Tracker/

  • Garage Door Opener

    7 days ago • 0 comments

    Instructions for a remote garage door opener.

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

  • Washer-Dryer Smartifier - Laundry Room Sensor

    2 months ago • 0 comments

    Here's a prototype for the a laundry room sensor. It uses these sensors:

    • Sound Sensor determines when washer or dryer cycle starts and completes
    • PIR Presence Sensor used to determine when a completed load is picked up
    • Water Detection circuit senses if there is a water leak or overflow, or a flood in the basement.
    • light sensor circuit from the Uber sensor is used to determine if the laundry room light is left on.
    • Temperature/Humidity sensor - because it's so cheap to add another sensor

    The idea is to move the notification that a wash/dry cycle is complete - move it from the basement to the living room or kitchen, where you're more likely to make use of that signal anyways. It also keeps track of whether the wash has been picked up.

    This is the interface for the sensor on the smart phone/tablet:

    Video demo:

    For all the code and configuration files, visit the Build Instructions link on the left bar.

View all 9 project logs

Build instructions

See all instructions

Discussions

stephan wrote a month ago null 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 a month ago null 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 2 months ago null 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 2 months ago null 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 2 months ago null point

Woh! No way! I'll be following your github. Thank you, I can't wait.

Are you sure? [yes] / [no]

arnold wrote 3 months ago null 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 3 months ago null 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 3 months ago null 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 3 months ago null 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 wrote 3 months ago null 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 3 months ago null 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 4 months ago null 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 4 months ago null point

Hi Jens. Yes, I think you can use I2C from the RFM Gateway directly to Raspberry Pi. But I liked the flexibility of using a Arduino Ethernet Gateway to post MQTT data. A couple of advantages:

1) I don't want to exclude people. Using MQTT as intermediary means all PC and MAC users can use this setup almost as is without modification. I'm not very comfortable with Linux myself, so I can see others dismissing this setup as unattainable if they aren't comfortable with Linux.

2) I don't want to exclude devices. Using MQTT allows other small devices to act as host machines...maybe someday I can use a Android TV stick. I don't have to re-engineer this simply because I wanted a faster host machine that doesn't have GPIO.

3) Using MQTT, I can optimize the location of the Arduino gateways for RF reception and the OpenHAB host machine for audio alarming. As long as the LAN network is available, the two aren't tied together. I might even be able to have the OpenHAB host not in the same LAN as the RF gateway. Using I2C directly, the RF gateway is physically tied to the OpenHAB host machine.

I haven't gone down the route of using GPIO directly with RPi. I'd be interested to see how it would be implemented. To be honest, in my use case, the advantages of MQTT are more aesthetic at this point. I'm not having any issues with reception...I actually have the gateway in the basement because the Arduino ethernet shield runs so damn hot.

Are you sure? [yes] / [no]

Eric Tsai wrote 5 months ago null 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 5 months ago null 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