Home automation

I have started a home automation project using Arduino based devices and a Raspberry Pi. It uses mainly DIY open source gadgets and programs, but there are a few commercial products. I have bought motorised Venetian blinds for my living room from Controliss and remote control sockets from LightwaveRF.

I am using 434MHz RF wireless communication, partly because my British Gas wireless thermostat and LightwaveRF use it, and I can hack in to their protocols.

I decided to use the open source OpenRemote project to control everything. This gives me quite a nice user interface on my Asus Transformer Android tablet. There is also a web interface and I can also use an Android mobile phone, so everything can be controlled over the internet when I am away from home.

OpenRemote has a cloud based Designer that lets you set up devices, commands etc., and then design the user interface as a set of panels. This design is synchronized to a local web server, and the Android application talks to that and picks up the updated user interface. There is no Android programming necessary.

The web server is currently running on my laptop and talks to a Java program that controls all my devices. (OpenRemote is written in Java). I plan to move all this to a Raspberry Pi located next to my router and connected by Ethernet. This will allow it to run 24×7, with minimal power usage.

The Java program talks to a custom-built RF transceiver using Arduino and RF transmitters and receivers from Cool Components. It uses a USB serial connection to the transceiver. The transceiver box will sit next to the Raspberry Pi.

I control my TV, AV Receiver and Virgin TiVo set top box, via a custom-built RF to Infra-Red gateway box. This sits in front of the media boxes and the transceiver sends RF commands to it. This allow me full control over my home cinema system. It uses the IR Remote Arduino library to capture and play IR sequences using a cheap IR LED. I have emulated the Virgin TiVo remote control in the OpenRemote Android application.

I use Spotify for music on a separate computer. I currently control this by running a Java responder on the Spotify machine that OpenRemote talks to. This allows me to select playlists from the Android application. Unfortunately I have to switch the computer on manually as it does not run 24×7.

I have hacked into the LightwaveRF protocol and can control three of my sockets via the Android application. They currently switch on a fan (my air conditioning), a photo frame and an IP camera looking out of the living room window (or into the living room). I can pan the IP camera from the Android application and can view the image over the internet from any device. I could control the photo frame using another IR Gateway.

My heating system uses a BGas RF2 wireless remote which is a rebadged Drayton Digistat RF2. This uses an RF protocol that has been hacked, so I will be able to set the desired temperature and implement rules and schedules from the Android application. I have not done this yet. There is also the possibility to install LightWaveRF thermostats on all the radiators and control them individually.

I have built a custom Room Sensor using Arduino. The plan is to have one of these in every room. It currently has a thermometer, light sensor and motion detector. The data is sent over RF to the transceiver and hence to OpenRemote, It is displayed in the Android application. I plan to add a sound meter and a humidity sensor. I use the Arduino Virtual Wire library to send the data.

I have built an energy monitor using information from the Open Energy Monitor project. This allows me to send total current power usage to OpenRemote. I will probably send it on to the OpenEnergyMonitor cloud application for analysis. It uses a non-invasive CT sensor to measure the total house electricity usage. Again it is Arduino based and sends RF data to the transceiver, and hence to OpenRemote.

I bought some solenoids and have implemented a button pusher using designs from the Extreme NXT book. I can control this from a Lego NXT or an Arduino. I am currently using this to press the buttons on the remote control for my blinds, and hence control the blinds from OpenRemote. The blinds uses a 2.4GHz wireless protocol that is hard to hack. I could replace the current wireless receivers with my own version. The button pusher will be useful for other devices.

I will probably add lighting control using LightWaveRF products, and window sensors either using the LightwaveRF product or my own custom devices. This will allow me to set rules on what to do when windows are opened, such as switch off radiators.

I plan to monitor the soil moisture of my house plants using a custom wireless sensor.

I have included local weather information in the Android app, using wunderground. OpenRemote allows you to access HTTP APIs and extract information from XML or JSON replies. I was thinking of putting a wireless weather station in my garden, but there does no seem to be much point as pretty accurate information is alreay available from the Internet.

This has all given me flexible control over most of the devices in the house.

What more is there to do apart from to put this all into production?

I would like to send commands to my robot, Keith, such as “fetch beer”. He needs better navigation and help opening the fridge door. He might not be strong enough to carry beer, but I cannot afford a PR2. As I add capabilities to Keith, I can get him to do more households tasks, but fetching beer is the priority. It would be good if he could go to the shop for the beer.

I will add voice control. This is most easily done by an Android application. I have experimented with one.

I would like to add gesture control of everything in the living room using a Microsoft Kinect or an Asus Xtion Pro Live. I have had my Kinect working with ROS and monitoring body movements. Perhaps I could base it on that.

It will be straightforward to control the Roomba from OpenRemote, but Keith has currently taken over the Roomba.

It should be easy to incorporate my wireless doorbell, so that I can respond to people at the door when I am not at home, or spoof someone at the door to annoy my grandchildren. However, I am not sure what frequency RF signal it uses.

