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:
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.
I did an interview and filled out a logbook with http://www.suslabnwe.eu/ 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 is obviously pretty banal but it is eye opening just how many electrical and energy related things are involved in such a mundane activity.
Air Quality Egg
AirQualityEgg NO2 data
Current cost electricity usage
Current cost electricity data
These two data source aren’t pumping out data anymore but you can see an example here.
The code is also on github.
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
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 4 day period
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
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:
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
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
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.
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.
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 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:
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.
The Chinese gardens
Le Corbusier house
Le Corbusier on the money
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.
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.)
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)
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)
Visualising the data
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
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:
My blog post on Cleanweb.org.uk about midata
I blogged over on http://cleanweb.org.uk about how midata will hopefully cause a lot of cleanweb innovation in 2013.