Illuminations


It’s lasted a few years but sadly our old Christmas tree failed the strictest quality control standards required for indoor duties. Luckily there was an opening for front garden decoration, so it’s not out of work just yet. Doing a fine job too I think:

The lights are plugged in to a Home Easy socket, so I may be dusting off the arduino to control them, which would be an ideal excuse to give a Pachube Dashboard a try… as soon as I’ve finished the Christmas shopping that is!

Explaining the auto kitchen light plan


Since a few people seem interested/skeptical on Twitter, here’s a very quick explanation of a small update to the kitchen lights. Since getting a Current Cost meter it’s been obvious that the biggest waste of electricity are the halogen spotlights in the kitchen. (It amazes me that ordinary incandescent light bulbs are being phased out while at the same time many new houses are full of halogen bulbs, but that’s for a future post!)

Most of the time the two lights under the cupboards would be good enough, but the switch for those is a bit hidden away, so we usually use the five ceiling lights instead. The first part of the cunning kitchen light plan is to connect the two worktop lights to a Home Easy remote control ceiling switch. Now we could put an ordinary remote switch in easy reach next to the main light switch but where’s the fun in that? I got tentative spousal approval to use an indoor PIR remote control instead…

Results so far seem promising: the lights aren’t triggered walking past the kitchen because the sensor is looking inwards from above the existing light switch, and there’s often no need to resort to the manual switch to turn on the electricity burning main lights… which is actually quite lucky because they aren’t there at the moment!

Only temporarily removed due to some planned ceiling painting* but it was a good excuse to automate the backup lights.

* Well, it seemed pointless painting the tiny ceiling in the porch on it’s own, so the kitchen is getting a fresh coat as well.

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.

Techno Bears


I was only planning to have a quick play with the LCD display I bought recently, but ended up finishing off my Arduino + Home Easy polar bear controller project as well. Not that it actually needed a display you understand, but I’d wired it up, so why not!

…complete with a manual override should it annoy Jo a bit too much! I finished a bit ahead of schedule in the end; the polar bears aren’t actually out yet… because it’s not Christmas! I have dug the tree up though, and as soon as it’s indoors we’ll have some ambient bears to tell us when to turn something off. Here’s the sketch so far, warts and all:

#include <Bounce.h>
#include <HomeEasyCtrl.h>
#include <Messenger.h>
#include <LiquidCrystal.h>

#define WIRELESS 6
#define BUTTON 7
#define LED 13

// Define a metronome
unsigned long previousMillis = 0;

// Set the default interval to every 3 minutes -
//   enough time for a cup of tea
unsigned long interval = 180000;

// Instantiate a Bounce object with a 5 millisecond debounce time
Bounce bouncer = Bounce(BUTTON,5); 

// Instantiate Home Easy controller with transmitter on pin 4 and LED on 13
HomeEasyCtrl lightController(WIRELESS,LED);

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

// Instantiate Messenger object with the message function and the default separator (the space character)
Messenger message = Messenger(); 

// Flag indicating the desired state of the lights
bool deviceOn = false;

// Flag indicating whether bears are on manual!
bool manual = false;

// Last energy reading in watts
int watts = 0;

// Energy use messages
int energyUse = 0;
char* energyUseMessages[]={"Energy: low", "Energy: normal", "Energy: high"};

// Define messenger function
void messageCompleted() {
 int elementCount = 0;
 int last = 0;
 Serial.println("Message received");

 // Loop through all the available elements of the message
 while ( message.available() ) {
 elementCount++;
 int value = message.readInt();

 if ((value == 0) || (elementCount > 2)) {
 Serial.println("Oops");
 return;
 }

 Serial.println(value, DEC);

 // wait for same value twice for simple
 // error checking
 if (value == last) {
 watts = value;
 } else {
 last = value;
 }
 }
 Serial.println("Watts");
 Serial.println(watts, DEC);

 checkEnergyUse();
}

