I’ve realised that I haven’t yet written a blog post about my favourite bit of kit for the Raspberry Pi, the PiStop by 4Tronix.
So first lets talk about why I like it so much then I’ll talk through a demo of using it. Earlier in this blog, I talked about the CamJam EduKit and how much I liked it, the biggest problem was the wires – for younger and not so dexterous fingers, all that work with fiddly LEDs and resistors and cables is quite a hassle; not to mention just grasping the whole concept of why. When you finally get everything wired up, the next task is to write some code in either Scratch or Python and THEN you get an exciting output of flashing lights. Not so with the PiStop – it neatly slots over 4 of the GPIO pins (three programmable GPIO pins for the LEDs and one ground to complete the circuit) and then you can just load up Scratch and code away. For me, this is ideal for the younger and more easily distracted children as it’s quick and easy to make something actually happen with a few blocks of Scratch code. It’s also easily extendable – once you have one flashing light, can you make the other 2 flash? Can you make a traffic light sequence? Can you now write the same code in Python? Then once all of those activities are complete you can then run the whole activity with cables, breadboards and LEDs, but now the children are excited, they already have an idea of how to get the code working and building the circuit is like moving on to the ‘grown up’ stuff like the CamJam kit.
So, how do you plug in your PiStop? I’m a creature of habit so I tend to always plug the PiStop into the same place – it can actually be placed anywhere on the pins where you have one ground and 3 GPIOs together.
I’ve mentioned before that there are two different numbering systems for the GPIO pins, the picture below shows both number systems for the model A and B Raspberry Pis, which are the older versions with only 26 pins; both the B+, A+ and 2 models have 40 pins, but the first 26 are the same as below. On this diagram, the ground pins are labelled in white, the programmable pins are green and the live, powered pins are red and orange. The most popular labelling system, known as BCM, is listed in the white boxes on the outside, whilst the simpler numerical system is written on the pins. From my experience ScratchGPIO uses the simple numerical system, but it might work for both! My usual spot for mounting the PiStop is from numbers 9-15.
The first thing you’ll need to do is to make sure that Scratch GPIO is installed on your Raspberry Pi – details for how to do this from Scratch GPIO creator Simon Walters can be found here.
Once installed on your Pi, load it up and cross your fingers – you should get a message box pop up telling you that remote sensor connections are enabled – if you don’t you will need to run some updates because it means it’s not working properly (boo hiss). I came across this a few times with the latest version of Rasbian and I’m not going to lie, I had to resort to getting someone more technical than myself involved.
So, let’s assume that you have got Scratch GPIO working fine and your PiStop is plugged in as in the photos below:
So to make the first light turn on we need to use the control tools on Scratch – our key command is ‘broadcast’ with high being on and low being off. See the photos below for step by step instructions for turning the first light on and off ten times.
You’ll notice that I’ve put ‘wait’ blocks in between each of the broadcasts, inevitably the children will miss these out once in a while, which will cause the lights not to work- this is great because you can reiterate both the importance of debugging and that code does exactly what you ask so your instructions need to be clear.
Once I’ve shown the children this step, I usually ask them to figure out how to get the other two lights on (pin 13 and pin 15) then the challenge is to try and make a traffic light sequence. I was fairly impressed when a couple of boys extended themselves by using the CamJam Python code with the PiStop to broadcast what they referred to as a disco, whilst on the screen a selection of messages appeared in their Python window using the print command.
So, basically, this is a very simple, cheap piece of kit which is really easy to use and a great stepping stone to more complex code. I would definitely recommend that any Raspberry Pi teachers get at least one PiStop into their classroom as a starting point for physical computing.
Good luck everyone and enjoy coding!
PS For anyone who’d prefer a real life demo, my next coding evening will be on Tuesday 5th May in Twickenham