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

Home Family Days Out Raspberry Pi & Electronics Blog

Stewart's Blog

Stewart Watkiss website to the world ...

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

Gloucestershire and Warwickshire Railway Santa Special Steam Train

December 21st, 2016

This Christmas we visited the Gloucestershare and Warwickshire Railway for the Santa Special steam train. The train was from Cheltenham Racecourse railway station. The train was fully booked, but there were enough tables for everyone to find a comfortable seat.

GWR Santa Special Steam Train

We started with a train journey to the “North Pole” station. The carriage was decorated for Christmas and the staff on the train came around to tell us where to go when we passed through the magical tunnel to the North Pole. On arrival of the station we visited Father Christmas in a converted train carriage, where the kids received good quality presents.

GWR Santa Special meeting Father Christmas

We then enjoyed free mince pies and coffee in the station cafe before our journey back home. There was also some Christmas songs at the station. There was a snow machine just before we visited Santa, but the one thing they could have done with is a bit more snow.

After boarding the train home we were told that it was delayed a little, but at least we were on the train in the warmth. The staff were also great and came around to each compartment to let us know what was going on and check that we were all okay [hint to other railway companies – this is how to provide great customer service]. While we were waiting we played a game which had been the present from Santa to our daughter.

The train then took us back to the racecourse. The length of the train ride was just about right. Enough time to enjoy the journey without it getting boring. As an alternative for younger children they also run a diesel rail-car train where Santa visits the children on the train.

We had a great Santa experience.

For more details about this and other train journeys see Gloucestershire and Warwickshire Railway.

Birmingham Christmas Market 2016

December 12th, 2016

Video and photos from our visit to the Birmingham Christmas Market in 2016.

Element 14 BOO! Pi Costume Contest

November 9th, 2016

Around Halloween 2016 Element 14 ran a Costume Competition for wearable tech projects.
Boo! Pi Costume Contest

I was already working on a Wizard of Oz costume so I submitted my project to the competition.

Wizard of Oz wearable electronics costume - powered by Pi Zero

You can find out more about the Raspberry Pi – PiZero NeoPixel bow tie here.

My costume was one of the winning entries and I have now received a bag full of goodies, including a Raspberry Pi 3 and Sense Hat:

Element 14 Raspberry Pi bag of goodies

A big thank you to Element 14. Find out more on the Element 14 community site including future competitions, projects and forums.

Wizard of Oz Costume – Wearable electronics with Raspberry Pi, Pi Zero

October 26th, 2016

Wizard of Oz wearable electronics costume - powered by Pi Zero

I decided to create a Wizard of Oz costume for Halloween this year. As you probably know The Wizard of Oz wasn’t really a wizard at all. He used a mechanical machine to convince the citizens of Oz about his magical abilities. What you may not know is that he was more than just a charlatan, but also an evil dictator with the truth exposed in the Musical Wicked (based on Gregory Maguire’s novel), so quite appropriate for Halloween.

Rather than go for the traditional costume I created a modern interpretation of what The Wizard may look like if he had access to todays technology. So using a Raspberry Pi and some wearable electronics I’ve created this costume.

How it works

The LED circuitry is based around a NeoPixel circuit that I’ve used several times already (Raspberry Pi NeoPixel Worksheet). I’ll add more details on the extra parts to create the wearable project in future.

Future development

I’m currently working on a smaller version of the circuitry using a ProtoZero board and hope to add the ability to play music files in future.

Boo Pi Costume Competition

For anyone else creating a Raspberry Pi Costume at the moment (2016) then there is a competition run by Element 14 looking for the best wearable tech costumes. If you have a better idea for a Raspberry Pi wearable costume then see the link below:

Electronics and Raspberry Pi Halloween Projects

October 23rd, 2016

These are some of the Halloween Projects I’ve created.

Haunted House

A scary haunted house, using a Raspberry Pi, home automation, electronics and scary music.

Halloween Raspberry Pi project

Raspberry Pi Haunted House

Raspberry Pi MotionSensor Jack-O-Lantern Pumpkin

My son’s Motion Sensor based Light Up Pumpkin project

Motion Sensor Raspberry Pi Halloween Pumpkin Jack-O-Lantern

Halloween Motion Sensor Pumpkin

