Bang went the theory…

As with yesterday’s post, I really don’t have to do too much work on this one, as the detail has already been written up elsewhere…

If you watched this week’s edition of Bang Goes The Theory on BBC1, you will have seen Nick O’Leary and Kevin Brown from IBM Hursley helping Jem and Dallas to drive taxis. That probably wouldn’t have been entirely revolutionary, had it not been done through a combination of an Emotiv brain-signal-reading headset, and some MQTT and Arduino funkiness… no hands on the wheel or feet on the pedals!

Nick has a great write-up of what sounds like a fun (but cold) event. You may still be able to catch the fun on iPlayer, or there are some clips over here.

(Image: Creative Commons Attribution Non-Commercial Share-Alike (2.0) from knolleary’s photostream, used with permission – full set)

A different kind of TV remote control

I’m very excited to be welcoming another Hursley innovator as a guest here on eightbar – Benjamin Hardill (you can find him on Twitter as @hardillb). Here’s some insight into what he’s been up to lately! More home automation, hardware hacking, and MQTT messaging adventures follow 🙂

I got a new TV around Christmas last year and while unpacking it I noticed along with the HDMI, SCART and other sockets on the back it had a 9-pin socket labelled "RS232C IN CONTROL&SERVICE". I didn’t think that much of it at the time, but I remembered it last week while thinking about a couple of problems that had come up.

Tidy TV setup The first of these was that I had got home twice recently to find I’d left the TV turned on while I was at work, this was mainly because I use MythTV and I’d left it at the menu screen rather than turning the screen off as well. This had left shadow on the menu on the screen for a day or so afterwards (luckily no permanent damage as would have happened with a plasma or CRT TV).

The other point was from when we all first got hold of our Current Cost meters, there had been a lot of thought about how to work out exactly what appliances were on at any given time. While spotting when things like an electric water heater turned on was relatively easy, it was proving difficult to spot some of the lower power devices.

A plan started to form and I ordered a null modem cable from Amazon (£2.18 with free shipping) and went looking for some documentation on the protocol. The manual that came with the TV while being nearly an inch thick just covers the basics of how to plug it in and turn it on, but there was a CD-ROM with a much more detailed PDF document. The version for my TV is here. While searching round I found manuals for several other LG LCD/plasma TVs and they all seem to use the same basic protocol.

The protocol is relatively simple

[cmd1][cmd2] [setid] [data]

Where the cmd1 & cmd2 are 1 letter code, setid is for if you have multiple TVs connected to the same cable, the default id is 01 but you can change if needed, using 00 will work for all connected TVs. And data is a hex value of the option to pass the command.

The response from the TV looks like this for a success

[cmd2] [setid] OK[data]x

and like this for a failure

[cmd2] [setid] NG[data]x

The command to turn the TV on and off is "ka" so sending

ka 00 1

turns the TV on and sending

ka 00 0

turns it off. Most of the commands will reply with the current status if they are passed ff as the data. So sending

ka 00 ff

gets the following when the TV is off

a 00 OK0x

So now I had a way to turn the TV on and off along with checking its current status. The next step was to surface this some way and given the fascination we all seem to have with messaging, MQTT seemed like a good idea. A little bit of Java and the Java COMM API later and I had 2 topics TV/Commands & TV/Status.

I already have a topic that publishes if my mobile phone is in the flat by pinging it with Bluetooth. Combining this with the two new topics I can ensure that the TV is turned off when I leave. I’m also wondering if I should start to log the amount of time the TV is on, but I think the results may scare me a little…

Hursley: where innovation happens

I’m over in the US at the moment, and I was out of the office all of last week as well, but I see that the BBC has been visiting my friends and colleagues at the Hursley mothership.

The coverage is in two parts. Firstly there’s a nice article on the BBC News website which talks about the history of Hursley, some of the software developed at the lab such as CICS and MQTT, and (of course) Andy Stanford-Clark’s twittering house.

There’s also a set of interviews with IBMers such as Kevin Brown talking about the twittering Hursley minibus, in the May 5th episode of the Digital Planet podcast (here’s a direct link to the MP3). The IBM coverage starts from around about 17 minutes in to the programme.

