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 ...)

Birmingham Christmas Market, Ice Rink and Big Wheel

November 20th, 2017

Big Wheel and Ice Rink for Birmingham Christmas Market 2017

There have been some changes to Christmas in Birmingham this year. Watch the video to see more details:

Microwave Mug Cake and Cookie Recipes

October 25th, 2017

I wanted to run some kind of cooking / baking activity with the Cub Scouts, however we meet at a community centre which does not have a kitchen. I therefore turned to some Microwave recipes. I tried a few different recipes and in the end decided on two cakes and one biscuit recipe. These are based on existing recipes, but I have made a few changes either to the quantities or ingredients to simplify or to reduce the number of ingredients I needed to provide.

These are all easy to make and taste delicious.

The cake recipes all require a large mug to reduce the risk of overflowing, although it’s not so important for the cookie.
Note that depending upon you microwave it may take a different cooking time. Cooking these for too long may cause them to overflow, so check the microwave at least every 30 seconds. If the mixture starts to overflow the top of the mug then open the door for a few seconds and then continue microwaving until the required time.
Always allow anything cooked in the microwave to rest before eating to avoid the risk of hot spots which could scald.
For chocolate chips I use normal chocolate chopped into small chunks that are often less expensive than buying chocolate chips.

Chocolate Cake

Microwave Chocolate Cake - in a mug

4 tablespoons plain flour
¼ teaspoon baking powder
2 tablespoons cocoa powder
1 egg
3 tablespoons milk
3 tablespoons vegetable oil
Few drops vanilla essence
2 tablespoons milk chocolate chips

Add the flour, baking powder and cocoa powder to the mug and mix with a fork.
Add the egg and mix until the egg is absorbed.
Add the milk, vegetable oil and vanilla essence and mix well.
Add the chocolate chips and fold into the mixture.
Cook for 4 minutes, checking at least every 30 seconds.

Oreo Mug Cake

Microwave White Chocolate and Oreo Cake - in a mug

A delicious cake with the contrast of white chocolate and Oreo cookies.

3 tablespoon white chocolate chips
3 tablespoon milk
½ tablespoon. vegetable oil
4 tablespoon plain flour
¼ teaspoon baking powder
2 Oreo cookies
(Optional) 1 Oreo cookie for topping

Mix white chocolate chips and milk into large mug and microwave for 40 seconds.
Mix with fork until the chocolate has melted.
Add oil, flour and baking powder and mix with fork until flour is completely mixed in.
Break Oreo cookies into the mix and mash up with fork until only they are in small chunks.
Microwave for 60 seconds.
Leave to cool before putting an Oreo cooking in the top (optional) and serve whilst still warm.

Chocolate Chip Cookie

Microwave Chocolate Chip Cookie - in a mug

This recipe does not include baking powder so is more of a cookie than a cake. The chocolate chips can be substituted for dried fruit or other fillings for a different flavour cookie.

1 tablespoon butter
1 tablespoon granulated or caster sugar
1 tablespoon brown sugar
½ teaspoon vanilla essence
1 egg yolk
3 tablespoons plain flour
2 tablespoons milk chocolate chips (or alternative filling)

Put butter in mug and microwave for 30 seconds (or until melted)
Using a fork mix in sugar and vanilla essence.
Mix in egg yolk and then add flour and mix well.
Add chocolates chips and gently mix into the batter.
Microwave for 60 seconds.
Allow to cool for a few minutes before eating whilst still warm.

Learn Electronics with Raspberry Pi – on Humble Bundle

August 22nd, 2017

My book “Learn Electronics with Raspberry Pi” is included in the Lego Mindstorms and Robotics book bundle on Humble Bundle.

Learn Electronics with Raspberry Pi book

Through this you can get over $500 worth of ebooks for a fraction of their normal price, with a portion of the money going towards the charity AbleGamers Foundation.

As with all the Humble Bundles this is available for a limited time only, so you may need to be quick to get hold of it at this special price.

Please note that you have to pay at least $15 to get “Learn Electronics with Raspberry Pi” along with all the other books in the bundle.

If you miss the bundle then you can still get the book direct from Apress: Learn Electronics with Raspberry Pi, by Stewart Watkiss, or through many book stories.

Fire and Rescue Service Challenge Day 2017

