Third party cookies may be stored when visiting this site. Please see the cookie information.

Home Babies & Children Gallery Information Free Software Reviews Blog

Stewart's Blog

Monkeys, megabytes, medical and more ...

(Children, computing, first aid and other ramblings ...)

Adding a home disk to virtualbox virtual machine – Ubuntu VM

January 26th, 2015


Recently I ran out of space when using a Virtualbox virtual machine. Normally I use a dynamic disk that allows resizing (typically setting it to be much larger than I expect to use), but in this case I am using a virtual disk provided for me. It’s based on VMDK and Virtualbox does not have support for resizing a VMDK disk.

A lot of the space was used in the home directory (in my case this was different versions of Android software development kit) I added a second virtual drive and migrated the home partition over to the new drive, similar to how I’ve done it with real physical disks on servers before.

I have updated this after some more research into how VirtualBox handles drive allocations.

Warning !

First backup / clone your vm if not already done so.
WARNING – if run incorrectly you could lose all your data. the drive letters mentioned below may not match your virtual machine in which you will need to change the drive reference in the commands or you will lose data. Do NOT copy and paste the commands I have used unless you are 100% sure that you have the same setup as mine.

If you are using Linux as the host computer for the virtual machine then make sure you enter the commands on the appropriate system. Running the cfdisk / mkfs commands outside of the virtual machine could damage your host computer.

Adding the virtual disk drive

Create a second disk drive through the virtual machine manager

Choose a dynamically allocated disk and choose a large size – it will only use the size required, but can then expand so hopefully you won’t need to go through this again. I created one approximately 30GB in size.

I believe the name of the disk drive determines the order initial order in which it is listed and hence the drive letter allocated. It does not matter as we will be using a unique non-changing reference for each drive, but this will determine the exact commands that need to be run. Choosing a later filename (alphabetical) may avoid having to install grub onto the new disk (the last step).

You can also change the drive slot allocation by click on the drive in question and looking at the attributes shown to the right. A lower SATA port number will result in a lower drive allocation (eg. SATA 0 is normally /dev/sda – SATA 1 is normally /dev/sdb).

Virtual machine adding disk VirtualBox virtual machine manager

Start the virtual machine – boot using the existing drive

Depending upon how the disk has been attached it may complain about not being a bootable drive. You can either go back to the settings and change the drive to a higher slot location (eg. SATA 1 instead of SATA 0) or reboot and press F12 to boot from the second hard disk. We can fix this later.

Partition and format the new drive

Assuming that /etc/fstab uses the UUID (blkid command) of the disk drive then it should not matter if the disk allocation has changed for the drive.

From a terminal run df to determine the drive used for your root hard disk

Virtual machine adding disk - df show existing file systems

In this case it’s at /dev/sdb1 and so we need to make sure we don’t do anything to drive sdb as that’s our main operating system and current home directory. This may be different on your computer – MAKE SURE YOU CHECK!

ls /dev/sd*
and look what other drives exist. The physical drives are the ones without a digit on the end, which on my system are sda and sdb (sdb is the one that’s in use and so sda must be our new disk drive).

Partition the drive using the following command making sure that you use the correct drive.
cfdisk /dev/sda

Partition second hard disk for virtualbox vm image

Check that there are no partitions already defined and that the size in the top right matches the size of the drive you created. If not STOP!

Use NEW to create a new partition – accept the defaults of primary and use the entire disk size.

Choose WRITE and then QUIT.

You will now have a new partition with the device name previously but with a 1 on the end. In my case /dev/sda1

You can now format it as a Linux (ext4) partition using

sudo mkfs.ext4 /dev/sda1

MAKE SURE YOU ARE RUNNING THIS AGAINST THE CORRECT PARTITION. This will destroy all data on the partition and will NOT ask for confirmation before formatting the drive. Run a df again first to make sure and don’t use a drive if it’s listed.

Copy the data from the home directory

After formatting the drive it can be mounted to a temporary mount point

sudo mkdir /mnt/home
sudo mount /dev/sda1 /mnt/home

Check that it’s mounted correctly
ls /mnt/home
you should just see the one file called lost+found

Assuming you are not using an encrypted home partition then run the following:

sudo rsync -aXS /home/. /mnt/home/.

You may get a warning about not being able to copy .gvfs – you can ignore this warning.
You may also get a warning that some files/attrs were not transferred.

