2. Other Projects‎ > ‎Raspberry Pi‎ > ‎

Pi Blog

Hack Horsham Raspberry Jam December 2016

posted 12 Dec 2016, 02:40 by Andy Lakin-Hall

Thanks to the Hack Horsham team for organising the December 2016 Raspberry Jam event yesterday. This was my first Raspberry Jam as an exhibitor, and I was unsure about whether what I had to show would be worth sharing. The reaction from visitors was overwhelmingly positive, and it was certainly worth being there.

I took a basic Raspberry Pi hooked up to a MakeyMakey controlling the RPi version of my MonkeyBonk game.

MakeyMakey plugs into a USB port and pretends to be a keyboard, so can control any software that uses cursor key presses, just like you'd have if you'd made a Scratch game. This brings an extra dimension to any program, as you can make a custom keyboard to control your game; the first steps into physical computing.

This was the most frequent question I received at the event from parents of Primary School children, "We've done Scratch at school, where do we go next?"

One suggestion would be to use Scratch on the RPi to control the GPIO pins. There's all sorts of devices that can plug straight into the GPIO like the Sense Hat or PiBrella, and with RPi Scratch you can easily write the code to control them.

My RPi FUZE has a handy IO port connected to the GPIO, so it's easy to directly connect LEDs and switches directly to the breadboard, and control these from Scratch too. my Monkey Bonk game includes code that makes an LED light up as soon as the monkey stares to rise, and then detect when a switch is pressed to make the monkey go down. Making things happen in the real world can be the start of real control technology. If you can turn an LED on or off then you can control a motor. If you can detect a switch you can detect a sensor. Everything leads to more complex projects in robotics.

Another popular piece of my kit was my Maplin Robot Arm. This now has drivers for Windows10, and it's great fun to build. But more excitingly you can write your own code to control it through a RaspberryPi.

Mine was being controlled through FUZE BASIC. Fuze provide a programming language that sits in between Scratch and more advanced Python, and one of the demo programs they have in BASIC will control the Robot arm. I'm open minded about FUZE BASIC, but have seen it used successfully in Primary schools. It's free to download onto a Raspberry Pi, so you could give it a go. I like my FUZE Raspberry Pi with it's built-in IO port very much.

The robot arm can also be controlled through Scratch. There's a video of someone else showing how to do that, but again it shows how you can step on from simple Scratch onto more complicated things.

An alternative path leading to robotics and control technology might be the Crumble Controller

Crumble is a tiny circuit board that can be programmed to control LEDs and motors, as well as detect all kinds of input devices. You can use it as the core for all kinds of simple control technology projects using basic components that you find in beginners electronics kits.

The best thing about Crumble is the software they supply to program it. The Crumble software uses drag and drop blocks just like Scratch, so it's easy for anyone familiar with Scratch to get into Crumble.

Additionally, it is possible to program a Crumble directly through Scratch

Redfern do a whole load of kit that connects to Crumble, including robot parts, and so do 4Tronix. Plenty of parts that you could use to create a whole load of projects stepping on from Scratch.

Ultimately the next step on might be to try a MicroBit.

These amazing little devices have so much potential. A tiny package - about the same size as a Crumble, with the same inviting croc-clip connecting points, but with so much more built in to the board.

I've seen lots of superb accessories that you can connect to MicroBit, and many more in development. There are so many ways you can program one of these, including drag and drop programming similar to Scratch. But I've not had a chance to play with one of these myself yet, so I can't tell you how easy it is yet. But I'd certainly recommend trying one as a next step on from Scratch.

Thanks again to the Hack Horsham team for organising the event. It was great fun and I'd love to do another.

Scratch Monkey Bonk Game for Raspberry Pi

posted 9 Dec 2016, 13:40 by Andy Lakin-Hall   [ updated 9 Dec 2016, 13:41 ]

With my first Raspberry Jam as an exhibitor coming up I decided to develop this Scratch game for the Raspberry Pi. Now I can access the GPIO for Outputs and Inputs, I wanted to try these out for real.

The game already has multiple options for input. You can use the mouse to click on the monkeys, or hit the cursor keys to bash them down. The cursor keys mean the game can be controlled by a MakeyMakey - which is fun. I'm working on a conductive tray that can hold playdough or fruit which you can tap to make the monkeys go down. I'll post about that later if I can get it to work.

