Once upon a time I started to automate my home using some cheap plugin switches, Arduino's and homemade sensors. Over time the Thuis app (the name of the system, "home" in Dutch) evolved and grew, and now it's time to bring everything to a higher level. Imagine arriving home and being welcomed by your iPhone giving you direct actionable notification, or walking around while the house adjusts to your needs. Lots of things are currently already possible using off the shelve solutions, however you'll always lack the freedom and power compared to designing this yourself. I'm solving this using a flexible communication layer based on MQTT. By giving all parts one way of communication in common we can mix several off the shelve solutions with our own. This brings me to the two goals of this project:
- Improve my own home with an integrated home automation solution based among others on Z-Wave, Java, iOS, iBeacon, Plex and a Raspberry Pi as core
- Contribute to the community by making several parts available as open source libraries for others to reuse
Why am I applying?
I'm an IoT enthusiast already for quite some time and I'm experimenting a lot in my own home with home automation. I believe it's time to get more involved in the community and publish some of my personal work back. This challenge seems like the perfect opportunity for that! So in summary:
- The theme of the challenge fits me well, since I already have some experience with IoT, and feel that participation in this project will help me to contribute to the community of other IoT experts
- The Raspberry Pi is a part of my home since it was introduced, in the meanwhile it was upgraded from a 1B to a 2B and this is a good time to move up to the model 3
- If I'm selected the Kit will be a great reason to add some home-made actors and sensors
- There are nowadays so many great products on the market, but making them work together can be tough
- My girlfriend is enthusiastic about our home-app and as UX-designer would like to contribute as well
- And of course, I love to improve my own home
Selected use cases
After a long day of work coming home should be a relaxing experience. With this project I intend to make this a reality as much as possible. I have chosen a few use cases to focus on, which I will describe here.
Light when and where you need it
Take for example the kitchen: depending on your activity, your need for light are very different. While cooking the lights above the worktop and stove should be on, maybe even the ceiling lights as well. But when you're there just to brew a cup of coffee a small light will do. And what about when it's still quite light outside? The light plan should feel natural. It can be based on data from sensors, knowledge about habits and other activities in the house.Using several ambient light sensors, PIR movement sensors, and possibly iBeacons, the system can detect where something is happening. When combined with previous behavior actions can be triggered.
Welcome home
Getting home in the winter and finding your home at a comfortable temperature is something most home automation systems or thermostats like Nest provide. However wouldn't it be nice to help you in your most likely activities too? Such as when getting home in the evening you get a notification which allows you to turn on the home cinema system. Or you get home when it's late and dark lights guide you to the bathroom and bedroom and will turn off when you lie down.The detection of coming home will be a combination of several iBeacons around the home which are sensed by an iPhone in combination with some PIRs. Based on the time and where in the house the sensors are triggered the wanted actions will happen.
Home Cinema
Home Cinema involves many parts: TV, receiver, speakers, and for playing media an Apple TV and BluRay player. Just turning them all on or off is already a hassle. Using some Z-Wave switches and a Raspberry Pi attached via HDMI most of this can be turned into a single action. In combination with Plex and some APIs we can make the selection of your favorite TV series easy as well. The Raspberry will communicate through CEC with the TV and receiver, through MQTT it will receive commands from the core of the system and report back if anything happens.A possible addition to this will be adding a DIY Ambilight. This can be done by capturing the images from HDMI to a Raspberry Pi, which will drive an Arduino, which in turn will drive the LEDs mounted on the back of the TV.
Mobile & On-The-Wall-UI
A home automation system can do quite some things automatic, but it can't read your mind yet. So there needs to be an interface to tell it what you want. For this an iPad will be installed in the living room for easy access to the most important actions and data, including controlling the home cinema. When walking around these actions are also available on the iPhones of me and my girlfriend. In the kitchen a Raspberry with the 7" touchscreen will give similar controls, this time giving data useful while for example preparing breakfast, such as the weather forecast and maybe even delayed trains.Two possibilities for further expansion are a dedicated iPhone as a home cinema remote and using an even more natural way of communication: speech. The latter will involve having a microphone connected to either a Raspberry or the wall-mounted iPad which always listens to a trigger phase (much like Apple's "Hey Siri") and afterwards can execute actions. This might however be a bridge too far for now.
Mockup of the iPhone app
Wake-up light
As alarm clock I use the Sleep Cycle app: it measures the quality of your sleep and wakes you up at the right moment in your sleep cycle. In the 30 minute window the app might sound the alarm it would be great if the bedroom adjusted gradually to daylight. In the summer slowly opening the curtains (using a MOVE) would be enough, in the winter it should also turn on the lights. By doing this waking up should be a lot easier.Unfortunately it doesn't have any APIs yet (they might add a web hook after I suggested it), but I want to prepare before they do or to find an alternative that does. Or maybe I can simulate a Philips Hue bridge which it already supports?
Manual override
Nothing is more annoying than lights to turn on or off when you don't want it, so it's essential to provide a manual override for each as well. I will use traditional wall-switches for this, which will be integrated in the system through Z-Wave.
Energy monitoring & saving
One of the promises of home automation is that you can save energy. As you will add quite some (always-on) electronics this can be overrated. However most switches can help you monitor the usage of individual appliances. I use a YouLess device to get the overall usage. Using this information you can actually save energy: knowing is half the battle. Out of the box the current power usage and totals are available, but you can only really act on it when you have usage over time and trends. That's why I will work on aggregating the data and making it available for analysis.
Results
The end product of this challenge will be an improved home automation system in my home. The core of the system will be a Raspberry Pi 3 with a WildFly server. The Java EE application running on this will manage the logic of the house and bridge the several parts together. On this same Raspberry the Razberry/Z-Way software will be installed to be able to communicate with Z-Wave devices. Another Raspberry will be used as part of the Home Cinema setup and will be hooked up through HDMI to the AV receiver. It will control a.o. the receiver and TV via CEC. Other apps in the system include the iOS apps for both iPhone and iPad, which act as remotes.An overview of the home with all the devices can be seen below:
Map of the home with devices. Numbers refer the hardware list below.
The most important aspect of the project will be the communication between the different nodes. The nodes communicate with each other using MQTT. This is a very light weight communication protocol providing a publisher/subscriber setup. It's very suitable for this project as it's able to send around information quickly and it's platform independent. To be developed and published as open source to my Github are at least:
- MQTT integrations for a.o. Z-Way and Plex
- A CEC Java library (with support for forwarding events to an MQTT topic)
- MQTT based UI components for iOS
- (optional) MQTT monitor which records events to a database for analysis
All these will help others who are working on a DIY home automation system, especially when they use MQTT for their communication.
Technology
Hardware
- Raspberry Pi 3 with Razberry – Core server based on Java EE and Z-Way (1)
- Raspberry Pi 1B – Connection with HDMI CEC (3)
- Raspberry Pi 2B + 7" touch screen – Wall control in the kitchen
- ReadyNAS – Plex Media Server (2)
- iPhones – Serve as personal remote
- iPad – On-The-Wall-UI
- Z-Wave switches – Switching power sockets to turn devices on/off, most measure power usage as well
- Z-Wave sensors – Multi sensors (motion, light, temperature)
- Z-Wave radiator valves – Controlling the temperature
- Estimote beacons – iBeacons to detect presence
- Home Cinema setup – a.o. Sony TV, Denon Receiver, Apple TV (4, 5)
- YouLess – Measures overall power usage
- MOVE – Motorizes the curtains (6)
- Optional: Arduino based sensors
- Optional: Raspberry Pi/Arduino based Ambilight
Software
- Raspbian – OS of the Raspberries
- WildFly – Application server for Java EE
- Mosquitto – MQTT broker
- Z-Way – Software accompanying the Razberry
- Plex – Media Server and Player
Challenges
Robustness
While testing the Z-Wave switches and sensors I already noticed that it happens quite often that some signals get lost. It works most of the time, but it happens that for example one of the lights doesn't turn off automatically. I will have to find a solution for this, maybe by adding a verification step after each action and then try again when it didn't work?
A similar issue will be the case with CEC, as different brands use their own version of the standard which are not always compatible and documented.
Time
In this proposal I'm describing quite some use cases and I have many more in my mind. Time will be a scarce resource when I want to implement them all. Possibly I will have to simplify some of the use cases at first.
About me
I'm a Dutch developer who likes to tinker with hardware. I'm mostly developing software in Java, Swift and some Processing (Arduino). For about 6 years I taught Computer Science at a high school, during which I also developed quite some course materials about Arduino (published by a Dutch educational publisher) and App Inventor (Dutch, available on GitHub in LaTeX). Currently I'm co-founder of the startups ZEEF and LinkPizza.
Top Comments