If you want to check that the copy has worked correctly then run
sudo diff -r /home /mnt/home

Note you will see the following differences which are all OK
lost+found (only in new copy)
.gvfs (only in old copy – not required)
Plus any files on the home directory that may have changed since the rsync (eg. .lesshst on my computer)
A list of about a dozen differences is normal, if you see some of your documents in the list of differences then the rsync may not have completed properly.

Update fstab and remount the drive

Now add the new drive to /etc/fstab. You need to add the drive using the UUID which is found using

blkid /dev/sda1

The entry should then be added to /etc/fstab in the format
UUID= /home ext4 none 0 0

as shown below

Adding second virtual hard disk for virtualbox vm image /etc/fstab

Now rename the current folder and create a mount point for the drive

cd /
sudo mv /home /home.old
sudo mkdir /home

Now run
sudo mount -a

You should find that the drive is mounted in the new location.

Whilst a reboot is not required then I think it’s a good idea to do one at this point to make sure everything is working, before removing the old home directory.

Grub setup

The virtual machine will attempt to boot from the first disk. If the new disk is earlier in the drive list than the main disk then it will try and boot that instead.

You should be able to change this by changing the drive slot allocation in the VirtualBox setings, but you can on a temporary basis hitting F12 each time you boot the VM.

If you have created a disk that is appearing earlier in the system (and have to use F12 to boot the system) then you can install Grub onto the new disk image so that it can boot from either drive (it will still look for the operating system on the original disk).

To install grub to the new drive

sudo grub-install /dev/sda
sudo update-grub

Rebooting the virtual machine should now boot straight into the virtual machine.


This is one way of increasing the storage on a virtual machine by adding a second virtual disk drive. There are other ways of achieving this (eg. cloning the disk into a different disk drive), this one has the advantage of creating a different virtual home drive which could be useful if you want to access the drive in another virtual machine image.

An alternative is to clone the existing drive into a larger drive. You can then create another partition on the drive – or if you want to be able to increase the existing partition, it is possible using gparted as long as the drive is not mounted. This may mean having to attach your disk drive to another virtual machine.

Energenie infrared socket and Raspberry Pi infrared

January 22nd, 2015

I have already posted about the Energenie wireless remote control sockets. I’ve now had chance to look through one of their other products – which is an infrared remote control socket. This is a power saving socket allowing a TV and associated equipment to be fully powered off from the mains socket using the normal TV remote. I have seen the sockets before and wondered whether they were actually that easy to use. In particular I wasn’t sure how it would be possible to use the same remote control to control both the TV and the power socket. The way it does work is that there is a 10 second delay between the socket being powered on and being able to power it off again (giving time to turn on the TV without inadvertently turning the power back off) and a delay of 10 seconds after the power off is pressed before it cuts power (allowing the TV to shutdown properly). This works great with my bedroom TV setup.

In my bedroom I have a TV and a Raspberry Pi running OSMC with Kodi (formally Raspbmc with XBMC). As standard it is not possible to fully power these off using the remote control, so before I used the Energenie infrared socket these were left powered on after use with the TV often being left in standby when not required. I have now connected these to the Energenie Infrared socket using an extension lead. To power on the TV I use two presses of the on button on the TV remote which powers on the socket and then the TV. At this point power is applied to the Raspberry Pi so that powers on as well. To then shutdown I first choose shutdown from the Kodi menu so that the Raspberry Pi shuts down cleanly then press the power button which turns off the TV and then 10 seconds later the power is turned off at the socket.

Remote control using the Energenie Infrared remote control board

As well as making a socket, Energenie have also released a Raspberry Pi add-on that provides a way to receive and send infrared signals. The circuit is fairly simple and details are provided so you could make one yourself, but the Energenie board provides this in a pre-built board (no soldering required) which can be plugged in to the top of the Raspberry Pi.

Setup isn’t quite as straight forward as the wireless ones as you need to lookup your infrared remote codes, or enter learn mode to teach LIRC about the remote control. It’s fairly easy for most remote controls, although it doesn’t work with some media centre remote controls (including these). I believe this is because a kernel module is required which is not included in the standard Raspbian install, I expect this is required to enable the “mouse” support from the remote control. The IR transmitter also needs to be in line-of-site with the sensor for the power socket (fortunately there is a long lead provided to the sensor).

It does however open up a whole world of other opportunities and I will be writing about at least one other use in future.

Buying the infrared socket and infrared Raspberry Pi controller board

The infrared socket has been available for a while and is available from a number of suppliers. At the time of writing the infrared controller board is a new item and is only available from a limited number of suppliers. Below are some of the sources I found.

The Energenie infrared remote socket is available from or Energenie4U. You may also find it at some electrical or diy stores.

The Energenie IR controller board is available from Before buying do check whether it’s a pi-mote (wireless) or a infrared board for the Raspberry Pi to ensure you purchase the appropriate board.


I am impressed with the Infrared Remote Controlled socket. It provides an easy way power off a TV and accompanying Raspberry Pi, without leaving it on standby and without needing to get out of bed to do so. The Raspberry Pi infrared board also allows this to be controlled using a computer or could be used for control of other infrared devices.

If you are just wanting to control a power supply using the Raspberry Pi then the wireless sockets are easier to use and don’t required line-of-sight, but if you want to be able to use it with a standard TV remote control then this works well.

This review is based on an evaluation unit provided by Energenie.

Git – Version Control that’s addictive

January 20th, 2015

Git is a version control system. A way of keeping regular backups of files which is particularly useful for creating computer source code.

I’ve used other version control systems before (CVS and Subversion) and other tools that provide an element of version control (eg. Dropbox), but so far I’ve only really used them when I needed to for specific software projects. Elsewhere I’ve been manually creating backups as required, which includes the code and data files used in my websites. I first starting using git almost 2 years ago and continued to use it in the same way as I did before. I’ve since learned more about Git and my use of version control has now completely changed.

GitHub profile - Stewart Watkiss / PenguinTutor

I had picked up the basics of git through some projects I’ve been working on and I started using it for my own projects, but just by having an account on github and pushing my open source project code there. I had read up on how to use git, but was just using it in a similar way to how I used the other version control systems before. I am now studying for an MSc in Computer Science with Georgia Tech and my current class on Software Development Process (CS 6300) includes git as one of the “tools of the trade”.

As well as the course video I have watched a Udacity course. Note that Udacity also provide the platform for my degree course which is where I found this course.

Udacity course – How to Use Git and GitHub

Simple personal git repository

GitHub is the main provider of git repositories and is free for open source projects. It does support private repositories, but there is a charge for this. The cost is reasonable and it provides the reassurance of a professional run server but I just wanted something that I could run on my own server. It is possible to install a full blown git server using GitLab, but for a basic repository it’s possible to create a basic server just using ssh – which I already had installed.

I created a git user with login restricted to git shell (/usr/bin/git-shell) and copied my public key for my other computers to /home/git/.ssh/authorized_keys

I then created directories for each of the repositories and initialized them as git repositories using

git init --bare

and I could then push and pull to the repository.

Note that as I’d disabled login as git I switched to the git user using
sudo -su git

I’ve used this for maintaining the files used for my websites.


These are some of the customizations I have done.

git config –global “User Name”
git config –global
git config –global core.editor “vim”
git config –global push.default upstream
git config –global merge.conflictstyle diff3
git config –global color.ui true

Download completion

In .bashrc
I added the entries

source ~/git-completion.bash
source ~/
export PS1=”$purple\u$green\$(__git_ps1)$blue \W $ $reset”

More information

There is lots more information available on Git. Here are a few I’ve found useful.

Changing from RaspBMC to OSMC – static IP address and remote connection

January 5th, 2015

I’ve been running XBMC using RaspBMC on a Raspberry Pi for some time. I’ve digitised my music and videos and this allows me to watch them on various TVs around the home accessing from a central server PC. Recently the XBMC project has now renamed itself as Kodi to reflect that it has changed from it’s original idea as a X-Box Media Centre. RaspBMC is going through a similar transition rebranding itself as OSMC (Open Source Media Centre) which will also see other platforms supported in future.

OSMC Kodi - running on a Raspberry Pi