Wizard of Oz Costume

A Wizard of Oz Costume with light-up bow tie.

Wizard of Oz - wearable electronics costume

Wizard of Oz costume using wearable electronics and a Pi Zero

Scary Pi-ano

A Makey Makey based touch Piano, programmed in Scratch.

Raspberry Pi Makey Makey - Scary Pi-ano

Halloween Scary Pi-ano – musical piano with Makey Makey

Indoor Halloween Haunting

A motion sensor based flashing light sequence.

Halloween PIR Motion Sensor light

PIR based Halloween Lights

Raspberry Pi Motion Triggered Halloween Pumpkin Jack-O’-Lantern

October 23rd, 2016

My 8 year old son has now completed another Raspberry Pi project. This project is a Halloween Pumpkin, or jack-o’-lantern, which is triggered whenever someone comes near.

Raspberry Pi Motion Sensor (PIR) Halloween Pumpkin Jack-O'-Lantern

It uses a PIR motion sensor to detect someone entering the room and then lights up a sequence of NeoPixels. In this case these are static green and blue NeoPixels, although with a few changes to the code they can light up in any colour, flash or run in any sequence you could wish for.

You can watch my son demonstrating it on the video below.

The project uses GPIO Zero for the PIR Motion Sensor and a simple voltage level shifter to control the NeoPixels.

Lighting up the NeoPixels

I used a long strip of NeoPixels that I happened to have, but you can also use a small strip or large ring for a similar (though less bright) effect.

The NeoPixels do need a little setting up, so I suggest getting these working first before adding the code for the motion sensor. The NeoPixels require a simple electronic circuit and some libraries to be installed which drive the LEDs. This is explained in the worksheet below which covers creating your own circuit on a breadboard. You can also use a PCB such as the MyPiFi NeoPixel board or by creating your own HAT / add-on board for the Raspberry Pi.

I hope to add details of an add-on board in future.

Using the PIR motion Sensor

The motion sensor used goes under a number of different product names including “D-SUN PIR” and is also the one included in the CamJam Raspberry Pi kit. This sensor has 3 pins to connect to the Raspberry Pi: Ground, 5V supply and a Data Out. Although the sensor uses a 5V supply it only gives out a 3V signal so this is directly compatible with the GPIO ports. This has been connected to GPIO 26, which is the physical pin 37. This was chosen to avoid the first 26 ports which were blocked due to the add-on board used.

The motion sensor is easily controlled using the GPIO Zero library which is now standard on the Raspberry Pi.

Source code

The source code to bring this all together is shown below.

from gpiozero import MotionSensor
from neopixel import *
import time

delay = 10

FREQ = 800000
DMA = 5

pir =  MotionSensor(PIRPIN)

while True:

    print ("you can't hide")
    for i in range (0,LEDCOUNT,2):
        strip.setPixelColor(i, Color(255,0,0))
        strip.setPixelColor(i+1, Color(0,0,255))
    for i in range (LEDCOUNT):
        strip.setPixelColor(i, Color(0,0,0))

