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

ESA European Astro Pi Project – Mission Zero – Code that ran on the International Space Station

February 15th, 2018

The ESA European Astro Pi Project – “Mission Zero”, involved school children creating code that actually ran on the International Space Station (ISS).

My son joined with a friend (both aged 9 at the time it was submitted) to create a Python program that ran on the International Space station during February 2018.

Here’s his story:

The AstroPi shown in the video is a 3D printed replica of the Raspberry Pi case that is installed on the Space Station. It includes the Raspberry Pi Sense hat which shows the LED display and includes the temperature sensor.

The project gives a friendly greeting to the astronauts and then displays the temperature in degrees Celsius. If the temperature is warm then it displays a warm picture showing the sun and a smily face, or if it is cold then it displays a snowy scene.

The code has been written in Python. There were some slight modifications used in the video (it included key-presses that allowed the code to be repeated), but the actual code that ran on the Raspberry Pi on the ISS is included below:

from sense_hat import SenseHat
import time
sense = SenseHat()

red=(255, 0, 0)

blue=(10, 0, 255)
sense.show_message("Hello, Astronauts", text_colour=red, scroll_speed=0.05)

sense.show_message("Have a nice day", text_colour=(0, 0, 255), scroll_speed=0.05)

temp = sense.get_temperature()

temp = round(sense.get_temperature(), 1)


sense.show_message("It is " + str(temp) + "Degrees", text_colour=(0, 255, 0), scroll_speed=0.05)

g = (0, 255, 0)
b = (0, 0, 255)
w = (255, 255, 255)
y = (255, 255, 0)
g = (0, 255, 0)
p = (145, 200, 255)