July 3rd, 2017

I went to see the Rescue Challenge at Webbs of Wychbold, near Bromsgrove in Worcestershire.

This is an event where various Fire Services from around the UK compete in simulated rescue situations. The most dramatic of which is the two vehicle extraction where one car is positioned on top of another.

Two car RTA - Fire Rescue Service Challenge demonstration

I recorded one of the simulations (this was the last one of the day and was not part of the actual competition) where Hereford and Worcester Fire service have to extract two casualties from the vehicles. You can see the video below:

Raspberry Pi with Google AIY – voice recognition

May 8th, 2017

Google and MagPi (the official Raspberry Pi magazine) have released a project in the magazine using the Google API engine. This is known as AIY and was released with issue 57 of the magazine. The finished project is a cardboard box with a button switch on top. It includes a audio card and a microphone, but the thing that makes this all work is software that connects to the Google Cloud Service using voice recognition to add voice control to a Raspberry Pi and whatever program that you write for it.

Google AIY Cardboard voice recognition for the Raspberry PI

The instructions for getting started are provided at: AIYProjects with Google.
It explains the setup for a Raspberry Pi 3, but I used a Raspberry Pi 1 B+. The one thing I had to do differently is to use a different computer to setup the cloud configuration through the webpage as on the B+ it was much too slow.

You will need to follow all the instructions down to 3.3 which is where it refers you to the file. This is where you can customize the commands to run code on the Raspberry Pi.


As the box is designed to run without keyboard or monitor, one of the first things that I did was to add a shutdown command which as it’s name suggests shuts the Raspberry Pi down cleanly. This is done by adding the following code snippets to the file which is based on an example provided in the file.

The first part is to add a line to the actor instructions.

actor.add_keyword(_('shutdown'), Shutdown(say))

The command above instructs the Raspberry Pi to call the Shutdown command which is included in the file (it actually creates an instance of a Shutdown object and calls the run method).

This is then implemented using the following code:

class Shutdown(object):

    def __init__(self, say):
        self.say = say
        self.shell_command = "sudo" 
        self.shell_args = "shutdown -h now"

    def run(self, voice_command):
        self.say('Shutting down now');" "+self.shell_args, shell=True)

Now run the src/ command and you should be able to press the button (or clap if you have set that up) and say shutdown. You could create your own version that uses other words like “power off” or “activate self destruct” if you prefer.

Controlling NeoPixels

The other thing that I the AIY project for is to control NeoPixels. This is very much work in progress at the moment, but I was already in the process of converting my NeoPixel GUI application to a client-server model using python bottle and a web control.

You can see this in action on the video below:

The NeoPixel code is on github NeoPixel GUI code on GitHub. I am working in a separate client-server branch but it in a state of change at the moment, so you will probably be better off waiting for it to be merged into the master branch at a later stage.

I have then added individual entries for each of the commands to the file. This then uses wget to request the file (future versions will probably use the python webbrowser or something similar instead):

actor.add_keyword(_('lights'), Lights(say,_('lights')))


class Lights(object):

    def __init__(self, say, keyword):
        self.say = say
        self.keyword = keyword

    def run(self, voice_command):
        # Get string
        print ("Keyword "+voice_command)
        getcmd = "wget"
        command = getcmd+"status"
        if ("off" in voice_command) :
            command = getcmd + "alloff"
        elif ("on" in voice_command) :
            command = getcmd + "allon?colour=white"
        elif ("red" in voice_command) :
            command = getcmd + "allon?colour=red"
        elif ("green" in voice_command) :
            command = getcmd + "allon?colour=green"
        elif ("blue" in voice_command) :
            command = getcmd + "allon?colour=blue"
        elif ("rainbow" in voice_command) :
            command = getcmd + "sequence?seq=rainbow"
        elif ("chaser" in voice_command) :
            command = getcmd + "sequence?seq=chaser"
        elif ("disco" in voice_command) :
            command = getcmd + "sequence?seq=theatreChaseRainbow"
        # Hard coded colours at the moment
        subprocess.check_output(command, shell=True).strip()

Note that this is a quick hack (which leaves temporary files in the local folder). I will be looking at cleaning up this code in future, but I’m currently working on the NeoPixel side first.