The code should be placed in a file (eg., which then needs to be executed using sudo so that it runs as the root user (adminstrator):

sudo python3


You will see that when triggered the code sets the NeoPixels to two colours, one for the odd pixels and one for the even ones. You could modify this to use any colour that you wanted and you could even add some code to make the LEDs flash etc. If you create a colour sequence or flashing lights then you can remove the time.sleep entry and have the sensor usable once the light sequence has completed.

You may also want to look at having the program run automatically on startup. This is explained in the following guide under the section “Adding to systemd startup”: TightVNC startup with systemd
Note for this you want to change the ExecStart entry to run the above command (without the sudo prefix) and set the user to root.

More Halloween Projects

Restore dual boot with Ubuntu when Windows 10 update overrides the UEFI settings

October 10th, 2016

As a Linux user it’s now very rare that I run Windows on my home computer, but when I do it’s usually because of something important. At the moment it’s because I’m taking some exams on my MSc course and the remote proctoring software only supports Windows and Mac.

It’s therefore rather important that my laptop is able to boot into Windows occasionally, but it’s a shame that Microsoft doesn’t seam to have the same concern for stability that I do. If they did then I would think it at least basic courtesy to warn me when a Windows update could leave my computer unusable for several hours and will trample all over the settings I had previously configured.

Fortunately this happened just after my exam, as if this had happened before then this would have been much, much worse than just wasting several hours of my time.

It all started with what I believe is the Windows 10 Anniversary Update. This is a significant update to Windows 10 adding new features in addition to security and bug fixes. As this is a big update then I would have expected a bit of warning – perhaps a “Do you want to proceed with the update now?” or similar. Microsoft has other plans, presumably they don’t want people to skip the update (as users have avoided with the big jump to Windows 10), so they just made it part of the normal “Shutdown and install updates option”.

It took sometime for the computer to shutdown, but the problems became apparent when trying to boot the laptop up again. It first went into the installing updates which was very, very slow. After about an hour I thought it had crashed, but in fact it was still installing the update and a short while afterwards I saw the status creep up to 26% complete. It then continued very slowly until it reached 36% which left the following screen:

Windows 10 anniversary update - stuck on please wait screen

The screen says that this will take a while, but this was getting ridiculous, so I gave up on what I was trying to do and went to bed. I woke up the following morning to see that it was still trying to install the update.

Although the screen said “Don’t turn off your PC” by this stage I had little other choice than to force-ably power down the computer. I then rebooted and Windows 10 rolled back the update restoring a working version of Windows.

It sounds like I’m not the only one to have suffered problems with these Windows 10 updates as seen in this story (ThaiVista).

It was tempting to leave disable the windows update and leave the operating system as it is, but leaving a system without recent updates is generally a bad thing, so I then spent several more hours updating all the drivers I could find and re-trying the update. I believe that it now has the latest updates installed and appears to be working, although that was only the start of my problems…

Windows 10 prevents booting into Ubuntu

As I mentioned previously I’m really a Linux user and my laptop primarily uses Kubuntu, which is a variant of Ubuntu Linux. I had already made several configuration changes to my computer to ensure that dual boot worked well, but Microsoft appears to have had other ideas, as since the update it was no longer possible to boot into another operating system. These are the changes I had to make to be able to boot into Grub and hence boot into Linux.

I don’t know whether this is deliberate, that Microsoft doesn’t care what impact the updates have on the user, or that they don’t know what they are doing.

Turn off fast startup

The first thing is to disable fast start-up in Windows 10. This is needed to ensure that the computer full shuts down allowing a different operating system to be booted. This is something I had already done previously, but that has now been reset back to it’s previous setting.

To prevent the fast start-up then the “fast start-up option” needs to be unchecked.
As you can see Microsoft makes this option really easy to find, just to goto:

Start -> Settings -> System -> Power & Sleep -> Additional Power Settings -> Choose what the power buttons do -> Change settings that are currently unavailable -> Turn on fast start-up (recommended)

Make sure that there is no check mark against that option.

Restore EFI to Ubuntu’s Grub loader

The update has also removed Linux from the UEFI loader (replacement for the legacy bios on 64-bit computers). Once again Microsoft has overwritten the changes I have made and makes it difficult to set it back.

First check the file name matches the one I have on my computer which is “\EFI\ubuntu\grubx64.efi”.

You can’t view EFI directly in Windows Explorer etc., so instead right click on the Windows logo and choose:
Command Prompt (Admin)

Choose a drive letter that isn’t in use (I used j: ) and then mount the first partition on the disk drive.
mountvol j: /s

You can then navigate into that drive using:

and cd into the appropriate directories.

Check that there is a file called:
If not then you may need to perform the restore from a Ubuntu rescue disk.

If that file does exist then it can be set as the default boot option by entering the command
bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi

Check that the dual-boot works

That should be it, it should now be possible to shutdown from Windows and choose Linux (Ubuntu) or Windows from the Grub menu (assuming that is how it was previously set-up).

If that doesn’t work and you need to check the UEFI options directly then from Windows 10 goto Windows logo -> Settings -> Update and security -> Recovery and choose Restart Now which is under the Advanced startup option.

When it boots into the recovery mode choose
Troubleshoot -> Advanced options -> UEFI Firmware Settings and then reboot.

You should then find yourself in the UEFI settings where you can make changes such as disabling Secure Boot.

PyconUK 2016 – Sending secret messages with a micro:bit

October 3rd, 2016

Another year and another Pycon UK. For 2016 the UK’s community Python Conference was held in Cardiff, Wales. It’s also the fourth year that they’ve included a special Children’s day on the Saturday. This included a day of kids coding on Raspberry Pi computers (Pi-Top CEED) and this year each child received a micro:bit to provide a new way of coding.

The final workshop session was a open “work on a project” session and many of the children decided to use their new micro:bits in their project. My son’s idea was to use two micro:bits (luckily I’d taken an extra one with me) to be able to send messages between the micro:bits. This would allow him to send secret messages to his friends in class [not that we’d encourage such things :-)].

