Book update

Just a quick update on the book. It is currently going through the pre-final proof reading stage where hopefully we will weed out any typos!

Once I have a confirmed release date I will include those details here – we are looking at around the end of February for it hitting the stores I would guess though.

For anyone that buys it and has comments or questions you can use this blog as a medium to contact me.

Gertboard built


I spent some time setting up the Gertboard. This should make an interesting expansion to the home media center.

Here we can see the board under construction:



And here it is setup ready to be plugged into the RPi.

Setting up the Gertboard

Setting up the Gertboard

My next task will to find a good case for the Gertboard or to use the 3D printer to create one.


Raspberry Pi powered TV and dd-wrt router configuration


Yesterday the snow hit so I decided to try to knock off some projects that had been on the back-burner.  Two of these were related to one another, the first being setting up my spare wireless router as a client bridge and the second setting up a Raspberry Pi with raspbmc.

Completing these two projects would allow me to create a Media Center for television and music.

Wireless router – client bridged mode

I had spent several days deciding  whether to use the wireless router I had spare to create a second network at home (not connected to the Internet), or to use it in client bridged mode.

In the end I opted for client bridged mode. The wireless router has a number of Ethernet ports located on it and would be perfect to place next to my TV as this is nowhere near my existing Ethernet switch. With this in place I could then run a short Ethernet cable from my Raspberry Pi into the wireless router and then stream TV over the wireless connection back through the Ethernet connection to the RPi and then over HDMI to the TV.

This image from the dd-wrt website shows an example of a network setup using two wireless routers one in client bridged mode:


Client Bridge example from

Setting up the wireless router was fairly straight forward. I used a Cisco Linksys E4200 router and installed the dd-wrt software onto this.

Linksys E4200

Linksys E4200

You can check your wireless router to see if it is supported at the following link:

Once you have found your router download the firmware and follow the instructions on the dd-wrt site. There are a number of warnings on there to help you avoid ‘bricking’ (screwing up the router so it as much use as a brick) your router.

I would recommend following these as it will cause you less pain in the long run.

Once you have the router setup, follow these steps to set up the router in client bridged mode:

If everything goes well you will now have a second wireless router connected to your primary wireless router and can then use it with the Raspberry Pi.


Raspbmc is a version of the Debian Linux distro specially compiled for the Raspberry Pi to turn your Pi into a XBMC media center.

Installing it is fairly straight forward. Format  an SD card and then follow the steps located here depending on what machine you are using to format the card.

Once you have the SD card ready to go you can hook up your RPi to the wireless router, TV and power and get things started.

Raspberry Pi

Raspberry Pi

Note: If you have problems with the HDMI cable not displaying a picture, try the steps at this link:

When the Pi boots up it will run through the Raspbmc installation process.

Raspbmc splash screen after installing

Raspbmc splash screen after installing

Once the installation is complete you will now have the XMBC media center ready to start using.



Accessing the IP# of your Raspberry Pi via a web browser on port 80 will give you access to the ‘remote control’


From here you can navigate through the menus on your TV and access content.

A wide variety of content is available on Raspbmc ranging from BBC iPlayer through to Hulu.



You can find instructions on installing the various TV networks software from the UK, US, Canada, France etc. at these following links:

General plugins:

UK TV specific:

Some content will not work in your area due to restrictions, for example BBC iPlayer TV content is not available outside of an UK IP address range (however radio is). seems to be a popular choice for circumnavigating this – Disclaimer: I’m not sure what the legalities of this are so you use these services at your own risk, if you don’t know it is probably best to avoid it.


So there we have it, a simple XMBC media center running on your Raspberry Pi that you can use to stream TV, radio and other media from.

You can read more about XMBC’s features and quick start guide at the following URL:

I have  Gertboard ready to build for this Pi as well, so I will be looking at what I can use this for in my media center.


Raspberry Pi to Arduino shield thermostat – a sneak-peek

Here is a sneak-peek of the Raspberry Pi to Arduino shield based thermostat project I have worked on for the upcoming book.

The prototype you see below is part of a project in one of the chapters:

This uses a relay shield attached to the Raspberry Pi to Arduino shield. The relays are then switched on and off based upon a change in temperature. Connected to the relay shield is a wall powered electric fan.


A quick update

Just a quick post with some updates:

Commercial Home Automation

There are a number of products out in the market I;d like to give a test run and review here. I’ve listed a couple of these below. Unlike X10 these devices use web based techology.


Lowes have launched their own home automation tools known as Iris. You can see a variety of the devices here:


Like Lowes Belkin aso have their own home automation devices under the WeMo brand:


I’ve been experimenting with dd-wrt using a spare wireless router I have at home. It’s a great piece of software and allows you to turn a second wireless router into a bridge-relay for your existing network. I think I will actually end up using it for creating a second more secure network for running my home automation devices over. I can then use the existing wi-fi network for regular surfing, netflix etc.


So after a long wait the Gertboard has finally arrived. It is in kit-form so I’ll be spending some time soldering the components together. Keep your eyes peeled for further updates on this!


Gertboard Kit

Gertboard Kit


Raspberry Pi to Arduino connection bridge experiment – DC Motor

I’ve been doing some experimentation with the Cooking Hack Raspberry Pi to Arduino connection bridge for the upcoming book.

Here is a quick sneak-peak of an experiment I conducted when testing out some of the hardware.

The video below shows a combination of a Raspberry Pi, the Cooking Hacks shield, an Arduino motor-shield  a small DC motor and a circuit consisting of a resistor and photo-resistor.

The software in the background is processing the feedback from the photo-resistor and deciding when to turn the motor on and off, and in which direction. This software also generates the necessary PWM for the motor.

In the video I cover the photo-resistor to turn the motor clockwise and then uncover it to turn it counter-clockwise.


P.S Thanks to Andy C on the Cooking Hacks forum for pointing me in the direction of using C threads for PWM.

Raspberry Pi to Arduino Bridge

I came across this neat little board the other day:

The Bridge looks like an Arduino shield and connects to the GPIO pins on your Raspberry Pi. After setting up the software you can then hook up Arduino shields to your RPi.

This obviously opens up all sort sof possibilities as there are an array of Arduino shields out there that are capable of some great functionality.

This is also open up the Raspberry Pi for building sensor projects, something I will be exploring in latest posts.

Quick updates


For those of you not familiar with it, the Gertboard is a microcontroller kit for the Raspberry Pi that comes with a variety of add ons (motors, sensors etc.)

It hasn’t shipped in the US yet, however I have pre-ordered it and will be doing a review once the equipment arrives.

In the meantime you can read more about it at the Element14 site.

Potential book

As a result of this blog there is the potential for a book in the works, more on this when/if it develops further.

Punching cable

I recently got a crash course in punching cable and wiring up Cat 5 and phone cable. There is a post in the works on this, where I will explain the relevance for home automation.

Installing HTSQL on RPI


As I have mentioned in earlier posts I am planning on using HTSQL as part of my heating system. It will primarily provide me with a way to query data stored from the controller and thermostats over HTTP.

Eventually it will be pointing to a PostgreSQL DB which will act as my area for data storage.

Below are instructions on how to install HTSQL on your Raspberry PI.

Installation instructions

Note: The instructions presented are for installing HTSQL on a RPI running Debian squeeze. If you are looking for the Mac instructions they are located here. For other flavours of Linux available on the RPI the instructions should work, I make no promises though!

As always, you can check for up-to-date information on operating systems supported and instructions.

Anyway on with the installation process:

The Raspberry PI runs on an ARM based architecture. On last checking the htsql website, there is no support for this via apt-get.

You can check the architecture of your chipset (which of course will be ARM if you are following the steps for your RPI) as follows:

apt-config dump

You will see in the returned information:

APT::Architecture "armel"

If you attempt to follow the standard apt-get procedure as presented on the htsql website for Debian, you will run into the following error message:

E: Unable to locate package htsql

This is because there is currently no armel distro.

So in order to install HTSQL, you will need to install via source.

Install pip

In order to run pip (a python package installer) you will need to add it to your RPI.

Run the following command :

sudo apt-get install python-pip

Once this is complete you can then run:

pip install HTSQL

Once this is complete you can now type:

htsql-ctl version

You should now see:

HTSQL 2.3.1 (or whatever the latest version is you downloaded).

HTSQL is now ready to go!


Out of the box HTSQL works with sqlite, if you want to run it against other databases you can follow the instructions here.

Follow up posts to this will detail setting up a PostgreSQL DB server and then connecting to it via HTSQL.

Raspberry PI – Network access


One of the benefits of having a machine like the RPI is that you can set it up on your home network and access it without having to worry about a keyboard, mouse or monitor.

Combined with the RPIs small size, and the ability to place it in a custom case with a wall mount, these features are what make it one of the most exciting tools for home embedded/smart systems.

The steps below are an introduction on getting your RPI to boot up with ssh access, and allow you to connect to it from another machine on your home network.


So what is ssh? In brief ssh (secure shell) is a method that allows us to log into other machines over the network, most commonly through a command line tool (for those of you with a Mac you can do this via the Terminal). Once logged in, depending on our permissions we can then perform actions on the machine we are connected to.

For a deeper more complex technical evaluation of ssh you can read the wiki article here.

For the purposes of configuring our RPI (and later using it as a controller) we are going to be setting up ssh access so we can work on the machine remotely.

In my specific case, this is born from the fact that my router is nowhere near my TV set so trying to configure the RPI with a monitor, but without network access is going to be impossible in some cases i.e. installing HTSQL.

Steps to set up 

Fist of all connect your RPI up to its power supply, monitor and keyboard. Then log in.

Raspberry PI login

Raspberry PI login

At this point you may want to set the date of your RPI if you haven’t done so already.

By default the keyboard is set up to be UK format, so the @ is actually the ”

To set the date:

sudo date –set “23 APR 2012 16:01”

Next you will need to set the RPI to start ssh when it boots. To do this follow the next steps:

  1. cd /boot/
  2. sudo cp bootenable_ssh.rc boot.rc

The above copies bootenable_ssh.rc and creates a second version called boot.rc. The boot.rc version is then loaded when you start your RPI up.

Now follow the next steps:

  1. cd /etc/network
  2. vi interfaces

By default vim isn’t installed on the RPI, so if you haven’t taken the step to install it, you’ll need to use vi to edit the interfaces file.

You’ll need to edit the settings in the interfaces file as follows:

  1. Add eth0 to this line: insert eth0 so : auto lo eth0
  2. Change iface eth0 inet dhcp  to  iface th0 inet static
  3. Now add:

Finally save the file  – press  : then type x and hit enter to save and exit
The above steps have now added configuration to tell the RPI to run on a static IP address on your local network.

Testing the above worked

You can now log out of your RPI and power it down.

Next, boot the PI back up with your network jack attached. Your PI should now boot with ssh enabled.

Raspberry PI hooked up

Raspberry PI hooked up

I plugged my PI directly into my Cisco E4200 router. I then logged into it via in my web browser (type into the address bar) – note this may be different on your home network depending on how you have configured it.

If you have a Windows machine for example and your router is plugged into that, you can run:


Now look for Default Gateway, this will give you the IP address that the router should be running on.

Once your PI is powered up and booted (you should also see a yellow light, indicating you are on the network) you can shell (ssh) into your server.


The fixed IP address you assigned may not work. To test if it did try:

 ssh pi@

If this does not work, log into your router and check the DHCP Client table. Most of the devices I run on my network have a client name e.g. kindle-xxxxxxxxxx.

You may now see a device appear in the list with no name. To confirm which device is your RPI, you can try disconnecting it, refreshing the DHCP client table, reconnecting it and then refreshing again. The new device added to the list is probably your RPI.

Next, take the new IP address from the table and shell into the machine (via Terminal, console, Cygwin or whatever you are using):

ssh pi@

This gave me the authenticity message which I accepted. I then entered the default password for the PI, and presto! I am now logged in.


So I need to investigate how to ensure the static IP is always picked up, I’ll blog a separate post on that for those of you having problems.

For the moment we now have an easy way to get access to the PI without a monitor and can go ahead and install whatever packages we need.