I'm building this circuit on my FUZE with the handy IO ports and breadboard. The first change I wanted to try was to have four LEDs that would light when a monkey was rising.

Start with a broadcast to make sure the gpio server is on: broadcast gpioserveron

Next the LEDs connect to GPIO pins 0 to 3, and I know to get these to work as outputs I have to configure them first.


I added in commands to turn each pin on and off as required, including a full set of off commands at the end of the game to make sure everything is actually off at the end of the game.


With that part working, the next step was to include switches beside each LED that you can press to make the corresponding monkey go back down.

This was slightly trickier, as I had to first identify the right codes for GPIO lines 4 to 7, but I figured these out.


I also had to work out the right circuit to connect the switch. This turned out to be easier than I thought it would be; just a lead from the GPIO pin to the switch, and then another to GND. The pin floats high, and then goes low when the buttons is pushed.

Here's the components arranged on the board.

Within each monkey, I added the command to turn on the appropriate GPIO pin. This is Monkey 1, so its code is gpio17on

The code for detecting the event that makes the monkey descent has got rather complex now, as I want it to work for a push button as well as cursor keys and mouse click.

The most important bit is the gpio23 sensor value. Once you've configured a pin as an input, it appears in the Sensors block.

If the button is pressed, gpio23 goes low. This triggers the Squeak2 sound and the bonked flag variable is set to TRUE.

Next comes the command to turn off the corresponding LED gpio17off.

Finally, when the GAME OVER broadcast is received, the monkey descends and the LED off command is sent once again. broadcast gpio17off

The full game can be downloaded below.


GPIO pin confusion

posted 8 Dec 2016, 05:13 by Andy Lakin-Hall   [ updated 9 Dec 2016, 00:53 ]

One of the things I've found with using the GPIO pins is getting confused about which pin to use.

Now my bare Pi GPIO looks like this

The thing about that is its tricky to know which pin does what. There are guides to connect things like this one...

but the problem with that is, at the moment I don't have any female ended jump leads which can plug straight on. I've got some on order now, but they've not arrived yet.

So previously I picked up an adapter in the Maplin store which has a nice ribbon cable and handy clips for wires.

But the problem with this is there were no instructions, and the labels don't match anything I understand yet. It didn't even give me a clue about which way round to connect the ribbon onto the Pi. By guesswork I figured it out...

...and the ribbon has to point out from the Pi.

Now to further complicate things, I have a Raspberry Pi FUZE kit.

This encases the Pi and has a handy IO board.

This has GPIO pins 0 to 7 available over on the right. You can plug in fly leads to the breadboard beside, and then program them through FUZE BASIC quite easily.

PINMODE ( 0, 1 )
WAIT( 0.5 )
WAIT ( 0.5 )

And what this does is make an LED on the fuze GPIO pin 0 flash on and off. Simples.

What's floored me is getting Scratch to do the same.

The latest version of Scratch 1.4 on the Pi includes a GPIO server, so you can read and write to the GPIO in Scratch. Which is cool, because I enjoy working in Scratch very much. It make sense to me.

Now in my previous experiment I wrote the following code

And that worked on the bare Pi connected to the Maplin adapter block. I chose gpio17 because that was one I could identify on the block when I couldn't see gpio0 like on the FUZE.

What I hadn't realised is the Pin numbers bear no relation whatsoever to the GPIO numbers, and you need a reference guide to work out which is which. Bu fluke, I'd stumbled on the fact that gpio17 in Scratch is the same as Pin0 in FUZE.

On the back of the FUZE BASIC Reference Guide there is a GPIO Pin layout plan that looks like this...

..which made no sense at all! But then I followed the link to WiringPi which is the Library that FUZE uses, and suddenly I realised that the FUZE plan actually needed to be cut out and pushed over the GPIO pins so that the column on the left go over the right strip of pins, and the column on the right go over the pins on the left!

WiringPi have a better pin guide.


On this table, the physical pins are listed down the centre as HEADER. Then working outward, there's the actual name, the BCM GPIO reference and then the WiringPi code.

So, by accident, the header pin 11 which is connected on my FUZE to GPIO0 is also BCM-GPIO17.

So, for Scratch, if I wanted to connect LEDs to GPIO pins 0, 1, 2 and 3, I'd actually need to use header pins 11, 12, 13 and 15, and (because I've got a Rv2 board), in Scratch that would be gpio17, gpio18, gpio27, and gpio22.

Here's the Scratch code...


...and here's the wiring on the FUZE breadboard...

Now, back to the Maplin connector block.

This, I can now see, make available some of the important GPIO pins.

In fact, the top connector maps header pins 1, 3, 5, 7, 9 and 11, 

 Label Header
 3v3 1
 +GPCLK0 7
 GND 9
 P17 11

and the right connector maps header pins 13, 15, 17, 19, and 21, then goes weird and jumps to header 22, 24 and 26.


Finally the left hand connector, which is mapping the right hand line from the header;

TXD    8
5VO 4

Here it is now labelled up.

Scratch V1.4 in Raspberry Pi GPIO control

posted 6 Dec 2016, 03:33 by Andy Lakin-Hall   [ updated 7 Dec 2016, 12:29 ]

It turns out that the September 2015 release of Scratch for the Pi, included in the Raspbian Jessie release, introduced a new GPIO server.

This means that you can access to make driving LEDs, buzzers, and other stuff directly through Scratch.



I can't get it to work on my FUZE RPi   :(

What's wrong?

I've swapped to my basic RPi, with the latest Raspbian distro, and connected up a GPIO adapter block I picked up at Maplin. This had a handy ribbon cable and clip sockets to plug things in to the GPIO pins. I don't have any jump leads that will directly plug into the GPIO at the moment, so this will have to do.

Slight problem is this adapter doesn't have all the pins. But I can see P17, so I will try that.

So a lead from P17 to a 220R resistor, then to an LED and then to GND.

Start Scratch on the Pi and enter the following code;

The first line initialises the pin as an output.

The loop tells P17 to turn on and off at 1-second intervals.

Here's the whole system

The LED flashes on and off, just like it should. That's really good news, as it means I can now start writing Scratch projects on the RPi that access the GPIO pins.

So why didn't it work on the FUZE? I'm using the latest FUZE distro, and the version of Scratch there includes the Edit > Start GPIO Server option. The FUZE provides a very handy IO Hat connected to the GPIO, and it has a slot in breadboard for projects. I got an LED connected to GPIO1 working on the FUZE through FUZE BASIC, but it wouldn't work through Scratch. What could be wrong?  

Things to try...

  • Use the Maplin connector block on the FUZE GPIO pins, instead of using the FUZE custom Hat.
  • Use the SD card from the bare RPi in the Fuze
Anyway, now I've got it working, I can follow up the training information at on the Raspberry Pi website. 

Scratch Picoboard for Raspberry Pi

posted 5 Dec 2016, 01:47 by Andy Lakin-Hall   [ updated 6 Dec 2016, 04:34 ]

The Picoboard is a really simple way of interfacing to Scratch. 

It includes a switch and a slider potentiometer, sound and light sensors and four sets of alligator clips that measure the electrical resistance in a circuit.

I've got two of these which I acquired from Maplin, and I've used them successfully with PCs for lots of projects.

I was delighted to find out that these work with Raspberry Pi. There's a guide page here.

The author says that the Pi detects the device automatically, which sounds great, because I've had to install drivers on WinXP machines before.

He also writes...

If Scratch fails to detect the PicoBoard by not registering resistance values, try restarting Scratch and make sure you do not have multiple instances of Scratch open, because that will cause conflicts. I've never had problems detecting the PicoBoard on my Pi, but if you do experience problems, try starting Scratch from a terminal window with the command scratch and look in the terminal window for clues. You can also watch syslog for problems: Disconnect the PicoBoard, use the command tail /var/log/syslog -f from a terminal window, then plug in the PicoBoard and watch for errors.

...which sounds really encouraging.

Except, I can't get it to work :(

Now what?

Python Snowflakes

posted 30 Nov 2015, 13:04 by Andy Lakin-Hall

I've been teaching a unit of good old-fashioned Logo coding with Year 5 recently - starting with the Hour of Code Frozen tutorial, progressing to Scratch, and then finally directly with MSLogo.

the Raspberry Pi foundation today published this post about doing the same sort of thing in Python, so I am looking to try this for myself, and then break out the Fuze at my Code Club session and see if some of my stars coders can tackle it too.