The Google / Raspberry Pi AIY kit has only been available (via The MagPi) for a few days and so this is just an initial look at what it is capable of. I’ll be looking at improving this code in a future version and perhaps adding voice control to even more projects.

Networking challenge quiz for school IT and computing fair

February 2nd, 2017

In the UK, Year 9 (age 13 to 14) is an important stage which can influence the student’s future career. It is during this year that the students first decide on what subjects to pursue, and in particular whether they will continue to study computer science. I recently attended a computing and IT careers fair for a local school where technology companies and universities were on hand to explain to students what it’s like to study and work in those fields.

I work for a communications company and rather than stand there and talk about working in IT, I created a short hands on networking challenge for the students to interact with. This involved a short multiple-choice quiz on computer networking loosely based around the computing that is in the computing curriculum.

Network patching rack

Network challenge - patch-panel cabling quiz

Instead of answering the questions on paper as they may with a traditional quiz, the students had to connect them up on a patch-panel which would light up green for a correct answer and red for an incorrect answer. As well as interacting with the challenge it gave an opportunity to talk about working in the IT industry and to aspire them to a rewarding career in the field of computing.

Network challenge - inside patch-panel cabling quiz

The original idea for the patching rack was to wire the ports directly to a Raspberry Pi, but for maximum flexibility and to make sure that I could also detect where a cable has not been connected correctly then it meant that I have to wire up 30 connections (6 questions, 24 possible answers) plus one more for the LEDs (using NeoPixels). This is more than the number of available ports on the Raspberry Pi, whilst it would have been possible to use an I/O expander that would have meant creating a custom circuit. Instead I decided to use an Arduino Mega. The Arduino mega is connected to the Raspberry Pi by a standard USB cable with serial communications over USB used to communicate between the Raspberry Pi and Arduino.

Connecting to the Arduino Mega

The back of the case does look like a bit of a birds nest, but that was due to lack of space within the case; it’s not possible to remove the top or sides, so I had to make the cables long enough to extend out of the case and then push them in along with the Arduino.

The connectors on the Arduino are push-in connectors, but I wanted something a little more secure without having the concern that one of the many connections could come loose. I used a prototyping board with screw terminals. The biggest challenge was trying to line up the pins between the prototyping board and the Arduino, but once connected it worked really well. This was simpler than trying to connect multiple port expanders and also meant that I could offload the work of controlling the NeoPixels to the Arduino.

Source code

The source code for the Arduino and Raspberry Pi is available from github at the link below.

Networking challenge – Raspberry Pi and Arduino Code

At the moment the code is quite basic. It is a non-GUI program which runs on the command line that I controlled using a Pi-Top (Raspberry Pi laptop). The answers to the questions are hard-coded into the Python file. This is fairly easy to edit in the source code, and certainly easier than having to push an update to the Arduino each time it’s updated, but I do hope to replace this with a configuration file in future.

How it went

I thought it went well on the day. I would much rather the pupils have something that they can interact with than just spend the day talking or answering questions. You could see that some of the pupils were generally interested and came over to have a go (despite having to compete with a reaction game on the Army stall next door).

There’s some things I’d like to change for next time in terms of the questions, but I enjoyed it and I hope that they found it useful.

Getting started with 3D printing using Linux

January 15th, 2017

I have now got a 3D printer. I haven’t done much with it yet and it’s a steep learning curve but I’m looking forward to getting into 3D printing.

Choosing a 3D printer

The first decision was which 3D printer to buy. There are a lot of different choices starting from little over £100 and going into several thousands of pounds. The one that I opted for was one of the more expensive budget ones costing a few hundred pounds. It is made by Wanhao, the model is the Wanhao i3Plus Duplicator. At the time of writing this is out of stock on Amazon UK, but they do have the Wanhao i3 V2 Duplicator. The i3Plus integrates the control unit with touchscreen into the main printer instead of needing additional unit, this does mean it takes up less space on the desk.

One of the things I wanted was a 3d printer that was based on the open source Prusa design rather than a proprietary design. This means that it is possible to upgrade or change the printer in future, such as by changing the printer extruder to support different materials. It’s not something that I necessarily plan to do in future, but I like to keep that option open. It also means that if there is an updated version of the file format then I could potentially use that by upgrading the firmware (software) which may not be available with a proprietary printer. Some 3D printers even go so far as only allowing their own plastic being used such as the XYZ Printing Junior. There may be some benefits to using the printer approved materials, but this could also be restrictive.

Wanhao i3Plus 3D printer

Another benefit of the Wanhao printers is that the printer is supplied partly or fully assembled, whereas some printers are provided as a kit which involves assembling all the individual components. In the case of the Wanhao i3Plus Duplicator then the main parts of assembly were to attach the vertical assembly to the base and connect several wires by plugging them into the relevant connector sockets. This means that the printer was up and running within an hour of opening the box, whereas with some other printers it may take several hours.

Another consideration is that the mains electrical connections are fully enclosed within the printer. On some of the kit printers this is sometimes in the form of a separate power supply block which is connected directly to the mains. Just looking at customer reviews one 3D printers includes the quote “The power supply has to be wired to mains and the live wire is only covered by a small flap..potential for shocks exist…” – see this review. I haven’t verified this myself, but it is an additional thing to consider if you then need to add an additional enclosure for the power supply.

One feature that this printer doesn’t have that I considered is a dual-head. I can see that there are instances where that may be useful, but I did not think it essential for my first 3D printer. It also doesn’t have a self-levelling base, which some 3D printers do include.

This isn’t the only 3D printer which ticks all those boxes, but it is one that did and I’m happy with the 3D printer I bought.

SD Card included with the 3D printer

The most common way to print on the 3D printer is by saving the print files to an SD card and inserting that into the printer. An alternative is to connect a computer directly to the 3D printer, but that could tie the computer up for a long time.

The 3D printer includes an SD card which includes some free software, but that software is Windows only. It also had one sample 3D object to print (although it said that it should have more than that). It does mean that it’s possible to get up and running with your first test print without first needing to find / buy an SD card or connect to the printer by USB.

3D Printer Slicing Software

If you have a 3D CAD file that you would like to print then it needs to e converted to a GCode file which is used by the 3D Printer. This is through a process known as slicing where the 3D object is split into slices or layers. The slicing software can also add additional things, such as additional support material and can determine how much material is used for solid objects (which are normally printed with a mesh rather than solid material).

The most popular slicing software is Cura, which is open source software. There is a version provided by the manufacturer that includes the specifics about the printer, but that is for Windows only. I used the standard Linux version and then for the printer type choose Prusa i3 which gives reasonable results.

Unfortunately the Cura GUI will not work on the Raspberry Pi as it requires OpenGL, but that is still work in progress on the Raspberry Pi, but it will work on Linux running on a PC. The Cura back-end is provided for the Raspberry Pi, but that is command line only.

An alternative slicer software is slic3r. This is available for Linux including the Raspberry Pi repository. The version that is compiled for the Raspberry Pi is an older version and I’d recommend trying to use an updated version as it is much easier to use.

Slic3r needed some configuration for the printer and the following are the settings I used for PLA:
Model: RepRap
Nozzle: 0.4mm
Filament width: 1.75mm
Extruder temperature: 205 deg C
Bed temperature: 60 deg C

Free 3D object repositories

There are many sites that have 3D objects that you can print on a 3D printer. Usually it is a case of downloading the appropriate file and then using the Slicer Software (discussed above) to create the G-Code. The following are a few sites that have 3D files available.

[Please check terms of use etc.]

3D CAD Software

If you are looking to create your own models then you will need some 3D CAD or design software. There are two different 3D design applications that I have used with Linux.
The first is Blender which is a 3D modeller. This is popular for creating 3D visual objects, such as characters used in games and animations. The models can then be exported for use in a 3D printer.

The second is FreeCAD which is a full 3D CAD application. This is particularly useful if you want to create parts that need to interact as you can specify the exact dimensions. Learning FreeCAD is quite a steep learning curve, but well worth it. FreeCAD is available for Linux and works on the Raspberry Pi 3 (although I’ve only tried with small objects, memory will be the main limitation).

If you are looking to learn FreeCAD then I found this FreeCAD Video tutorial by j16out to be useful.

After creating a 3D object then you need to export it as an STL Mesh file which can be opened in the Slicer software.


I haven’t done much with the printer so far, but I’m happy with the results so far.

The combination of Cura and FreeCAD works well on Linux (except the Raspberry Pi for Cura).

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.

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