Pycon UK 2016 - kids lightning talks

So we set about writing the code using using the Mu editor on the Raspberry Pi and then using the editor to flash the code directly to the micro:bit. This is a much better way to write code to the micro:bit compared to having to generate the hex file and then drag it onto the micro:bit.

The code is fairly simple thanks to the provided radio module. Essentially it looks for button presses on the micro:bit and depending upon whether A, B or A+B are pressed then it sends a different message. The other micro:bit listens for the signal and then displays a message using the LEDs on the front of the micro:bit. We only had about an hour to get the basic code working, so we didn’t include the ability for bidirectional messages, which would probably be a bit hard for such a young programmer. The python code is included below:

Transmitting micro:bit

from microbit import *
import radio


while True:
    a = button_a.was_pressed()
    b = button_b.was_pressed()
    if a and b:
    elif a:
    elif b:


Receiving micro:bit

from microbit import *
from microbit import display
import radio


while True:
    received_text = radio.receive()
    if (revieved_text == 'boring'):
        display.scroll ("This lesson is boring")
        sleep (100)
    elif (received_text == "fun"):
        display.scroll ("This lesson is fun")
        sleep (100)
    elif (received_text == "playtime"):
        display.scroll ("Shall we meet at playtime")
        sleep (100)

As you can’t see there aren’t many comments in the code, but then it should be fairly obvious to see how it works. The sending and receiving of messages is handled by the radio module and the main thing to consider with the button press detection is that it includes the test of both a and b being pressed first (otherwise the if would see both buttons being pressed as “a” being pressed).

My son and gave a short demonstration of the project during the lightning talks on the main PyconUK stage. This is included in the video below:

Pi-Top Raspberry Pi laptop computer

October 1st, 2016

During my visit to the Raspberry Pi factory arranged by RS I also entered into a competition to win a Pi-Top computer. After a close run vote, I won. So I now have a Pi-Top Raspberry Pi laptop.

Pi-top Raspberry Pi laptop computer

The Pi-Top is a similar size to a regular laptop, but involves some assembly and uses a Raspberry Pi for it’s motherboard. As well as a laptop they also sell the Pi-Top CEED which is a screen with built-in Raspberry Pi, which you connect your own mouse and keyboard. Both are available in black or a colourful bright green.

The Pi-Top does involve some assembly to put it together. This is not too difficult and it’s fully explained in the guide, but a little fiddly at times. Essentially each part is modular and it’s a case of putting them together and connecting the wires and connectors. No special tools are required other than a supplied allen key (hex key). One problem I had was that I believe the screws for the screen hinge were screwed down too tight as the instructions assume that they are fully loosened off, but I was able to get the screen connected eventually. The assembly should not put anyone off as the sort of people looking for a Raspberry Pi laptop are also the sort of people that shouldn’t be too afraid of assembling the Pi-Top.

Once assembled the Pi-top functions much like a normal laptop. It has a long battery life (approx 10 hours) and is expandable through an innovative plug-in system. The optional expansion includes speakers (available as a single mono speaker, or buy two for full stereo) and a prototyping board which can be used for making your own circuits or for connecting HATS to the Raspberry Pi.

The Pi-top can be used with the normal Raspbian OS supported by the Raspberry Pi foundation or the Pi-top’s own Pi-top OS. I have mainly used the standard Raspbian, but the Pi-top OS does include some additional integration with some of the peripherals and is tailored especially for use in education. The Pi-Top OS also includes CEEDuniverse which is an interactive game to teach computer programming to children.
I have been through some of the activities with CEEDuniverse, which are very good, but I haven’t actually tried that to teach programming to children yet.