As I write the initial version of OSMC is in alpha, but there have been many performance improvements that I wanted to try it out before waiting for the final version. Whilst I have RaspBMC in my lounge as well it is only the one in my bedroom that I have upgraded so far. I have only just installed it, so have not yet been able to put it through a rigorous test, but so far I am very impressed with the performance improvements. The interface is more responsive and fast-forward and rewind inside a video work much better. When I upgraded I did take the opportunity to switch to a faster SD card, but I believe the majority of the improvements are down to changes in the way that Linux is setup and configured and the performance improvements in the latest version of Kodi. I am still running on the same Raspberry Pi as before with only 256Mb of memory (an old model B), although the recommended configuration is a Raspberry Pi B / B+ with 512Mb of memory. There are however a few things missing from the old version including a way to configure a different network configuration which I’ve provided some details of below.

Easy installation

Raspbmc is already well known for it’s simple configuration and install procedure, but that has been made even easier for OSMC with an automatic installer which provides an application that can download and install the image onto an SD Card. The installer is available for Windows, OSX and Linux. The installer does provide an opportunity to configure the network interfaces manually at this point, although I’ve instead provided instructions to do this manually below.

Once the image is copied to the SD card it’s a case of putting that into the Raspberry Pi and then waiting patiently for a few minutes whilst it completes the install. After a reboot it looks similar to the old XBMC on Raspbmc, but it says Kodi in the top left.

No Operating System Configuration tool

One of the good features of Raspbmc was the RaspBMC configuration tool which provided a way to configure OS specific features through the TV interface. This is no longer available in OSMC or at least not in the alpha version that I tried. During the install I had let the installer use the wired ethernet connection using default dhcp configuration, but later decided to change it to a fixed IP address so that I could use my mobile phone as remote control. This meant logging in to the Raspberry Pi using ssh and then manually configuring the network connection.

Logging in

The System information page provides the IP address given by the dhcp server so I could login using ssh. The default login details for OSMC are provided below.
username: osmc
password: osmc

First thing I noticed as a “hardcore vi user” is that the choice of text editor is limited. This is one of the very few Linux systems where vi is not installed. You can of course install it yourself, but I just decided to use nano which is installed.

Configuring a static IP address for OSMC

The standard place on Linux for the network configuration is /etc/network/interfaces , but OSMC uses connman which is a lightweight network controller designed for embedded devices. Connman uses different files to the traditional Linux network configuration files. To define a static IP address one should create a config file in the /var/lib/connman directory with a filename ending with .config.

In my case I created a file: /var/lib/connman/ethernet.config

Type = ethernet
IPv4 =
Nameservers =

This uses my local network settings (IP address/subnet mask/default gateway) and I’ve set the dns entry to one of Googles public DNS servers.
If you need something a bit more advanced (perhaps wifi with encryption) then more examples are available in the config-format.txt file on git.

I then rebooted the Raspberry Pi and it came up with the new IP address (the changes can be applied dynamically, but I prefer to reboot whenever making network changes to make sure that they come up correctly at start-up).


Whilst OSMC is still in alpha it appears to work well with my setup (wired ethernet and IR remote control). The lack of system configuration program is a bit frustrating (hopefully something similar will be added in a future release), but manual IP configuration is still available for those willing to edit configuration files through ssh.

Installing a MyPiFi LCD onto a Raspberry Pi in a Pimoroni Pibow case

December 10th, 2014

Having already done some work with LCD displays on the Arduino I had been looking for a project to use one with the Raspberry Pi. Wiring this up was a bit messy until the MyPiFi LCD display board came along. The problem I then had was that I couldn’t fit the MyPiFi LCD onto the Raspberry Pi when it was in a case and as a result the LCD was in a vulnerable position.

I decided to do some hacking on an existing case and this is what I came up with:

MyPiFi LCD display mounted on a Raspberry Pi installed in a Pimoroni Pibow case

This is based on the original PiBow for the Raspberry Pi model B, although there is actually a Raspberry Pi model A inside the case.

The LCD display is not the one I purchased with the MyPiFi LCD module. I originally purchased a 4×20 display which I decided was too big for this particular project. I therefore swapped it for a SparcFun 2×16 display – which is similar to the 2×16 display provided as part of the Kickstarter.

You can ignore the cables coming out of the top for now (all will be revealed about the mysterious sensor in due course). This is a Pimoroni Pibow Case with some alterations made to the top layer.

If you want to follow this yourself then you should be aware that this involves permanently damaging the top layer of the Pibow case. If you’d like to use the case for something else afterwards you can buy a replacement Pibow top layer from ModMyPi. Similar modifications can be made to the Pibow B+ case, but I believe that it should fit the B+ Pibow Coupe with less alterations (not tested).