void checkEnergyUse() {
 if (watts < 50 || watts > 350) {
 deviceOn = false;
 previousMillis = millis();
 // Don't mind waiting for things to go off
 if (watts < 50) {
 energyUse = 0; // low
 } else {
 energyUse = 2; // high
 }
 } else if (watts > 100 && watts < 300) {
 deviceOn = true;
 previousMillis = millis();
 energyUse = 1; // normal
 // Want things to come on immediately
 lightController.deviceOn();
 } // otherwise, no change

 updateDisplay();
}

void updateDisplay() {
 lcd.clear();

 // 1st line
 if (manual) {
 lcd.print("Manual override");
 } else {
 lcd.print(energyUseMessages[energyUse]);
 }

 // 2nd line
 lcd.setCursor(0,1);
 if (deviceOn) {
 lcd.print("Polar bears: on");
 } else {
 lcd.print("Polar bears: off");
 }
}

void setup() {
 pinMode(BUTTON,INPUT);

 // Initiate Serial Communication
 Serial.begin(9600); 

 // set up the LCD's number of rows and columns:
 lcd.begin(16, 2);
 lcd.print("Ready");
 lcd.setCursor(0,1);
 lcd.print("Polar bears: off");

 // set up incoming message processor
 message.attach(messageCompleted);
}

void loop() {

 // Check push button for manual override
 if ( bouncer.update() ) {
 if ( bouncer.read() == LOW) {
 if (!manual) {
 manual = true;
 deviceOn = true;
 lightController.deviceOn();
 } else {
 if (deviceOn) {
 deviceOn = false;
 lightController.deviceOff();
 } else {
 manual = false;
 checkEnergyUse();
 }
 }
 updateDisplay();
 }
 }

 // The following line is the most effective way of
 // feeding the serial data to Messenger
 while ( Serial.available( ) ) message.process(Serial.read( ) );

 // Keep the device in the desired state
 if ( millis() - previousMillis > interval ) {
 previousMillis = millis();

 if (deviceOn) {
 lightController.deviceOn();
 } else {
 lightController.deviceOff();
 }
 updateDisplay();
 }
}

No polar bears have been harmed in the making of this post. At least not yet anyway.

Update: Seems to be working quite well, although the manual override button seems to have problems- it seems to randomly flip back on when I want it to stay off. Still, the button works well enough to pair with a Home Easy socket which is the main thing. Tree and polar bears should be up this weekend. (16 Dec 2009)

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.

Meet the team


It looks 2009 is the year for people I work with to start blogging, and they’re all on Twitter… coincidence? So if you’re looking for a good read, you might like to check them out. Starting with the newest blog…

February 2010 (the power of peer pressure brings out another blogger in the team in 2010!)

Iain’s Blog (@iainduncani)

A web 2.0 skeptical geek all rounder planning to write about technology, politics, growing vegetables, board games and walking.

October 2009

Ed’s World (@ejellard)

Off to a flying start with some great home automation with arduino, Home Easy, MQTT and a helping of hackery.

Limboworld’s blog (@jaylimburn)

Conducting a scientific experiment in to the value of blogging, so make sure you get as many people to read it as possible! Some good DIY posts to kick things off. (There would have been a few DIY posts here if I’d started this blog before fitting the kitchen!)

September 2009

The World Of Gavin (@gavinwillingham)

Definite technology slant with an enjoyable hint of grumpy old man which I’m definitely hoping will continue!

April 2009

Cobweb (@techcobweb)

Some really varied arduino projects in addition to home automation and tweeting cats. While the only circuit I’ve cobbled together recently is sitting in an ice cream tub in the porch, Mike is a master at packaging projects- his scalextric race timer is a work of art!

May 2006 (so blogging way longer than the rest of us!)

Nigel’s blog (@planetf1)

Not as easy to sum up given the number of posts but a distinct focus on technology of various kinds. Probably need to run it through wordle to get a better idea!

The trouble with making lists like this is that I am bound to have missed a few! I’ll just sneakily add more if I have… which reminds me, I was going to make more of an effort with a blogroll at some point soon.

Updated: another blog for 2010! (8 March 2010)