It would be good to hack into the existing home security alarm system, but I am not keen to tinker too much with the mains wiring.

Controlling the outside water feature (stream) and lights will need a couple of mains switch boxes to be replaced.

I would quite like to have a letter detector at the front door to tell me when I have snail mail.

I have a box for an intercom by the front door. I might put an IP camera in that and use it as an intercom.

Control of the coffee machine would be good, but requires too much pre-preparation such as filling the coffee machine with water and coffee. A plumbed in beans to cup machine would solve this but is a bit expensive. Perhaps I can teach Keith to do it.

This entry was posted in Electronics, Home automation. Bookmark the permalink.

14 Responses to Home automation

  1. Neil says:

    Geek Grandad, interesting article. I have set up a simple system of mains electric switches using cheap RF mains sockets from Maplin and an Arduino with RF transmitter controlling them. I am now trying to do similar with LighteaveRF devices but have had no success receiving the LightwaveRF code to an Arduino sketch so that I can attempt to code a transmitter.
    Are you successfully controlling the LightwaveRF via the 433 RF transmitter. If you are could you share the receive and transmit protocol you are using in your code.
    I hope you continue with your projects successes and share them with all in your blog, it makes interesting reading.

    • Geek Grandad says:

      Hi Neil. Yes, I am controlling three (plug in) sockets using an RF 433 transmitter. I read the packets from the LightWaveRF remote control by feeding the RF signal into Audacity on a PC, not with an Arduino. My current code is not completely reliable. It sometimes fails to switch the devices on or off, and you have to try again. I discovered the protocol from http://www.dbzoo.com/livebox/universalrf#lightwaverf_dimmable_cfl_bulb. I have just added an article called “Transceiver code” which includes my Arduino sketch. I am surprised that anyone has found this blog, as I have done nothing to advertise it.

      • ananirainforestvilla says:

        Hi Geek Granddad,

        This is awesome stuff. I found your blog thanks to Google. I’m in the midst of implementing a similar setup, OpenRemote on RaspberryPi, connected to Arduino via serial with RF module attached.

      • Lionel says:

        Hi Gee Grandad, this is awesome stuff! I found your blog thanks to google. I’m in the midst building a similar setup, OpenRemote running on Raspberry Pi, connected to Arduino with RF via RS232. Now stuck with looking for a serial protocol between the OpenRemote and Arduino. Can you enlighten me with your solution or direct me to some resources? Thanks.

  2. Geek Grandad says:

    Hi Lionel, I use the TCP/IP protocol in OpenRemote and run a Java program that responds to the Socket requests. I use the same RXTX Java library that the Arduino IDE uses to talk to my tranceiver over a serial USB link. This should work with any serial link.

    You do do have to use Java. For my robot, Keith, on the Raspberry Pi, I used python to implement a socket server and pyserial to talk to an Arduino (to control my Roomba vacuum cleaner), so a python socket server should work just as well for OpenRemote. Lawrie

    • Lionel says:

      Thanks a bunch Lawrie. How does your message structure look like? Did you create your own protocol?

      • Geek Grandad says:

        I am using the virtual wire library for the messages from my sensors, which defines things like checksums. Within that, I have defined my own protocol, which is not yet finalised.

      • ananirainforestvilla says:

        Thanks. Will work on my own protocols then.

  3. Great blog, I am currently looking to do the same type of stuff with my Raspberry Pi, you have pushed me in the right direction, with LightWaveRF and OpenRemote.

    I will be using the Raspberry Pi as a pass-though server to control the 240v via the RF signal, and now I know I can hack the RF of LightWaveRF and will not need the WiFi module, this will help reduce the TCO for me as I already have some HomeEasy devices that use same protocol, but just on different frequency, but it is a genius idea to have custom room sensor modules, as I should be able build them with various type of Arduino boards as each room will require different sensors.

    I will also be adding my intruder and smoke/Co2 alarms to the system, so I can monitor and trigger alarm events from the system, without reducing the integrity of the stand-alone alarm systems.

    So I would like to thank you for you insight into home automation.

    • Geek Grandad says:

      Things have moved on a bit since I wrote this post. There is now a LightwaveRF Arduino library in github and it should get better soon as several people have worked out more of the protocol and added suggestion for improvements. I changed to using Jeenode based room servers and then moved to the Home Automation Hub version that are housed in cheap Airwick containers (which include a motion sensor). These work well for me, and are all Arduino compatible. I still like OpenRemote as it works on the RPi, seems very reliable and is a very quick way to get Android and iOS remote control applications and a simple rules scheme. I am beginning to think that a single RPI may be a bit underpowered for the number of sensors that I am adding to my system. I have not yet tried to incorporate my existing intruder alarm, smoke alarms and carbon monoxide sensors. I am not sure how to do this. My CO alarm is a free standing battery one, and I don’t know how to take a feed from it. It might be easier to use a separate CO detector such as the Air Quality Egg (which is compatible with my Jeenodes). I have mains wired smoke alarms and don’t know how to get a feed from them. I am also not sure how to get data from my intruder alarm. It has a front door sensor and a couple of motion detectors. I would need to open up either the LCD/keypad box or the box in my meter cupboard to take a feed from this. I am a bit wary of doing that. If you have ideas on any of this, let me know.

      • Hi Geek Grandad,

        I haven’t had a look at jeenode yet, but when I get a chance I will delve in, with regards to my smoke and CO detectors, mine are directly connected to my intruder system, so I only have to interface with one main unit, and I am doing this via a serial connection on the main intruder board (had lots of help from my alarm engineer friend to get this to work correctly) however I am unable to trigger events on panel via the serial port, but my panel allow for me to switch some circuits to trigger the alarm, each of theses circuits can be assigned an address within the panel, so I can read this data via the serial connection when any of the detectors are triggered, by doing it this way means I don’t compromise the integrity of the intruder system, but still have access to the state changes from my Home Automation Web services.

        I am about to add a voice dialer to the panel so when a detector is trigger, I will receive a voice call to my mobile phone informing me that something is wrong, you can get units that will send a text messages to predefined number via a GSM network, but they can be unreliable, due to network issues, the old fashion voice dialer are great because the will still work during a power cut and only require land line.

        I have ask my alarm engineer friend, and he says that about 70% of the system he works on all have serial connection, however some of the serial connections are only designed to be used with small matrix or thermal printers at very a low baud rates.

  4. Shane says:

    Hi Geek Grandad,

    Very Informative post… I’ve just started out with home automation, I played with some x10 modules, but have now got quite a lot of the LightWave RF modules including the wifi center.. My next mission was to setup voice recognition.. Having read your post I think it will give me a starting point.

    I also like the idea of the robot fetching the beer from shop/fridge! 🙂


  5. lewisharrisonwood says:

    Hi geek Grandad,

    A great post, I am starting to setup a similar system to this using openremote, kodi (formally xbmc) and I am soon to add lightwave RF radiator valves and light switches. Are you still working on this project? I would love to see what has happened and how you have upgraded the system.

    • Lawrie Griffiths says:

      I am still using the system, but have not upgraded it much lately. I have LWRF sockets throughout my living room (5 double sockets), and LWRF light switches in the living room and bedroom, with dimmable LED lights. I only used a LWRF radiator valve in one room and never linked it to the home automation system. That was the first generation of LWRF radiator valve, which they stopped making. I have tried the more recent ones but they do not seem to get very good reviews. I am starting to look at other options such as the Honeywell Evohome system.

      I use EDF IAMs for monitoring things like the washer, dryer and dish washer. This allows me to receive emails or other notifications when the washer or other appliance finishes. These plug in to sockets and are not as nice as LWRF sockets, but the LWRF sockets do not give power usage or status. I am also experimenting with a Wemo insight socket, but am not that impressed so far.

      I use Kodi occasionally on a Raspberry Pi, but use Spotify more for music.

      I have a few servers on Raspberry Pis deployed which run my home automation system.
      One server runs my HouseConrol software that gives a command interface to all my devices, e.g “lights on”. I occasionally run this with a speech recognition server and a PS Eye microphone/camera to do speech control. This works, but not reliably enough to be very practical. I also have an Android app that uses Google speech recognition but don’t use it much.

      Another Raspberry Pi runs a few servers such as Mosquiito MQTT, nodered, mysql and a web server. I mainly use the web server to control my devices, with a status display and a command interface.

      I sometimes run another Raspberry Pi with openremote linked to HouseControl, but am not that keen on mobile apps for controlling things as I find it all too time consuming switching to the app, navigating to the right screen etc. I prefer my command interface.

      I am currently looking again at automating my garden watering system. I am not sure whether I will do this with battery or mains operated valves.

      I did start using Raspberry Pi based face recognition which I was planning to use with my front door camera, but have not finished that yet.

      I have a force sensor on my sofa that tells my how long I spend lying on the living room sofa, and I have a LWRF switch on my letter box which tells me when a letter or parcel arrives. (Small parcels from China arrive frequently as the moment).

      I am using a Fitbit Zip, which is linked to the rest of my system via nodered and mqtt. I am thinking about getting the Aria scales.

      I have been playing with esp8266 wifi sensors and actuators – see the latest two posts – but don’t have anything deployed so far. The esp8266 uses a bit too much power for battery operated devices.

      I still use my LWRF Arduino library but I have not worked on it for a long time and it is not !00% reliably. I may switch to https://github.com/roberttidey/LightwaveRF as I suspect it is an improvement on mine.

      This whole area, as part of the Internet of Things, is very active, but it is hard to put a reliable integrated home automation system together because of the commercial rivalries and lack of standards. Also some of the devices are country-specific, and don’t work well, or a all, in the UK.

      I am rather disappointed with the progress that LightwaveRF have made, as they seem to be the only people that are doing nicely designed switches and sockets for the UK market.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s