I’ve also had an opportunity to see the Pi-top CEED being used to teach programming to children at the PyconUK kids day where they worked really well.

The main benefit for the pi-top is that it integrates everything needed to get started with the Raspberry Pi without losing any of the expandability and access to the GPIO ports. All the workings of the Raspberry Pi and expansion board are hidden under a plastic cover which just slides out of the way when you want to get inside. In fact using the pi-topProto board the GPIO pins are conveniently placed in the centre of the Pi-top which works really well.

Pi-top Raspberry Pi laptop with electronic circuit on proto board

The pi-top has been really convenient for taking along to Raspberry Jams and similar events as it saved having to borrow screens from the desktop computers in the classroom.

There are a few little things I would have liked to see. It would have been nice to be able to get to the HDMI port to connect to a projector, although I think that is quite a big ask. It’s beyond what the pi-top is supposed to be, but would be a nice feature.
Also the keyboard feels a little soft to type on and when touch-typing it occasionally misses a key press. On the plus side it is available as a UK keyboard, and for the target audience of use in schools and for school children then they will probably not have that problem.

There are other cases that integrate the Raspberry Pi with a screen and/or a keyboard and touch pad, but as far as I am aware this is the only one that integrates them into a single laptop and it does the job really well. If you are looking to equip a class with Raspberry Pi computers then the Pi-Top CEED may be a better fit (as it’s even cheaper), but I’d highly recommend the Pi-Top especially if looking for a more portable solution.

Visit to Sony Raspberry Pi Factory Wales

May 27th, 2016

I’ve recently been to visit the Sony UK factory where the Raspberry Pi is made. This was made possible thanks to RS Components and a competition to win a tour around the site.

The site known as the Sony UK Technology Centre is based in Pencoed Wales. At the site they manufacture high-end video cameras used in the broadcasting industry, it is also a Sony customer service repair centre and along with the Raspberry Pi they perform manufacturing for other companies.

Factory tour

Much of the manufacturing is fully automated. The line that we went along was adding components to the second side of the board. The boards had solder applied through a mask and then the SMT (Surface Mount Technology) components placed using pick and place machines such as the machine below:

Pick and place machines making Raspberry Pi 3

The boards then go through an oven where the solder is melted attaching the components to the board.

Freshly baked Raspberry Pi 3 coming out of the re-flow oven

After automated testing of the solder joints the Raspberry Pi boards are ready for the final components to be inserted by hand (the chunky bits like the Ethernet and USB connectors) which are then soldered by machine.

The finished boards were then tested using this impressive testing jig created by Sony specifically for the Raspberry Pi.

Testing the finished Raspberry Pi 3 at Sony UK factory Wales

The testing stage was the part that impressed me the most as that is something that is often done by hand due to the complexity and unique nature. In this case though the testing was performed much faster than could possibly be achieved by hand.

Raspberry Pi computers at Raspberry Pi Factory Pencoed Wales

We also got to see how a robot is being trained to help with some of the components that are currently inserted by hand. Contrary to some of the scare stories this was not a case of people getting the sack to make the way for robots. The robots were making the process more efficient and increasing the number of Raspberry Pis that were being made, which then makes the staff available to perform tasks where they could provide more value-add. Robots and humans working side-by-side to build Raspberry Pis.

I see this as a positive thing as it means that manufacturing can be done in the same country as the computer was designed. Without the level of automation achieved then it’s hard to see how manufacturing can survive in countries like the UK where the cost of workforce is relatively high. It also provides other jobs in the local area included in the supply chain.


During the afternoon we then got to have a go with the Pi-Top and Pi-Top CEED, which are laptops and computers based around the Raspberry Pi.

Pi-top Raspberry Pi laptop

This was run as an educational activity where we got to experience the education software (which they are currently getting certified through OCR) and then to program Minecraft in Python. This finished with a programming challenge where we were challenged with creating a sculpture in Minecraft combining art and programming. I created a flashing lighthouse using Python to switch between diamond and air blocks to make the flashing light.
After a close run vote I won first prize which was my very own Pi-Top! I’ll be writing more about the Pi-Top in the future and plan to take it along to some future STEM Ambassador activities I’m involved with.

Thank You

I really enjoyed visiting the factory. A big thank you to all those involved in the day including:

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