The first thing is that there is no slot for the GPIO connector (there is for a cable, but not for a board to be mounted directly on top). The distance between the GPIO connector also meant that I needed to remove some of the top layer so that the PCB could mount where the top layer normally is. I therefore decided to saw off the corner of the top layer of the Pibow case to the same size as the MyPiFi LCD display. I did this by placing the MyPiFi LCD board onto the top layer and drawing around it then cutting with a small hacksaw. Then filed it down to make it a snug fit and smooth the edges.

With the PCB mounted the LCD display is still loose so needed to be secured with PCB mounts. I fitted the top layer and PCB on and marked holes to drill two holes to connect PCB mounts to hold the LCD display on the right hand side. I have also included a PCB stand on the bottom left, but it is not connected to the PiBow. I used M2.5 nylon screws and nuts to hold them in place.

MyPiFi LCD display mounted on a Raspberry Pi installed in a Pimoroni Pibow case - pcb mounts

More details of the sensor and software will be added in future.

Father Christmas at Creaky Cauldron, Magic Alley, Stratford-Upon-Avon

December 7th, 2014

One bricked phone and lots of reboots – I finally have Android Lollipop on my Nexus 4

November 28th, 2014

I have been a fan of Android since I had my first mobile phone. Since Gingerbread I’ve managed to have every new version (although still running an older version on some of my devices) and it just keeps getting better. So I was very excited when I heard that the latest version Lollipop was available for my Nexus 4.

Android Lollipop

I was notified that the update was available. I checked on the requirements for the update (min 500Mb space) and made sure my phone was ready to take the upgrade. I applied the update and then disaster struck. The install appeared to go well until the “Installing system update…” screen. The bar moved across showing the progress as the update was installed, but instead of booting into the new operating system it rebooted back onto the “Installing system update…” screen.

I checked on the forums and I was not the first to have this problem. The suggested solution was to go into recovery mode, clear the cache and then try booting again. Worst case I should have been able to do a factory reset and then try the install again; or at least I though that was the worst case…

The problem is that whilst I could get to the bootloader I was not able to get into recovery mode. This appears to be a rare thing to happen, but there are certainly others that also reported the same problem.

I phoned Google (the phone was purchased directly from them through the Play store) and to their credit they sent me a replacement phone. It was their update that caused the problem with my phone in the first place, but the phone was originally purchased about 2 years ago, and I’d already had a replacement due to a faulty touch screen about 18 months ago. So whilst I think it’s only fair that they did replace the phone I know of other suppliers that are not so helpful.

The new phone arrived the next day. It’s a refurbished phone, but apart from the lack of packaging it looks every bit as good as a new one. The problem is that the Nexus 4 is now quite an old phone and it came pre-installed with Android 4.2.2. I logged in to the new phone and it came up with an upgrade available to 4.3 Jelly bean. This installed fine, but then the next install to Android 4.4 (KitKat) wouldn’t install. It downloaded and verified the install, but then when I clicked “Reboot to install” it counted down to “installing now”, but then didn’t actually reboot. I tried rebooting, checking for new updates but it just refused to install the update. I even tried a sideload from a PC (using both the next incremental update and a jump to the latest version), but all of these failed due to a verification failed error.

So last resort I thought – start again and did a factory reset. I thought that the factory reset would take it back to the initial Android image (ie. 4.2.2), but in fact it reset it to factory settings to the last successful image which was 4.3. At least this meant that I had kept my last installed image (even if I did lose all my data again). This was good as this was not going to be the last time I performed a factory reset.
I then successfully upgraded to Android 4.3.3, but the update to Android 4.4.4 failed. Aftering trying to get the install to work I then did another reset to factory state (which kept it at Android 4.3.3) and was then able to upgrade to Android 4.4.4. Finally I was able to update to Android 5 (Lollipop), but first following the advise of the Google help desk (and the forums) this time I did a cache reset first. The cache reset is accessed through the bootloader and wipes the cache partition, without deleting any data. I then tried the update for Lollipop, Android version 5. After a bit of nervous waiting whilst it went through the update the phone booted into Lollipop and finally my upgrade is complete.

I don’t think my experience is particularly common. My wife has a similar Nexus 4 (although she has the 8GB model whilst mine is the 16GB model) and her upgrade worked first time without any problems. There are some other people reporting similar problems, but I think we are in the unfortunate minority. The good thing is that Google were helpful in sending me a replacement phone and getting me back up and running again.

