The new Raspberry Pi was launched last week, and I took the opportunity to finally get hold of one to see what they could do. My first project was to try out a cool set of programmable LED traffic lights called a Pi-Stop. These are reasonably inexpensive (£2.50 each) and plug directly into the GPIO pins on the Raspberry Pi. You can buy Pi-Stops from 4Tronix here.
Now before I plugged them in, I had to do a little tinkering and install a special version of Scratch called Scratch GPIO7 by Simon Walters. Instructions on how to install that can be found on his Cymplecy website here.
I also ran into an issue with the GPIO on the new Pi which has yet to be fixed officially. I found a fix here. If you have an older version Pi you can ignore this for now.
With that done, I plugged the Pi-Stop in and powered up the the Raspberry Pi. A guide on how to plug the Pi-Stop in can be found here. I connected it to pins 20-26, taking Pin 1 to be the one nearest the SD card port.
In Scratch GPIO, I could then set up a program to make the LED lights switch on and off. Basically this is done using the Broadcast command. Here’s a guide on how to do that.
So Broadcast “pin 26 on” would turn the red light on, and “Pin 26 off” should turn it off. My traffic light code looked something like this:
And did this:
Which I’m rather pleased with 🙂
If you have some Raspberry Pi’s in your school, then the Pi-Stop provides quite an inexpensive way to incorporate a little control activity into the lesson. Maybe observe a traffic light working first so the children can study the sequence (or watch a film).
If you’ve used a Pi-Stop, or have some other cool GPIO devices for the Raspberry Pi, let me know in the comments!