hot = [
  w, w, w, w, w, y, y, y,
  w, b, w, b, w, y, y, y,
  w, b, w, b, w, y, y, y,
  b, w, w, w, b, w, w, w,
  b, w, w, w, b, w, w, w,
  w, b, b, b, w, w, w, w,
  g, g, g, g, g, g, g, g,
  g, g, g, g, g, g, g, g

cold = [
  p, p, p, p, p, p, p, p,
  p, p, p, p, p, w, p, p,
  p, p, p, w, p, p, p, p,
  p, p, w, p, p, p, p, p,
  p, p, p, p, p, w, p, p,
  p, p, p, p, p, p, p, p,
  w, w, w, w, w, w, w, w,
  w, w, w, w, w, w, w, w

if temp >= 20:

The children actually wrote more code initially, but it had to be trimmed down to make it simpler due to the restrictions on the project.

Below are some photos of my son with his certificate and of the 2nd page of the certificate showing that the ISS was in orbit above Columbia at the time the code was run.

European Astro Pi Mission Zero certificate - code that was run on the International Space Station (ISS)

Certificate from European Astro Pi Mission Zero project, showing where the ISS was when running the code

OMSCS Studying online – MSc in Computer Science with Georgia Tech

January 24th, 2018

I’ve recently completed an online Master degree with Georgia Tech. This has been a huge commitment in terms of time, but I’ve learned a lot.

Online MSc in Computer Science OMSCS at Georgia Tech

“University Master Degree – same as on-campus but it’s online”

As an online course the cost is only a fraction of on-campus classes, and in my case my employer covered the course fees. The classes are taken at a time that suits the student by following videos online and submitting projects and homework through an online portal. It even replicates the exam environment taking exams with the student monitored by webcam. The final degree certificate is the same as the on-campus degree.

Other than the cost and flexibility of working online the course is the same as those taught at the University so it is not easier or harder than an on-campus course, although it does have some different challenges.

The classes are provides as online videos through Udacity. These are mainly traditional style lecturer and slides, but some include added videos to show real-world examples. Some also include knowledge check quizzes during the classes so that you can check on your learning. These can be watched and re-watched as much as is required and don’t need to follow the pace of the class (although it’s usually a good idea to keep up with the videos). The assessment is then performed based on homework tasks, projects and/or exams. Support is provided to the students through forums (both students-helping-students and with Teaching Assistants supporting the students) and Virtual meetings with the TAs and/or Professor.

There are a few different specializations available and a reasonable amount of choice of classes within them, although some classes are compulsory (such as all specializations needing a theory class). There are around 29 classes at my last count, with more new classes being added each year.

“You don’t need a computing degree, but computing experience and maths knowledge is required”

I was a little concerned about my lack of knowledge when starting the Master degree. Whilst I already have a Master degree it is in electronics rather than computing and whilst I have had plenty of hands-on with computing and programming I did think I may be missing some of the theoretical knowledge around Algorithms. My theoretical maths is also a bit rusty as it is almost 20 years since my first degree. I therefore spent some time reading up on Algorithms prior to starting the course as well as trying to brush-up some of my maths. This paid off as I did well on the theoretical class and got a comfortable B, although not as good as the A I got on the other classes.

I do think it would be advantageous to have studied for a Bachelors level computing degree, it wasn’t necessary with the appropriate experience.

Classes I studied

I chose the specialization of computing systems, which is a fairly generic specialization focussing on operating systems, programming and security.
Below are the courses I took along with a short summary and example of the projects:

CS6250 Computer Networks

An advanced networking course looking at Software Defined Networking. Fortunately I had plenty of experience with computer networking so this was a good starting point, although the detail of Software Defined Networking was new.

This was project and homework based including monitoring and tuning network performance and creating a firewall using Software Defined Networking.

MSc CS6250 project network performance graph

CS6300 Software Development Process

This is a class I was particularly interested to take as whilst I have had a lot of programming experience this has mostly been self-taught and I wanted to understand some of the theory of how to program better. The class didn’t disappoint me and I learnt and awful lot from this one.

The course was project and homework based, mainly using Java and Android programming, which I enjoyed. This included a project for an Electronic Point of Sale system that had to integrate with a (fictional) credit card machine.

UML Diagram created for CS6300 software development process project 2

CS8803-002 Graduate Introduction to Operating Systems (now CS6200)

I’ve always been interested in operating systems and coding close to the hardware. This was a difficult course and had some complex projects based around C programming. It was particularly difficult through a couple of the projects, but it was very worthwhile and I have a much better understanding of programming and how it interacts with the hardware and the operating system.

The projects included writing a file cacheing proxy server in C.

There were also difficult exams as well as the course work.

The word introduction makes this sound like it would be an easier course, but it was just as hard as the advanced operating systems class.

TCP Dump from project 3 of OMSCS Introduction to Operating Systems

CS6210 Advanced Operating Systems

Although the previous class was an “introduction” and this was titled advanced it was on a similar level. The one thing being that it did need some of the knowledge from the previous course. This class included projects using C programming, including parallel processing and synchronisation, as well as exams.

OMSCS CS6210 Advanced Operating System - memory page file homework

CS8803-o04 Embedded Software (now CS6291 Embedded Systems Optimization)

I thought that the name of this was deceiving and I’m glad to see it has now been renamed. I was hoping for a class on writing programs to handle the special cases of programming on embedded systems, but it turned out to be more a course on compiler optimizations. Although it did cover some of the challenges of designing embedded systems including realtime programming, the projects were based around how changes in the compiler and code could result in faster code.

This did use a Raspberry Pi in one of the projects.

Online MSc CS8803 Embedded Software optimizations

CS6035 Introduction to Information Security

Another class that I particularly enjoyed, partly due to my past experience working in IT security, but also because it involved some fun projects. This was still very complex as it involved a required a knowledge of how the computer and operating system worked (so it was good to have taken the operating system courses first). The projects were challenging, but I found rewarding. It included creating a buffer overflow to break into a system, but also how to defend against such attacks.

There was also an online exam.

MSc Computer Science - Introduction to Information Security - Cracking the payroll system

CS6505 Computability, Algorithms & Complexity

This is the hardest class that I took. It required a high level of maths knowledge as well as an understanding of algorithms. The class was completely exam based. I spent a lot of time studying on the course and learned quite a lot, but would have preferred a more practical course on the use of algorithms rather than analysing the computability and complexity. The assessment was exam based, including several exams which had to be handwritten and then scanned into the computer.

This class is compulsory for a number of specialisations including Computing Systems. I received a comfortable pass grade in the end, but I know some other students that dropped the class or didn’t get the pass they needed.

This class is no longer taught having been replaced by a Graduate Algorithms course, which is aimed at making the class more relevant and hopefully improving the pass rate.

Exam from CS6505 algorithms - command and conquer

CS6310 Software Architecture and Design

Like the software development class this is something I was particularly interested in. There were some challenges due to working in teams (which was also the case with the software development class), which was made particularly difficult do to there being a large number of assignments which needed to be completed within a short period of time but these challenges were overcome.

The final project was a class management system application, written in Java using a MySQL database and including Weka Analysis.

GUI Mockup for project for CS6310 Software Architecture and Design

CS6262 Network Security

This is another class that I looked forward to and it was another enjoyable class. It involved looking at possible attacks and defences relating to network based attacks including network scanning, web browser exploits (XSS and Click Jacking) and malware analysis.

It was all project based, some of which I really enjoyed.

Click Jacking example from network security class CS6262 from Georgia Tech OMSCS

CS8803-O07 Cyber-Physical Systems Security

My final Class was Cyber-Physical Systems Security. This class was is mainly about security surrounding electrical systems, but also covered other utilities. It had a number of mini-projects, which were fairly easy and took much less time than the other classes, but also had a difficult exam. Still an interesting class, but not so much as the other security related classes.

Searching the Internet for Webcams - Cyber Physical Systems CS8803 Georgia Tech

“Studying online for a degree introduces some challenges, but also adds many benefits”

With the course being online then there were a number of advantages, such as being able to take the course at a time that suits you and being able to re-watch the lectures, but there were a number of challenges that it introduced.

I took the degree course alongside my full time job and family life as a parent of two children. This meant that a large proportion of my spare time was spent on the course. I tried to do most of the studying during the weekday evenings so that I could spend the weekends with my family, but this didn’t work so well with the team projects.

Whilst it is possible to take multiple classes most students I know took just one or two classes at a time. In my case taking only one class at a time meant that it took 10 terms which is about 3½ years to complete.

“Time zone can add additional challenge, but so too can other responsibilities”

I live in the UK, but Georgia Tech is a University in the USA, with most students being from the US. With a 5 to 8 hour time difference this added some additional challenges around timing. These were overcome, with some flexibility on my behalf as well as my family. For example I sometimes stayed up late (up to the early hours of the morning) to attend an online Office Hour with a TA and would schedule team meetings in my late evening to co-inside with early evening of team mates during the group projects. It was also a problem where virtual meetings would occur during my children’s bedtime, so I would have to try and put them to bed before or after the meetings.

The harder challenge when working in a team was that I preferred to avoid working weekends to spend time with my family, whereas other students would dedicate their weekends to their studies. In this case I would try and contribute towards the project during the week, but would inevitably also end up having to spend time on Hangouts or Skype calls during the weekends, which is one of the sacrifices I had to make.

Like other courses there are sometimes those that will seek to cheat to improve their score, or to avoid doing the set homework. This is a real shame as it could potentially damage the reputation of those that do work honestly. Fortunately there are steps in place and we do hear of people being identified and having their score reset or otherwise punished to prevent this from being a problem.

You may think that being an online course then it would be more open to cheating, but there are checks in place to prevent cheating. This includes AI cheat detection during exams (with manual verification) and checking submitted code for plagiarism. There are ways that students could still attempt to cheat, but this is no different from other courses and it doesn’t appear to be a major problem.

“Some of the classes did have teething troubles”

There were a few issues with classes in particular some assignments. Some of these were technical issues due to the classes being so new (in some cases I was taking the class during it’s first run on the online MSc program). These included problems with the Virtual Machines (most of the project work was in Linux Virtual Machines) or problems with the supplied code. Most of the technical problems were fixed by the students working together. These were a good learning opportunity, although perhaps not directly relevant to the topic at the time.

The other problems that I encountered were due to ambiguities in the assignment instructions. These were usually clarified prior to the due date, but did sometimes result in having to redo parts of the assignment which felt like a waste of time when there was a deadline running.

“How did I do”

In the end I managed to get an A in 9 out of the 10 classes, and a B in one. The US often use a GPA scoure which I achieved 3.9 and as a comparison with a UK that would be the equivalent of a distinction. I am very happy with my achievement which reflects the amount of work that I put into it. It is a difficult course, which I believe is important to maintain the high standard.

There was an option to attend the full graduation ceremony at Georgia Tech. Due to a combination of logistics and the cost of travel from the UK I made the difficult decision not to attend the ceremony. I was a little disappointed by this as it does feel a bit of an anti-climax after all the effort, but I am now eagerly waiting on receiving the certificate when I will take the opportunity to celebrate with my family instead.


It’s been a great journey. There have been highs with some fun projects and learning great new stuff, but also some low points when I’ve had a deadline to meet or being revising for an exam. In these ways then this is the same way as any University course and the final grade does reflect that. This has been a very difficult course, but in comparison to my previous Master degree I found the long and slow approach useful (taking one class per term) as it meant that I only had to focus on that one subject at a time.

For anyone considering taking a degree like this then you do need to think carefully about how much time you are willing to put in. In my case the impact was not just on me, but also on my family. Fortunately they were supportive of me spending time on my course.

For more details about the course then see the link below:

Note: The images in this post are intentionally small to prevent them from being used by future students, which would be a breach of the Georgia Tech plagiarism rules.

The power of open source – Creating a GUI with Python and guizero

January 13th, 2018

This isn’t going to be a guide about how to program a GUI (graphical user interfaces) using guizero (hopefully I’ll add some instruction on that in future), but it does explain which I chose guizero, some of the concepts I used and a bit of an insight into this open source software library.

Adding GUIs was too hard – until now …

The story starts about a month ago, when I decided that I wanted to add a GUI to my Network Quiz Challenge. I actually wanted to add a GUI a year ago, but decided it would take too long back then and it got pushed to the back-burning until now. I already had most of the code in place (it involves a Raspberry Pi running Python talking to a Arduino using PySerial), but it was command line only.

I have some experience of writing code for graphical user interfaces on a variety of platforms, but generally it is the most difficult and time consuming part of any programming project. For anyone that is starting out in programming it can also be an incredibly steep learning curve just trying to get started in GUI programming. I have created a program before using Python and tkinter (which is the default GUI library for Python) but the code created is quite complex – see NeoPixel GUI for Raspberry Pi.

Networking challenge - with guizero GUI

After looking around a bit I came across a couple of Python libraries that are trying to make the experience of learning a GUI easier, and in the end I settled on guizero. It’s mission “The aim of guizero is to make the process of creating simple GUIs quick, accessible and understandable for children.”

Contributing to the Python guizero library

I started work on the GUI version, but came across a couple of issues. One is that there was a bug in the provided example code which had the x and y values the wrong way around, which I was able to work through and submit the correct details back to the maintainers. The second issue was due to a lack of column and rowspan feature in the grid layout. The grid layout arranges the widgets into a grid going across and down. This is best visualized by thinking about a spreadsheet. If you wanted a header to go across multiple columns in a spreadsheet then you would merge multiple cells together, this is the same using grid layout where columnspan merges them horizontally and rowspan vertically. This is something that tkinter supports (which guizero uses behind the scenes), but because it needed to be configured when creating the widgets it was not possible to use this except by updating the guizero library. I raised this on the GitHub issues page. Fortunately guizero is under active development at the moment so I got a response straight away. We discussed different ways of implementing it and I was able to contribute the code to add that feature. I also updated the document showing an example of how the gridlayout can be used to arrange photos as shown below, which is something that was not possible using the grid layout before.

Python guizero, images with columnspan and rowspan

The code is now in the main code so can be used by anyone else. This is an example of how open source code can benefit the wider community as the things that I implemented for my own requirement will benefit others, in the same way that I was able to build on code that others had done (after all guizero would not exist at all without the contributions of others).

Creating the GUI for the quiz

I only had a short time to create the GUI, as it was needed for January I didn’t start until after I’ve finished studying for my Master’s degree in the December. This was also through the Christmas period where I’ve been incredibly busy with my family and other volunteer activities. So I didn’t have much time to explore different ways of creating the GUI and fell back onto an old tried and tested hack of using almost invisible images to set the column widths. This is an old technique that used to be popular with websites before we had CSS.

It’s a bit of a hack, but it did the job. I may look at alternatives in future which may work better, but as far as a usable GUI it worked well. For this reason I probably won’t be using this code as a teaching example, it’s also quite complicated for learning from as I have used object orientation throughout the code (something that I think is good, but perhaps a bit advanced for the kids that guizero is primarily aimed at). You can see an example of how it looks in the screenshot below. I think it looks OK, not as good as some applications, but considering it was done in a short timeframe then all the main functionality is there.

Screenshot of networking quiz running on Raspberry Pi / Arduino

Another “cheat” is that the speedometer shown in the screenshot above is actually a static image. I created three different images and an appropriate one is shown depending upon the score.

Using guizero and tkinter side by side

One other thing that I needed to do was to use some native tkinter widgets as well as those through guizero. In particular I wanted a File Open dialog, but that is not yet implemented. This is one of the flexibilities of guizero in that in some cases even where something is not yet implemented in guizero it’s possible to just call the tkinter code directly.

Contributing to open source software

Although almost all the code that I write is open source it is normally something I write for myself, either to meet a requirement that I have or as a way to learn something new. I have contributed to some other projects, but as with my contribution to guizero that has been only fairly small. Much of this is due to time as it can take a long time to get familiar with existing code to the point where you can provide a bigger contribution. Much of my time is spent on my family, other volunteer activities (including Scouting and STEM Ambassador), my personal projects (writing and programming) and until recently studying for another Master’s degree.

I’ve now completed my degree so I do have a little more time available, so I would like to contribute more to
a more established project, but I’m not sure what yet. I do think that these GUI frameworks are useful including guizero and pygamezero (similar concept but for creating games rather than regular applications).

It can be difficult when there is already an active team developing the code and you don’t want to get in the way of other development. In this case there was different ways that the span could be implemented, so I was able to discuss it with the existing developers first so that it was consistent with their ideas as well.


This post is more about the advantages of open source software. Open Source software benefits from the collective contributions of many people and it can bring additional rewards in knowing that you helped someone else. The fact that I could update the library in time to complete my project was much better than if this was closed source.

So if you see an opportunity to fix some code then take a look at how you can help.

Upgraded Networking Challenge for Computing fair

January 12th, 2018

I have written previously about a school computing fair that I helped support. I went along again this year as a way to promote STEM and in particular computing. As I work for a telecommunications company then I wanted to promote computer networking as a career option. I didn’t want to just talk about computer networking as I much prefer something that is more hands-on. I therefore created the networking challenge quiz, which involves a multiple choice quiz which is answered by wiring up the appropriate ports between two patch-panels. If they got the answer correct then it lights up green, get it wrong and it lights up red.

Without having lots of network switches I simulated the networking using an Arduino. I then connected a Raspberry Pi which could tell check the status of the Arduino pins and tell it to update the colour of the LEDs. The old post about this is available: Networking challenge quiz (CLI version)

This worked well, but this year I wanted to improve on it. In the past the pupils had to read the answers from printed paper, so this time I instead provided this through a graphical user interface (GUI) running on a Raspberry Pi, which also allowed me to add pictures associated with each question. Also in addition to lighting up the results on the patch-panel, the GUI showed a speedometer like image showing them how well they did.

Screenshot of networking quiz running on Raspberry Pi / Arduino

This was written using Python and guizero (but I’ll talk about those in more details in a future post).

The quiz worked really well, backed up by one pupil that said it was “great!” and clearly enjoyed taking part.

Most of the questions were ones that I had aimed at the appropriate age group (as an overview of computer networking is included in the school curriculum) and I also included subtle hints in the images. I thought that the scores were a little low (as I wanted the pupils to walk away thinking they had done well) and perhaps they were a little too subtle for some, so during the day I decided to make it a little easier and tweaked a couple of the questions. This is something that I wasn’t able to do last year when the questions were pre-printed, but with the new version it was just a couple of quick changes to the json quiz files. There was one question that was intentionally difficult to challenge those that know lots about computers, which relates to the change from IPV4 to IPV6, I’m pleased to say 4 pupils knew the answer to that question and a few more guessed the correct answer.

At the end I explained that whilst the quiz involved a lot of acronyms and that to the outsider computer networking sounds like a foreign language, that when working in the industry these acronyms do become second nature and so not to be scared off by them.

Networking challenge - with guizero GUI

I’ve made all the code available via GitHub, although it’s really just for this project it may be of use to others.
Penguintutor Github – networking quiz

Review of MeArmPi robot arm for Raspberry Pi

November 30th, 2017

I backed the MeArm Pi kickstarter project earlier this year, and just received the finished product.

It’s a, laser cut, plastic robot arm which has a built-in Raspberry Pi. It is created by Mime Industries who have previously created a similar robot arm without the build-in controller / Raspberry Pi. It can be controlled using built-in joysticks or through programming via a choice of languages.

The MeArm Pi kit comes well packaged. My version included a Pi Zero with pre-installed SD card, although with some models you need to provide your own Raspberry Pi. It also came with a separate power supply.

MeArm Pi robot arm kit

Assembling the MeArm Pi Robot Arm

Opening the box and all the parts were laid out with an excellent instruction sheet complete with pictures for every step of the assembly. Assembly was mostly straight forward using the supplied allen key. It was a little wary at first as the screws do take some screwing in and I didn’t want to break the plastic, but went okay. The one part that was fiddly is the claw module which needed a bit of fiddling to get the bits in the right place. I also needed a screwdriver at this point as the screw on the servo motor was protruding a little.

The Raspberry Pi is mounted within the controller at the back of the arm.

First test of the MeArm Pi

Assembled Mime Industried MeArm Pi robot arm

When connected and powered on you first need to wait for a short while for the Raspberry Pi to boot. It should then be possible to use the two built-in joysticks to control the arm. I found that most of this worked straight away, it could move left and right, the arm could tilt up and down and the claws could be opened and closed, but there was a problem with the main forward and backwards movement.

I followed the troubleshooting advice which was mainly about the screws not being too loose, or too tight (a bit uncertain at first exactly what is correct but you do get a feel for it later). Which didn’t fix the problem. It was after I looked at the web interface that I realised that the servo was moving correctly, but that the small arm on the end of the servo was in the wrong position. I therefore removed the servo, and repositioned the arm using a screwdriver.
This did have to be a certain servo which was marked with the white dot. I expect this was just a one off where the servo was not correctly positioned prior to shipping. Once I realised what was wrong it was an easy fix in the end.

Programming the MeArm Pi

The MeArm Pi SD card image includes a WiFi hotspot and built-in web server. This means that you can connect to the Raspberry Pi straight away without needing to connect a screen or keyboard. If you do need to connect up a screen for any reason then with the Pi Zero at least it does mean a reasonable amount of disassembly, but hopefully that won’t be required.

Me Arm Programming web interface for Robot Arm

Included are four different programming languages from simple block based programming using Blockly to full text based programming using Python. Also included are JavaScript and Snap.

The MeArm Pi uses fservo motors which are controlled using degrees of motion which makes positioning the arm using programming easy and more reliable than normal DC motors.

One thing to be aware of is that the Raspberry Pi has ssh enabled without default passwords. It is good to have the ability to ssh onto the Raspberry Pi controlling the robot arm, but please ensure you change the password when you first use it.

How does the MeArm compare?

There are other robot arms available, but this is the first I’ve seen with a Raspberry Pi built-in to the robot arm. The one I have to compare with is the Cebek robot arm available from CPC and Maplin.

The Cebek robot arm is moulded plastic which gives more substantial parts. The Cebek robot also has an additional motor which gives it more control on positioning of the arm. Where the Cebek does not match up so well is that the motors are very difficult to control with no feedback of the position of the motors. The Cebek arm is controlled using a USB, but only includes Windows software with limited programming ability, although I have written my own Graphical application for controlling the Cebek Robot Arm for the Raspberry Pi / Linux.

Whilst each of the robot arms has their own good and bad points the built-in programming of the MeArm Pi makes it far more appropriate to learn programming, and the use of Servo motors makes it easier to use. So I think the MeArm Pi is the better for most people.


As a device to help teach programming, the MeArm Pi is an excellent robot arm. It is a little fiddly to put together and I had a couple of little issues with mine, but the programming environment is excellent.

Having the ability to control it using both the joysticks and through programming should mean that this is easy to get started with.

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.

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