Android 5 looks great. Was it worth the hassle of the upgrade?
I don’t think that the new version of Android has any killer must have features, but as someone that loves technology it’s great to have the latest version of Android.

Also see QI Wireless charger for Nexus phone

Halloween Scary Pi-Ano – Raspberry Pi and Makey Makey keyboard

October 31st, 2014

This Halloween I created an indoor halloween light effect using a Raspberry Pi and a PIR sensor. Unlike previous years my children weren’t really involved in making this one, which is because my 9 year old daughter decided to create her own Raspberry Pi based Halloween Project.

Raspberry Pi and Makey Makey Pi-ano

She has created a Raspberry Pi, Makey Makey Pi-ano. It’s a musical keyboard using conductive play-doh shaped into pumpkins and ghosts using a biscuit cutter. The Makey Makey converts the touch contact into a key-press which is passed to the Raspberry pi.

In scratch these key presses are detected and used to play a short sound and light up a LED pumpkin using Scratch GPIO. More details on using Scratch GPIO in presentation mode on the Raspberry Pi.

Take a quick look at the video below (sorry no sound due to the speaker used being very quiet compared to the noise of the Halloween Party we were having in the background).

The LED pumpkin lights are from a shop bought Halloween decoration which I broke apart and soldered on solid core cables to make it easy to plug them into a breadboard. They were then connected to the relevant GPIO ports through a 220 ohm resistor.

I helped with the electronics and setting up the Scratch GPIO communications, but the rest of the programming is all my daughters own work.

The screen uses the HDMIPi screen, which is ideal for this kind of project.

You can download the software
Don’t forget to install Scratch GPIO extensions first.

It’s good to keep my daughter interested in programming. She doesn’t do as much as she did when she was in the Code Club I was running, but she does still enjoy it when we find a project she is interested in. My daughter also edited the video herself using kdenlive running on Linux.

Also see last years Halloween Trick or Treat scarer using the Raspberry Pi

Safely controlling mains electricity using the Raspberry Pi and Energenie Pi-mote

October 26th, 2014

It’s useful to be able to turn mains electricity on using a computer program. Whilst it’s not hard to create an electronic circuit that can switch mains voltages, if not done correctly it can be dangerous. This is where the remote control sockets can be used to create a physical barrier between the low voltage electronic circuit and the dangerous high voltage electricity in the socket. Whilst it would be possible to create a radio transmitter to control the sockets yourself I wanted to keep this simple so that it is something that could be made easily by anyone. In an earlier project Home Automation using the Raspberry Pi I opened up a remote control and used relays to emulate a button press.

Energenie Raspberry Pi remote control board (Pi-mote)

Since I created the circuit by hard-wiring across the buttons on a remote control, Energenie has created a Raspberry Pi add-on board which allows one to switch power sockets on and off using the Raspberry Pi. The board is plugged into the GPIO port of the Raspberry Pi making it easy to send messages using software.

Energenie remote control power socket

