Friday, 28 March 2014

So the boys' school wasn't the only winner of Raspberry Pis. Oz entered a poster competition just before Christmas and this week his Raspberry Prize arrived. Interestingly it has clear case rather than the white one that the school Pi had. Hmm, maybe there's a random distribution of cases: I need to check the other schools ones!

Tuesday, 25 March 2014

The PiBrella is a really neat bit of kit, especially when combined with CympleCy's ScratchGPIO. To help some of my CodeClub posse get to grips with it I've knocked up a simple Scratch program that demonstrates the different ways that the hardware elements can be addressed.

Clicking on the red LED sprite turns the red LED on the Pibrella on and off.

Adjusting the AmberPower variable using the slider changes the brightness of the amber LED

Ditto for the Output E LED using the PowerE slider

Clicking on the buzzer sprite makes the buzzer buzz!

If you connect the two A inputs on the Pibrella together with a resistor then the sprite will change to show LED A lit

Pressing the button on the Pibrella makes the corresponding button sprite change its costume so that it looks pressed.

Sunday, 23 March 2014

My CodeClub posse really enjoyed the Raspberry Pi spud game last week so I want to give some of my yr 6s a challenge and see if they can come up with a game that uses some external hardware themselves.

My potatoes were getting a bit mouldy and the whole breadboard setup can be a bit fragile, so I was looking for some more robust for their first project. The Pibrella board is a great, cheap bit of kit that has a bunch of LEDs, a buzzer, a button and a bunch of inputs and outputs.

Thursday, 20 March 2014

The Raspberry Pis that the school received after entering the hour of code competition are great. They arrived in a really nice box and are neatly packaged. You get a case, power supply, 4GB SD card (with NOOBS), a shiny and sturdy 'getting started' guide and even a free copy of the MagPi magazine.

I do wonder about the choice of case though. It's smart and tough and... white. Which means that the interesting bit - the Pi itself - is largely hidden away. Don't get me wrong, I think providing a case is a great idea. It will help keep the Pis safe and prolong their useful life. But to conceal the Pi seems to contradict the whole point of making them available to schools.

If the intention is help kids understand more about computers work then presenting them with what is essentially a black (well, white) box just feels a bit odd, especially when the same case is available in transparent plastic.

The case is also quite tricky to open, especially when stiff and new. There are four tabs on the bottom that you have to release before the top can be removed, and this can require a bit of a wrenching even if you have a screwdriver to hand. My 9 yr old - who's pretty dextrous after hours of Lego building - can't open one up. When I was looking at the new Pis with some of the teachers, they looked slightly horrified as I man-handled the case to remove the top and reveal the device inside.

The other problem is that these cases have no access route for either a Pi camera cable or any connections to the GPIO pins. As I mentioned in my post about the Spud game, the key selling point for kids is all the cool stuff you can connect to the Pi.

I imagine the choice of case was primarily to keep costs low. The wonderful PiBow cases from Pimoroni are a lot more enticing and even their assembly is a fun lesson in 3D shape manipulation (although the component parts are certainly more fragile and the plastic screws easy to lose). perhaps most importantly, they have slots for the camera and a ribbon cable for the GPIO pins. They're also quite a bit more expensive than the simple 2-piece cases shipped with these kits.

Perhaps a better compromise would have been something like the IceBerry cases (I don't have any to show a photo) which are more affordable but have the slots for cable access.

So if you have got one of these Pi kits, my advice would be to use the Pi with the lid off wherever possible so that the kids can see what's going on inside and get easy access to the GPIO. Keep the lid for safe storage though!

Tuesday, 18 March 2014

My School was lucky enough to win 5 Raspberry Pis in last Autumn's Hour of Code promotion and I thought it'd be a good idea to introduce them to my CodeClub posse.

I'm a big fan of Raspberry Pis - I've got several doing various jobs at home - but I've always wondered just how well they'd fit into a Primary School environment. The biggest draw for many youngsters is the ability to interact with the Minecraft Pi Edition through code. But my Codeclubbers are still using Scratch and so for their first taste of Raspberry Pi I wanted to stick with something familiar.

So there is the dilemma: running Scratch on the Pi by itself doesn't really offer any advantages - in fact if they connect one up to the school's ICT suite PCs, the only difference they'll probably notice is that Scratch runs more ponderously. Will that get them excited about Raspberry Pis?

I needed a project to really demonstrate what (for me) is the big plus point of Pis: the ease with which you can connect and interact with external devices. A simple idea would be to connect the GPIO to some breadboarded LEDs and make them flash with Scratch code, but that seemed a little tame. So in the end I decided to make use of an Adafruit capacitive touch sensor which I'd got from Pimoroni and hadn't really put to good use yet.

Fortunately ARGHBOX have already produced a great tutorial for using the sensor to interact with a set of potatoes! So using that as a starting point I created a simple "Simon says" type game for the Pi using Scratch.

What you'll need

A Raspberry Pi (obviously)

An Adafruit touch sensor

A breadboard

5 x 10K resistors

Some wires

Some potatoes

A Pi Cobbler

Software

The latest and updated version of Raspbian (this will probably work on other distros but I did not test any others).

ScratchGPIO5 from cymplecy (the default version of Scratch that comes with Raspbian doesn't know how to talk to the GPIO pins).

Assembly

The setup is almost identical to ARGHBOX's but I used different GPIO pins so that it would work more easily with the sensor inputs made available by default in ScratchGPIO5.

The cymplecy site has some great documentation for using Scratch with GPIO inputs and outputs, however the key elements of my Scratch game are quite straightforward.

First of all you need to set the relevant GPIO pins to act as inputs. This is achieved by sending a broadcast message of the format shown below.

Then the main code that interacts with the spuds simply checks for a change in the input value and then acts accordingly.

The game

The player presses the S key and the potatoes on screen flash in a random sequence.

The player then presses the space bar and gently taps the real spuds in the same order as they flashed on the screen. The spuds say "Oi!" when they're tapped and the entered sequence is displayed in the 'answer' variable on the screen.

If the player remembers correctly then they see the WIN screen, if not, the big fat LOSE screen awaits them!

I really liked the simplicity and ease of use of my Tumblr, but when it comes to more complicated posts with multiple images etc it could be a bit fiddly. So I've decided to move over to Blogger for project descriptions. I might transfer over and update some of my older posts if I can find the time....