From 5 kilowatts to 5 watts

I was in Bletchley Park last week for the Over the Air event. One of the highlights was a tour of the museum in which we got to see a reconstruction of the first computer the Colossus. Originally the computers were left on all day but now they are only switched on from time to time for tours due to the high cost of running them (and for environmental reasons).

Colossus computer at Bletchley Park

Colossus computer at Bletchley Park

The machines use a whopping 5.5 kilowatts of electricity and standing near them you can certainly feel the heat. The sheds in which they are kept apparently get pretty warm in winter too.

iPhone charging

iPhone charging

My iPhone by comparison uses only  5 watts (approximately)  or 0.1% of the power usage of the Colossus!

The increasing energy efficiency of computers is formalised in Koomey’s law which states that “at a fixed computing load, the amount of battery you need will fall by a factor of two every year and a half”. This trend has all sorts of interesting implications as it will allow computer to become smaller and more ubiquitous in the future.

Two sided horizontal barchart using d3.js

I knocked up a 2 sided horizontal bar chart in d3.js at work recently. The code is mostly stolen borrowed from Hidenari Nozaki’s excellent Creating a bar graph using D3.js blog post.

Here is what the graph looks like:

d3 bar chart

And here is the code. I’m very new to d3 so the code is very rough and ready.

The code is also on github and here is a live example.

An everyday activity: making soup

I did an interview and filled out a logbook with on home energy use. One of the activities was to document and take pictures of an everyday activity which was much easier to do as a blog post hence this post. Apologies if this bores you to tears!

Why did you do this activity

I made soup because I was hungry after work and had load of vegetables in the fridge that needed cooking!


Here are the step involved in me making soup:

  • Turns the lights over the kitchen work area (I usually leave half the kitchen lights off)
  • Read the recipe on my iPhone
  • Take vegetables out of the fridge
  • Turn the radio on
  • Boil some water in the kettle (usually takes two boils to fill the pot)
  • Open the window so the kitchen doesn’t stink up
  • Turn on the extractor fan
  • Set the timer
  • Put the stuff in the pot and stick the lid on the pot
  • Blend the soup using the hand blender


This slideshow requires JavaScript.

This is obviously pretty banal but it is eye opening just how many electrical and energy related things are involved in such a mundane activity.

Plotting Xively timeseries data using Rickshaw

Xively (formerly Cosm, formerly Patchube) now has a Javascript library for their API. I have been meaning to learn the Rickshaw library for awhile as it comes highly recommend from several people. It turned out to be a doddle to use. I just mixed in the moment.js library to do some date munging and was able to knock up some graphs in an hour or so.

Air Quality Egg

AirQualityEgg NO2 data

AirQualityEgg NO2 data

Current cost electricity usage


Current cost electricity data

Current cost electricity data

These two data source aren’t pumping out data anymore but you can see an example here.


The code

The code is also on github.

Plotting Air Quality Egg data using R

I recently got an Air Quality Egg. The Air Quality Egg is a open source hardware project to measure air quality hyper-locally. My egg is located on the balcony of my flat in Brixton, London. The Air Quality Egg device has sensors which read NO2, CO, humidity & temperature and posts the data to Cosm. You can view readings and simple graphs on the Cosm feed page.

Air Quality Egg on the balcony of my flat

Air Quality Egg on the balcony of my flat

Plotting sensor data using R

I wanted to see the trends in the data so I wrote a script in R to curl the data from the Cosm API and plot it using GGPlot.

Here is the script:

Here are some example graphs of NO2 over a single day and several days. (Note I don’t have the latest sensor updates so the readings may be a bit off)

Plot of NO2 for a single day

Plot of NO2 for a single day

Plot of NO2 for a 4 day period

Plot of NO2 for a 4 day period

Tip: A shortcut for accessing another MongoDB database from the shell

At uSwitch, I often work with multiple MongoDB databases as part of the same system. Recently I spent a lot of time in the Mongo shell jumping between the two databases to reset data to its initial state.

This requires several commands

use otherdb;

use originaldb;

Plus I often forget which database I’m in.

Happily you can use the db.getSiblingDB method to access another database without having to switch databases. This shorten it down to a single command:


The Internet of Things creates joy and happiness

I’m a member of Brixton Energy, a cooperative in South London that installs solar panels on social housing. The projects are crowd-funded by community members, with some of the profits used to support energy efficiency in the community. We are transparent about what we do and we want our investors to able to see the impact of their investments. One way we are doing this is by sharing how much electricity the panels are generating to anyone who is curious.

Opening up solar generation data

Unemotional data and graphs in solar log

Unemotional data and graphs in solar log

The solar generation data is logged to a website called solar log which came with the solar panel system. I wanted to integrate the data more closely with our website so I hacked together a really nasty script to scrape it from the solar log website and post the generation data to Cosm, the Internet of Things platform. In Cosm you can easily set up automated tweets based on changes to the data. I did just that and created a new twitter account @BES_Generation that tweets when electricity generation for the day exceeds 20, 50, 100, 150, 200 and 250kWh.

An unexpectedly emotional response

I set up the auto tweeting for my own use. First, to make sure that the data was posting successfully to Cosm and second, to get push notifications of how the solar panels were doing without having to visit the solar log website.

I was surprised by how cheerful and happy the tweets made me feel.

It might have been because it was March and winter was finally ending but the combination of sunshine, being involved in a cool environmental project and knowing my investment was doing well was a real buzz!

But then I was even more surprised that other people liked it too:



The real world causes real emotions

Real infrastructure in the real world - solar panels in Brixton

Real infrastructure in the real world – solar panels in Brixton

Usually data and websites themselves don’t produce an emotional response.

The Internet of Things seems different. It connects us to the physical world which is full of emotions.

In this case each tweet connected me to a community project that I am really proud to be part of and to the instinctive cheerfulness caused by a sunny day.

Zurich is better than you expect

I was in Zurich 2 weeks ago for the ICT for Sustainability conference. I was pleasantly surprised by how much I liked it there so I thought I would big it up.

Getting there

TGV to Zurich

TGV to Zurich

Zurich is easy enough to get to with the Eurostar and the TGV (I booked via Loco2). The journey takes about 8 hours, which is plenty of time for some pleasant hacking/reading/looking out the window, with a stopover for lunch in Paris. Its really straightforward and quick to change at Paris as long as you follow the advice given on the Man in Seat 61 website (which co-incidentally was the seat I end up in on the TGV between Paris and Zurich!).

The City


The city itself is in pretty good nick, presumably as it has been trashed in any of the numerous conflicts that the rest of Europe has had. There are trams everywhere including this one by the university that goes through a building.


The university where the conference was held was pretty grand too:

The university

The university

The Lake

The lake

The lake

On the Saturday I took a walk by the lake which is a close to the centre of town. Along the edge of the lake there is a few interesting buildings, including the Le Corbusier house (he is also on the money) and a Chinese Garden.

MFO Park

I ventured over to the old industrial side of town later on to visit the MFO Park, an old factory that has been converted into a park area. The mix of the industrial features is very well done and you can climb stairs to the top for views of the surrounding area.

This slideshow requires JavaScript.


By co-incidence I was in town during Carnival, which proved that the swiss do know how to party (or at least drink lots of beer and do brass band covers of sixties tunes.)

Brixton Hill’s not so local by-election candidates

Candidates are currently campaigning for the by-election to Lambeth council in the Brixton Hill ward where I live. Previously, council elections have just passed me by, but this one has caught my attention a lot (perhaps because its January and not much else is going on).

I have been following some of the candidates on twitter and UKIP candidate Elizabeth Eirwen Jones especially stood out. Her policies in support of cars seemed totally out of touch with the area I live in. It was like she was from another planet. After checking Lambeth’s council website which lists the addresses of each candidate it turns out she does live on another planet – planet Clapham.

Not so local candidates

Where Brixton Hill council candidates live (The brixton hill ward is in blue)

Where Brixton Hill council candidates live (The Brixton Hill ward is in blue)

In fact out of the 7 candidates only the two front runners Andrew James Child (Green party) and Martin Tiedemann (Labour) live in the ward. Three of the others live in Clapham and one lives in Vauxhall. But at least they live in Lambeth – one candidate Daniel Lambert (The Socialist Party) lives many miles away in Chislehurst.

One candidate lives in Chislehurst (bottom right)

One candidate lives in Chislehurst (bottom right)

Visualising the data

I built a little website to visualise the candidate addresses using the leaflet.js javascript library that runs on top of OpenStreetMap. I got borough and ward overlays from MySociety’s MapIt project. The code is on github.

Creating an application form style layout using Prawn

I used the excellent Prawn gem recently to create a PDF. I needed an application form style like layout for the PDF like this:

Simple form layout

Simple form layout

Using Prawn this is straight forward. We just create two bounding boxes one for the left side and one for the right side of the page. Then we render the labels into the left bounding box and the form boxes into the right bounding box.

Filling in the fields


Filled in form

In some case I need to fill in the fields as well so I generalised the code into a method that takes a hash: