Monday, 9 February 2015

Raspberry Pi CodeClub Week 4

This week we followed on from our first foray into GPIO with the almost obligatory blinking led project (the hardware equivalent of 'Hello World').

Most of this group were already familiar with the idea from an almost identical task in the DIY Gamer sessions last year and got stuck straight in.

I had a couple of annoying glitches this week. Firstly, a couple of Pis seemed to have problems working with the HDMI input on the Lenova all-in-one screen/PCs. The process is always a bit fiddly. Unless the HDMI lead is connected when the Pi first boots up, it will not be detected as an active input by the screen. So you have to connect the HDMI lead, power up the Pi then quickly hit the 'HDMI' button on the Lenova unit.  I've resisted it so far (to avoid tying the Pis to particular hardware) but I think I need to have to add some of the HMDI settings to the /boot/config.txt.

The first obvious thing to set is


which will allow the display to be connected after the Pi has booted. This will normally result in the PI not knowing the resolution and refresh rate of the monitor and defaulting to what the children call 'big words'. So to find out the  EDID settings of the monitor you can use:

tvservice -d edid.dat

 and then use

edidparser edid.dat

to read the results. Then look up the appropriate HDMI mode and group here. So for example, if the edid data says

HDMI:EDID preferred mode remained as DMT (58) 1680x1050p @ 60 Hz with pixel clock 146 MHz

then you'd add the line


Hopefully I'll have time to test these settings before next week's club. Assuming it works, I'm not sure whether to get the children to update their own config.txt files themselves or whether to just bite the bullet and change each SD card myself. I suspect I'll do the latter.

The second problem was that one Pi's version of ScratchGPIO seemed to get corrupted. Whenever they loaded it they received the error 'Could not read project; file may be damaged: (bad header).

I couldn't fix in during the club but took the offending SD card and just reinstalled Scratch.GPIO and everything was good.

The final glitch was entirely of my own making. When I was checking the worksheets a few weeks ago I spotted an error in the Fritzing diagram (wire going to wrong GPIO pin) and corrected it. However a hardcopy version of the duff version must have sneaked into my folder and been photocopied because some of the children had been using them. This lead to some random rebooting of their Pis or the led just not lighting up.

I couldn't work out what was going on but fortunately my son spotted the problem (he broke to to me gently: "Dad, your worksheets are rubbish").

Luckily I was stopping the club early today so that we could talk about Astro-Pi. Some of them had already heard about this from TV (nice to know that kids still enjoy Newsround). I showed the group the excellent movie narrated by Tim Peake himself which they really enjoyed. Then we talked about what kind of things a Pi could be used for on the ISS. As I'd expect from the bunch, the ideas were certainly imaginative: using dead animals as switches (like we did with the Marshmallows last week) to see how things rotted in zero gravity was probably the most bizarre (and gruesome).  My plan is to talk about a couple of the Astro-Pi board sensors each week. Hopefully we'll be able to get our hands on an actual board soon.

Things to do differently next time?

Double check the worksheets for errors! And then get my sons to check again!

No comments:

Post a Comment