So, if you were wondering what wild and wacky things we get up to at Hursley – we do a lot of different stuff, and it can be very cool indeed 🙂

The amazing MQTT-enabled ducks!

This is a guest post by Hursley’s Chris Phillips (aka @cminion on Twitter). Take it away, Chris… and you’ll find more from him on his blog.


Many eightbar readers may have received one of those gadget catalogues you get through the door, with weird and wonderful widgets to ostensibly help with everyday life. “How have I ever coped without a Wifi Fondue set?” and similar thoughts may have run your mind. However, one thing these catalogues aim to promise is the integration of technology into everyday life; the dream that if technology is pervasive enough, it could remove all those little annoyances that we experience: forgetting a recipe, not knowing when our friends are turning up at the pub, having to get up twice to make a cup of tea, and so on… missing a phone call, because the phone is not loud enough, or set to vibrate, or other such vagaries of the modern telecommunications device. If only one could make a normally unobtrusive device that would alert one to a phone call, or a doorbell, or a new email, in fact pretty much anything!

Back in January I made some MQTT ducks. The aim was to make them flash on or off when receiving signals from my Ubuntu server.

Now, you may wonder why I would want 20 rubber ducks to flash when my phone goes off. Well, this was about the same time as I decided I wanted to make a unobtrusive alerting device. There is no scientific or technical reason in itself. I just had a Mini Cooper’s worth of rubber ducks sitting around, unemployed. Therefore I designed a simple project to get to grips with the world of Arduinos not only educating me but also putting the lazy mallards to use. I found some cheap fairylights just before Christmas and had the aforementioned large supply of rubber ducks (as you do).


  • 1 x Freeduino
  • 1 x 20 LED Fairy lights (£3)
  • 1 x USB Printer Cable (via
  • 20 x Rubber Ducks



  • GlueGun (£1.50 from Woolworths during the closing down sale)
  • Scissors

The construction was very simple. Making a small hole in the bottom of each duck, I inserted an LED and glue gunned it into place. I checked the effect with the batteries to see the result.


Removing the battery component with a pair of scissors and stripping the wire coating revealed the multi-core ends. These were plugged into the digital pin thirteen and the digital ground on the Arduino. To confirm the wires were plugged into the correct pin I pressed the reset button. The ducks and LED thirteen on the Arduino would then quickly flash.


Coding for Arduinos is very basic. The program I wrote received a 1 or a 0 down the USB cable. When it received a 1 (49 in ASCII) it turned the ducks on. When it received a 0 (48 in ASCII) it turned them off.

int LEDPin  = 13;
int inByte =0;

void setup() {
void loop(){
    if (Serial.available() > 0) {
      inByte =;
    if (inByte == 49 ) {
    if (inByte == 48 ) {

To connect this to my Really Small Message Broker using MQTT, I modified an excellent & simple Perl script written by Andy Stanford-Clark. His script reads RSMB topics for specific entries. I created a listener that watched for messages being passed on to the Ducks/ topic. If the content of the message was on it sent 1 down the wire to the Arduino, and if it received off it sent 0.

Next move… well someone at Pachube put forward the idea on Twitter of controlling with their infrastructure. Now, I can send an on or off message to a Pachube feed using Twitter. My server at home then checks this feed every 15 seconds for any changes and sends a message to my RSMB as required.

Thanks to the guys from for providing their leftover ducks and for providing the USB cable!

Mad scientists?

IMG_3669 4.JPG IMG_3670 4.JPG

Just an average day in the Hursley tea bar!

Martin Dix from CurrentCost visited to deliver a bunch of meters for people who had attended Home Camp 08. Whilst he was with us, Andy Stanford-Clark hooked up a (battery-powered) meter to one of his mousetraps to show how it is possible to detect traps going off using the meter – this is the same technique he uses in his automated home system. He also showed the same message arriving in his MQTT broker on his Ubuntu laptop. The table was soon awash with gadgets, wires and tools. I brought along a camera or two, Dale brought along some questions about the software internals of the new devices, and a great time was had by a bunch of geeks over tea…

No mice were harmed during this meetup, but a few wooden coffee stirrers were put through their paces in some vicious mousetraps.