Radio Pi

I did this project for a fathers day present for my dad after he bought a Wireless radio that needed to pretty much sit on top of the router to get a connection, not great when he wants to listen to it another room! So the solution – a raspberry pi of course :)

The project is based on a Lee’s draught bitter beer pump box that my dad had lying around which made a (just about) perfect case for the radio. It was made with:

The radio is operated by two buttons to keep things simple. The first button starts and stop the radio streams, the second button if the stream is playing changes the station, if the stream is paused or stopped then it increments the volume by 10%.

It works well in general for a basic radio where the operator doesn’t want to bothered by too many buttons.

Lee's radio


Have fun with your radio :)

Robopi – it’s alive!

As a kid I used to love playing with remote control cars, scalextric and basically anything with wheels that moved. They fascinated me and to this day I still wish that I’d got into building up more powerful remote control cars with petrol engines and raced them :)
Fast forward 10 20 25 *cough* years and instead in my hands I’ve got a Raspberry Pi, a computer, a sensational device that costs about £30 and so far I’ve run one as a media centre for the TV running Raspbmc, hooked up one to my multi-room audio system and burglar alarm and built a GPS logger for a charity bike ride with another. So what next, well not quite a remote control car but not far off – a robot. Having come across the livebots website a couple of weeks ago I thought I’d give it a go.

My first attempt started with Lego, I picked up a couple of 4.5v motors and managed to put together a rather beastly (in the weight department) three wheeled bot. On it’s maiden voyage, it didn’t move, off the ground the wheels span so I knew everything was ok electronics and code wise so I weighed it in and it came to a staggering 500grams so I stripped some of the lego back and scaled it down. Enough weight was shed for it to then move backwards and forwards which was great, the only issue being the width of the rubber wheels and the fact the front one didn’t actually turn meant this bot was never going to be anything other than a straight line warrior.

Having looked around for another base to build up with, I noticed someone else had used a Magician kit which I sourced from Amazon. Within a couple of days I had the kit in my hand and set about building up a new robot. I’ve hooked a web cam up as well so that people driving the robot online can see where they are going, seems to work quite well but as always, I’m sure it could also be improved.
The way it works now is a simple html page with Jquery accepts user input either via Arrow keys, WASD or mouse clicks to move the bot around, this then sends an ajax request off to a Python script which is running as a HTTP server, this script process the requests and does the necessary GPIO pin changes to make the bot move around. mjpeg_streamer then streams the pictures back to the user on the same screen so they can keep an eye on what’s ahead of the bot.

The result:




And the web app side:

Web app


As I’m always now trying to do, I’ve shared the code used and instructions on how to get it up and running on Github.

Next stage will be to add some external sensors such as ultra sonic, light sensor and maybe a speaker to play some sound files depending on what the camera picks up.

GPS Logger

So a few of us are doing a charity bike ride from Manchester to Paris (if you fancy donating then please head over to which will see us doing over 400 miles in 5 days on our road bikes (non-motorised just in case you were wondering!). I thought it would be a great idea to let people track us online so you can see our progress in real time. Now you can do this simply with something like RunKeeper or Cyclemeter and it logs and displays in realtime and is known to work well, however that’s not me, I’m a techy at heart and have started to get into the Raspberry Pi more so I thought why not do a fun project with one and so my GPS logger started. It’s actually a pretty complete unit except for a case and a bit more code to make it tidier (first go ar writing Python code) so I’ll start by listing the kit that I’m using…


Kit List

I’ve posted the code on Github so please head over there for instructions on installation.
At present, I’ve put together a basic website which will display a map of our progress, you can see examples at present on the website this will show the current testing journeys that I’m doing for the build up to the big day of our ride.

I’m happy to help anyone in using this code if anyone has any questions about what I’ve done or am still doing.

Home control system – Sonos + Russound from a RaspberryPi

Lately I’ve been rediscovering my geek side and started to play around with the Raspberry Pi as more than just a media centre (thanks to Sam @ Not really being as involved hands on at work with Dev projects anymore has sort of pushed me to start doing stuff at home and the list of geek projects I want to complete is now growing :)

The first one that I’ve tackled after having the intention ever since buying a bungalow over 3 years ago and completely refurbishing was to put together my own ‘App’ which would allow central control of as much IT as possible. The refurb enabled me to run Cat6 through the entire property and install a multi-room AV system thanks to a Russound Cav6.6 unit, a couple of Sonos units as inputs and finally Raspberry Pi’s now that they’ve been released.

I use the term ‘App’ loosely as it’s a website in essence running Jquery mobile to give it an app like feel but it does mean it works on any device that we use in the bungalow without me having to learn different languages. So far I have hooked the Sonos system into it using PHPSonos which means that I can easily tell either Sonos unit to start to play a song like this:

$sonos = new PHPSonos('ip.ip.ip.ip');

Really simple, I’ve still got work to do to such as search Spotify and add songs/albums to the queue but for now you can play/pause, go forward or back a track, control volume and view the current queue.

The next part was to hook the Russound Cav6.6 system into the system, I’ve been using the rather (expensive) TCH-1 unit to control the Cav6.6 system as I don’t want to get into talking to it directly over serial at the moment. The TCH-1 system presents a web app over either wireless or wired which you can control everything. Because you can control everything it means it’s bloated and loading the page up to control the different rooms and sources takes a bit of time. A lot of the features in the TCH-1 were unnecessary for me but unless I replaced it with something else or got dirty with talking over serial then I was going to have to use it still. Luckily with a little bit of tcpdump magic I was able to work out what was going on. In essence the web app just queries a cgi script on the TCH-1 and threw commands at it then parsed the output so I decided to do the same. Being able to switch on a zone (each room is classed as a zone) was done by some simple code as follows:

        // First request to actually change power state.
        // value can be either 0 or 1 (off or on)
        $ch = curl_init();
        $header[] = "Content-type: application/xml; charset=utf-8";
        curl_setopt($ch, CURLOPT_URL, "");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_REFERER, '');
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
        $html = curl_exec($ch);

        // Now we need to refresh the TCH1
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_REFERER, '');
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
        $html = curl_exec($ch);

The second curl request ‘refreshes’ the Cav system so that the TCH-1 app still works and is in synch as well.

Each room has a corresponding XML file which you can query to see the status of the zone, power, source and a few other items.

$xml = simplexml_load_file('');

The XBMC section has only just been started on and I’ve just started to piece together some curl queries to test the different JSON-RPC calls that XBMC now uses since it’s ditched it’s http interface so I’ll come back to this at a later stage.

The final section that has just been added is a basic interface to query recorded motion capture events from a Microsoft HD-3000 web cam hooked upto a Raspberry Pi running motion. On the motion system itself I run a custom script on movie end which re-encodes the avi created file to an mp4 file so that I can then display this via the new video tag in HTML5 so that any videos can be browsed on my mobile from anywhere in the world. It then generates a new record in a MySQL table and grabs the lapsed time from mediainfo on the new file. This results in a quick simple interface where I can search for any day of recording and see how long each clip is which will indicate the length of motion detected.

I’ve got some screenshots from my iPhone below so you can see where I’m upto with it. I’ll break this post down into chunks and post more code to help others along, especially interfacing with the TCH-1 as their is little on google to help with this.

Home Screen:
Home screen

Sonos now playing:
Now playing

Current queue:

Room setup:

CCTV Files:

Play CCTV video: