Home Easy ambient orb

After a long wait, I finally have a TLC5940 LED driver chip, so I’ve been making a bit of progress on my ambient orb project. The LED driver works well with the little RGB PCBs in the B&Q disco light after a bit of hacking, cutting tracks to the original controllers and soldering a few wires on to the LED leads. The final ingredients are a Freeduino Nano to squeeze inside the box, along with a 433MHz AM receiver.

So the hardware is mostly sorted, but what about the software? That I’m not quite so sure about. Here’s a vague list of requirements:

  • I want the orbs to work when they are connected to a computer directly via USB, or remotely using the 433MHz AM wireless
  • It should be possible to use the three orbs as separate ambient indicators, or together in more complex animations, like the weather beacon in Toronto for example
  • It should be possible to cycle through several ambient animations, such as a traffic indicator and weather forecast for example
  • The information the orbs can display should be easy to modify without reprogramming

My current thinking is that the home easy protocol might be sufficient to send information to the orbs. It is limited, but I think there is also a limit to how much information the ambient device can convey before it stops being ambient. If I have to spend time decoding what it’s trying to tell me, I may as well have messages on a screen. The other potential advantage of using the home easy protocol is the possibility of using home easy remotes to select the information being displayed. A simple protocol also means that simple devices could control the ambient display directly, without requiring an always on server in between.

That covers the wireless connection. My plan is to use the USB connection to send animation information to the device, since this is beyond the home easy protocol. For example, to indicate traffic problems; top orb is alternating dim red and bright red, middle orb is dim amber, and bottom orb is dim green.

Simples! Well, in theory. I’m still thinking about a protocol that would capture the kind of ambient animations that I’m after. If there were several single orb animations, and several multiple orb animations, how would these be shown? Automatically? Based on some notion of priority? Manually using a remote, even though this seems less ambient?

I would love to hear if you have any comments or suggestions.

Update: The disco lights are almost back in one piece, and glowing a bit like they did originally! Just need to solder on the wireless module and get on to the software side! (16 April 2010)

Living with polar bears

Well, the polar bears have begun their migration back north to the loft. It was my first experiment with an ambient device and the Christmas tree was certainly hard to ignore, especially when Jo complained the bears had gone off again! As a result, I updated the arduino sketch a bit to just briefly flash the bears off every three minutes when our energy use was high instead of turning them off completely. Still annoying apparently (kind of the point!) but the bears did manage to stay under arduino control all Christmas with only a few breaks on manual! A few observations now that the experiment is over:

  • I don’t think having a display like CurrentCost’s in the house makes a huge difference after the initial discovery phase. That’s not to say that the display is pointless: it is much easier than checking the meter, and the cost estimate is great, but after I found out what wastes the most energy, I rarely look at it. Is that the same for most people?
  • On the other hand, having a Christmas tree flashing when a lot of energy is being used is much harder to ignore! Not really an all year round solution but I’m sold on the idea of ambient devices. I hope to have a more compact one soon. It would be nice to have a simple indication near the front door as well for quick checks that everything is off before going out.
  • Energy use alone wasn’t enough information to tell whether the house was occupied or not. I had planned to leave the lights on automatic all the time, so they would turn on when we arrived home and off when we were out. A daft idea with hind sight because the fridge and central heating were enough to confuse the poor polar bears.
  • The arduino does a great job controlling Home Easy devices. I had it set up to send ‘reminders’ on a regular basis, which seems like a good way to make sure things are in the right state without any acknowledgements from the Home Easy receivers. (Also quite entertaining when the lights pop back on after someone turns them off with the normal Home Easy remote! I’m easily amused!)
  • This was the first project I ‘completed’ with the the arduino, and it was almost useful! Well, I enjoyed it at least, and it’s got me thinking more about the next project: the ambient orbs if Farnell ever ship the TLC5940 I ordered, or a wireless programmable thermostat.

Arduino Home Easy controller library

I’ve been having another look at controlling Home Easy devices recently, after some encouraging successes from other people on twitter and the Home Easy page on the Arduino wiki. There was already a class for receiving Home Easy signals but I’m plotting some techno polar bears at the moment so wanted a simple Arduino library for sending Home Easy signals.

After digging out an ancient C++ book I’ve now got working library, complete with example. I kept it very simple to start with so there are a few more bits still to add, like setting a specific controller id or sending a specific device code, but I’m quite pleased with the result. Here’s the sample for using the library…

#include <HomeEasyCtrl.h>

// This is the Home Easy controller
// This example will use a 433AM transmitter on
// pin 4 and will flash an LED on pin 13 when
// transmitting
HomeEasyCtrl easy(4,13);

// This is just a pin which has a push button
// connected, to trigger a Home Easy device
const int buttonPin = 6;

int buttonState = 0;

void setup()
 pinMode(buttonPin, INPUT);

void loop()
 buttonState = digitalRead(buttonPin);

 if (buttonState == LOW) {
 easy.deviceOn();    // turn on device 0
 delay(3000);        // wait 3 sec
 easy.deviceOff();   // turn it off again

Just get in touch if you want the library.

Updated: managed to upload the library to the Arduino Home Easy wiki page.

Home Easy Hacking Wiki

I recently discovered that someone has created a useful looking Home Easy Hacking Wiki to pull together what information there currently is about hacking a range or related home automation hardware. Unfortunately it doesn’t yet answer Jerd’s question about the automatic protocol, so if you’ve got something working, it would be fantastic if you could add a few more details to the wiki.

Hoping to get back to finishing off a Freeduino Home Easy controller before too much longer- I didn’t even get as far as unwrapping the transmitter last time! I’m currently wondering if the Finite State Machine library that Mike used in his latest project would be useful to handle transmitting and receiving from the same controller.

If you’ve done anything like this before, any tips would be most welcome!

Update: maybe the Southampton Hack Day (via Benjie) would be a suitable opportunity to work on this. (4 Sept 2009)

Update: Thanks to Paul’s post I’ve just discovered another page documenting various 433 MHz AM signals, including devices using PT2262/PT2272 encoder/decoder chips, which klik-aan klik-uit uses apparently. (24 Sept 2009)

And there’s more:

Must get round to finishing this off myself sometime soon! Here are a couple more people who have Home Easy working with the Arduino:

(29 Oct 2009)

Home Easy page on Arduino Playground

Largely thanks to @barnybug, the Home Easy Arduino hacking has been going really well. Making an LED blink is one thing, but making it blink by pressing a button the other side of the house is quite another! I’ve currently just been receiving signals, but when I’ve got the transmitter going as well, I want to do things like only relaying an on command to the socket if the current energy use isn’t too high. (Would be nice to have that working in time for Home Camp, but no promises.)

Should anyone else want to get going with some Home Easy hacking as well, I’ve created a Home Easy page on the Arduino wiki. So far it’s mostly just the sketches from Barnaby but I’m working on using interrupts instead, with the eventual aim of creating a Home Easy library for the Arduino. (There’s a Google code project for many RF protocols at once, but I just have Home Easy.)

Here’s what I have for receiving a Home Easy message with interupts so far which, with some even messier code, seems to do the trick. I would like to be able to register functions to call for specified controller/device codes, but not looked in to how that would work yet.

unsigned int pulse_width = ICR1;

if( !bit_is_set(TCCR1B ,ICES1)) { // falling edge was detected
// start over if the high pulse was out of range
if(pulse_width < min_high_width || pulse_width > max_high_width)
pulse_count = 0;
// don’t need to do anything with high pulses as long
// as they’re ok; should all be the same width
else { // raising edge was detected
// start over if the low pulse was out of range
if(pulse_width < min_low_width || pulse_width > max_low_width)
pulse_count = 0;
} else {
if(pulse_count < max_low_pulses) {
rx_wire_bits[pulse_count++] = pulse_width > bit1_low_detect ? 1 : 0;

if(pulse_count == max_low_pulses) {
message_received = receiveMsg();
pulse_count = 0;

// reset the counter
TCNT1 = 0;

// toggle bit value to trigger on the other edge

Another Arduino Oscilloscope

On a bit of a tangent from my Home Easy hacking, I’ve been experimenting with an alternative to the poorman’s oscilloscope. The arduino + processing hack is brilliantly simple but it wasn’t much use with the signals I was trying to look at.

Zelscope looks quite interesting but it’s a trial download, plus I wanted to keep the arduino end of the poorman’s oscilloscope hack the same if possible. The Universal Real-Time Software Oscilloscope GUI DLL Library didn’t initially look as interesting since I was hoping not to have to write any code. On closer inspection, it does have a test .exe which will import data, which only needed a tiny change to the arduino sketch from the original hack:

Serial.print( val );

So just get the data from the serial port, into a file and import it… either I’m missing something or getting data from a serial port on Windows is a bit of a pain. I ended up using PowerShell to do the job, starting with some instructions for reading from a serial port on the PowerShell blog. Unfortunately that doesn’t seem to work, but getting rid of the add_DataReceived line and using ReadLine() did the job:

[string]$str = $port.ReadLine()
Add-Content “C:\Temp\Data.txt” $str

I do wonder if I could use the oscilloscope GUI DLL library directly from PowerShell. I get the impression that might be possible- I expect Dale will know the answer! For now, here are the results importing a file:


Not bad, although I’ve yet to see if it makes finding the signal I want any easier. Next week I’ll be at my mum’s house trying to find an actual oscilloscope which I used to have!

Home Easy -duino

So I’ve done a bit of playing with the Freeduino and I can see why people like Arduinos so much: they really are simple to get working. It might only start with a blinking LED but it’s nice to feel you’ve achieved something so quickly. I wish more software was like that!

The reason for getting an arduino was to experiment with some more home automation, so I’ve ordered 433MHz AM transmitter and receiver modules which look (to the untrained eye) like they should work with my Home Easy sockets. Hopefully they’ll also be simple to wire up to the arduino as well! I’ve found a couple of projects which look like they might help get me started with the code:

In fact, combining infrared with Home Easy, to turn off a couple of sockets when putting the TV on standbye for example, might be interesting. The first thing I want to try (assuming I get it working at all!) is forwarding commands via the arduino. So, for example, the arduino could relay an on command to the living room lamp, but only if the CurrentCost reading is low enough (i.e. the kitchen lights aren’t still on)!

I’ve been using the simple oscilloscope hack to do some prototyping while I wait for the AM modules to arrive, and I’ve managed to ‘send’ a sample signal that looks about right. I’m not so sure about how good the timing is going to be though, and I’m still pondering about receiving Home Easy commands. Any suggestions about the best way to do this kind of thing would be most welcome!