Check out the post at https://www.raspberrypi.org/learning/turtle-snowflakes/worksheet/

FUZE kit

posted 14 Feb 2015, 06:24 by Andy Lakin-Hall   [ updated 14 Feb 2015, 06:25 ]

I was lucky enough to win a Raspberry Pi FUZE kit in a competition at the BETT exhibition this year. It was delivered to me at school, and my Code Club were treated to the chance to play with a whole load more for the session.

In the box was the FUZE itself, in limited edition retro BBC Micro colours, along with the power supply and a wireless mouse.

The FUZE is fitted with a GPIO buffer and a breadboard for making up circuits with the box of components supplied. There's red, yellow and green LEDs in the kit, as well as load resistors to let the LEDs work at the supply voltage. There is also several micro switches, an LDR and a 7-segment display. A whole smorgasbord of bits to get started with.

Also included are two books; a getting started guide and a full FUZE BASIC reference guide. This little spiral bound booklet is reminiscent of the BASIC guide that came with the BBC Micro. I love it - a GENUINE book, when normally all you get is a pdf file.

What's not so great

The FUZE kit is brilliant, but there's a couple of weird things.

First, the wireless mouse isn't great. In fact it's really naff. I'll be replacing that with a good Logitech one as soon as possible.

Second, the built-in Raspberry Pi SD card is Micro-SD size. They include an adapter in the kit, but it means I'll have to obtain some of my own micro-SD memory cards, rather than using the full sized ones form my existing Raspberry Pi kit.

Finally, although the FUZE is lovely, it's expensive. My Code Club kids all wanted to have one of their own at the end of the session. They, and their parents, all ended up terribly disappointed at the price of the kit, and that will be as far as they are able to take it. Even for us in school, the price of a FUZE is comparable to a modern Windows 8.1 tablet computer. We'd get much more use of the tablet machines, and innovations like the Shrimp kit make Arduino projects really affordable.

The big advantage

So the big advantage of the FUZE is the BASIC programming language - pitched right so it is simple to step across from Scratch. My CodeClub kids found it really simple to use; the programming was straight forward. Having everything in a single case is really convenient and encourages experimentation. You CAN put the individual parts together, but that's fiddly and a big disincentive. Having it all in one kit makes learning about programming and interfacing easier.

Minecraft on the Raspberry Pi

posted 25 Jan 2014, 08:54 by Andy Lakin-Hall   [ updated 25 Jan 2014, 13:44 ]

Looking for a good project to try out, I came across this - Running Minecraft on the Raspberry Pi.

To get started, I first set up a new version of Raspbian from NOOBS. The I followed the instructions on this site... 

http://www.raspberrypi-spy.co.uk/2013/10/how-to-setup-minecraft-on-the-raspberry-pi/Click the LXTerminal icon to open a terminal window. Use the following command to download the Minecraft package from the official site :

wget https://s3.amazonaws.com/assets.minecraft.net/pi/minecraft-pi-0.1.1.tar.gz

Then use the following to unzip the contents :

tar -zxvf minecraft-pi-0.1.1.tar.gz

This should have created a directory and extracted some files into it. Let’s open that directory :

cd mcpi

Then finally you can run the application using :


The Minecraft window should open.

There is more instructions about how to create an icon on the desktop to launch Minecraft.

Here is how to use it

ESC  Pause/Menu

W    Move forward

A    Move left

S    Move backwards

D    Move right

E    Show inventory of blocks

1-8  Select items in the quick-bar

Left mouse  Destroy blocks

Right mouse Place blocks

Space  Jump (ascend in fly-mode)

Shift  Sneak (descend in fly-mode)

There is a helpful site called MCPI Online at http://mcpionline.wordpress.com/ for help with using Minecraft-Pi

Pi Edition

All of the controls in the Pi Edition are fixed and cannot be changed.

Action Function
Mouse Move Turning; aiming; third person camera movement.
Left click Destroy blocks (hold down shortly); Move a block from the selection screen to the first hotbar slot, pushing the rest of the items one slot to the right.
Right click Place blocks; Charge a bow (firing is broken).
Mouse Wheel Scroll Scrolls through the quick-bar.
Esc Opens up or closes the menu and gives back cursor control.
1 - 8 Selects the appropriate quick-bar item.
W Move forward.
A Strafe left.
S Move backward.
D Strafe right.
Spacebar Jump. When double-tapped, toggles Fly Mode. When Fly Mode is on, causes the player to gain altitude (ascend).
⇧ Left Shift Sneak. When Fly Mode is on, causes the player to lose altitude (descend).
E Open the list of blocks.

5 Raspberry Pi's for School

posted 25 Jan 2014, 07:38 by Andy Lakin-Hall   [ updated 25 Jan 2014, 07:38 ]

 I was very pleased to receive an email from the Raspberry Pi Foundation about our school's entry to the "Hour Of Code" competition.

Thank you on behalf of the Raspberry Pi Foundation for participating in the “Hour of Code” competition to win some Google Raspberry Pis. We have been overwhelmed by the response and pleased to see so many schools and groups taking part. Over 750 schools registered, with more than 15,000 young people taking part, which is fantastic.

I am told that Crockham Hill School will receive five Raspberry Pi's in the next few weeks - so I'm going to have to come up with some projects which we can use them for.

The immediate problem that I foresee is the lack of school monitors. Raspberry-Pi's have HDMI or Video output. We don't have any spare monitors to connect these to, so if we are to use them we will have to obtain some HDMI-capable monitors from somewhere.


posted 8 Sep 2013, 02:36 by Andy Lakin-Hall   [ updated 8 Sep 2013, 04:25 ]

From the NOOBS OS selection I have chosen to install RASPBMC Media Centre.

RASPBMC is XBMC optimised for the Raspberry Pi. It is based on Debian Linux but has a simple user interface designed to make playing back media simple.


I have a load of videos on my external USB hard drive which I hope will play through RASPBMC. I also have my TP-Link WiFi dongle and a wireless keyboard with a touchpad. The WiFi dongle can plug into one of the Raspberry Pi USB ports. The second port can be occupied by my unpowered USB hub. The External Hard Drive has its own power supply, so should work on the unpowered USB hub. The dongle for the wireless keyboard can also connect to the USB hub - I'm hoping it won't require too much power and stop the Pi from working.

The Pi connects to the TV through HDMI.

Power On

On power on I get the "R" logo appearing quickly. it take about a minute to fully boot to the RASPBMC Home menu.

I can navigate using the wireless keyboard - either using the cursor keys, return and escape, or using the touchpad mouse cursor. The interface is a little tricky to get used to at first, and there appear to be TWO settings options.

Set up wireless network connection

The first thing to do is set up the wireless network. I scroll right to PROGRAMS and choose Raspbmc Settings below. This gets me into the Network Configuration settings where I can add my home WiFi connection settings. It's up and connected straight away.

Getting Screenshots

Pressing the Prt Scr button on my wireless keyboard takes a screenshot. The first time it asks me where to save the file. I've set this to be the pi folder. I am able to find that folder through the NETWORK on my laptop and get at the png files this creates.

BBC iPlayer Add-On

There are a whole load of streaming video service add-ons for XBMC, but the one I really want is BBC iPlayer, which doesn't appear on the add-ons list through the menu.

At http://www.raspbmc.com/wiki/user/addon-support/ there is a list of working add-ons, with a reference to iPlayer. Follow through the instructions to download the ZIP file to my laptop's PUBLIC folder. Then navigate to that folder through the Add-Ons directory on RASPBMC. The add-on works straight away!

While I'm doing Add-Ons, I'll add the Discovery Networks and 4OD services too.

Adding files to the system

It is possible to add files to the Video Archive through Windows Network, but this takes a long time. It seems more sensible to just connect the external hard drive enclosure to my laptop via the fast USB 2 link and copy across the files, before reconnecting the drive to the RPi and booting it up.

Through the VIDEOS menu I can add a network media source. I am adding my old network LANdisk which I know works through the network. I know this network drive only works if you enter the IP address - in this case I have shared a folder with a null password. I am adding this through the SMB folder settings, and with a bit of tweaking I get this added.

Once a media source is added, I am choosing the TVDB scraper - because most of what I have in my storage are TV shows. This scraper does quite a good job of working out what's there and it seems to work pretty well.

The network media source sometimes hangs up, and then recovers after a minute. I'll give it a try and see if leaving the LANDISK as a network drive is more convenient than connecting it directly as a USB device.

1-10 of 19