I bought the Raspberry Pi add-on board separate to the sockets which were in a pack with a standard remote control. I did hope to use the remote control and the Raspberry Pi to be able to control the same socket. This would allow me to use the Raspberry Pi for timed and/or Internet control, but then a traditional remote when that was convenient. In the sockets that I bought it appears to work with the Energenie Pi board or the remote control, but not both at the same time. I have been informed by Energenie that this should be possible, but I believe that I may have bought an older model of socket which does not support dual-remote controls. Fortunately there is a switch on the remote as well (which is useful if you’ve “misplaced” the remote, and it is possible to overcome the limitation by using the Pi-mote board configured as a virtual remote control (eg. on a mobile phone).

The products currently available from Energenie are sockets or a power strip, whereas some other suppliers also provide light switches which I found useful. The main advantage of the Energenie sockets is that this is the only supplier to provide this as an add-on board for the Raspberry Pi which is much easier and more reliable than hacking a remote control.

One thing about the Energenie remote controls is that I believe that all the remote controls (including the pi-mote) are registered using a unique identify code. Whilst this prevents having multiple controllers for each socket it does have the advantage that a neighbour using the same system cannot accidentally interfere with your sockets. I don’t believe it adds true security as it would still be possible to create your own controller board that monitors the wireless signal and then sends the same signals it does protect against accidental triggering. To do so would be pretty difficult and it’s unlikely that anyone would try and spoof a wireless remote control to turn your lights on or off.

I think that the Energenie product is much better than the one I was using before, dual remote feature is useful (included in new models) and it would be even better if there were some more home automation adapters in future (I have been told that there will be an extended range in future).

Adding an aerial

One thing I did do to the Energenie Raspberry Pi board was to add an aerial. Without the aerial the furthest I had it working was about 2 meters which is not particularly useful. The manufacturers state that it can have a range of up to 25 meters through open air. My limited range may be due to interference due to other signals; I do suffer from poor wireless signal strength in my house as well. Soldering a 135mm long piece of wire to the board extended the range considerably, this is easy to do as there is a hole for standard through-the-hole soldering.

Energenie Raspberry Pi power remote board with aerial

Energenie Software

The instructions for the Energenie includes some example python code. The code is not particularly easy to use so instead I used the Pi-remote code python module written by Amy Mather (whilst on work experience with Raspberry Pi foundation). This code makes it very easy to program the Energenie Pi-mote board using Python.

The power control web interface

I created a web interface which uses the python module mentioned above and the Python bottle web framework. The bottle web framework is a simple way to create a web application with a built in web server rather than needing a separate web server such as Apache.

Install instructions have now been moved to the project page
Pi-power Energenie remote control for the Raspberry Pi

Energenie Raspberry Pi remote on HDMI Pi

The code is dependant upon Ajax, so a fairly recent browser is needed with Javascript enabled.

No security

Please note that there is no security included in the software I created. This means that anyone on the local network (eg. your home wireless network) can turn the sockets on and off. If you only provide WiFi access to your family then the WiFi passkey should be sufficient to protect your local network, but if you intend to make the remote control accessible over an insecure network (eg. the internet) then I recommend that you add an additional authentication step to the code.

Project ideas

As the pi-mote is controlled from the Raspberry Pi it would be possible to add other triggers to switch the sockets on and off. Using other software it would for instance be possible to use sound/voice activation (using an additional microphone) or with additional hardware based on the temperature of the air or of a liquid.

Whilst the pi-mote add-on board does not use all the pins of the GPIO port it does not make it easy to connect any other devices onto the GPIO board if using a standard model A or B. The model A+/B+ would be easier to add sensors as some of the higher GPIO ports could be used. An alternative (that the Raspberry Pi foundation used for a sous-vide project) is to create a PCB with a connector that the pi-mote can be plugged onto.

Energenie Projects on

Below are some projects that I’ve created using the Energenie wireless sockets.

Automated Christmas lights using a Raspberry Pi and Energenie Pi-mote
Home automation using the Raspberry Pi and Energenie


Using Engergenie sockets with the pi-mote Raspberry Pi add-on board makes it easy and safe to create a project that switch mains powered devices on and off. It does have some limitations including not being able to easily access the available GPIO ports, but the simplicity of connecting this to the Raspberry Pi is a big plus.

Going Sober for October – What is it really about?

October 15th, 2014

Go Sober

Last time I wrote about my Going Sober for October challenge it was pretty much about what I was doing, but this time it’s more about why I’m doing this and the charity that I’m raising money for.

I’d certainly heard about Macmillan Cancer Support charity and particularly about the Macmillan nurses, but I’ve not had any involvement with Macmillan before joining this campaign. I first heard about it from an advert on the radio and for some reason having a month without drink sounded like a good idea. I don’t see it so much a challenge as it is a test of will power. The reason that I decided to go ahead with the challenge is that the more I found out about Macmillan cancer support the more important I think the organisation is.

I can’t explain it as well as Macmillan does itself and so I suggest you watch this short video, or this slightly longer video on the Macmillan website which explains more about the role of the Macmillan nurses. What I can say is that I’d want Macmillan to be there for anyone I love if they were diagnosed with cancer.

So visit the website, find out more and help support by sponsoring me to keep sober until the end of the month.

Twitter Status - follow stewartwatkiss

UK days out, children and holiday information is also available on the Days Out Diary web site
Linux, LPI and the Quiz / Test Program posts are also available on the Penguin Tutor website
First Aid Information, first aid games and first aid practice test / quiz entries are also available on the First Aid Quiz Web site