Humbly Report: Sean Bechhofer

Semantics 'n' stuff

Archive for November 2012

Life of Pi

with 5 comments

The piPlayer

I’m sure that almost anyone who reads this blog will be aware of the Raspberry Pi, the credit-card sized ARM GNU/Linux box that aims to get kids interested in coding. I’m one of those middle aged geeks to whom the Pi has a particular appeal, but I’d still like to share my early experiences.

I’m an academic in a Computer Science Department and have been writing code for over thirty years — I’m of the generation who cut their coding teeth on the BBC micro in the ’80s (the comparison between the Pi and the BBC as a vehicle for enthusing the next generation resonates). So for me, the fact that this is a Linux box I can write code for isn’t that exciting. What has been fun is the opportunity and ease of connecting up low level peripherals. That’s flashing lights and buttons to you and me.

Despite my background and career, I’ve never really dabbled in low level electronics, and my soldering just about stretches to the odd bit of guitar maintenance, or even construction. And sure, I could do low level stuff with my MacBook with the appropriate connections and some kind of USB magic (couldn’t I?), but the instant appeal of those little GPIO pins sticking out of the board is strong. Plus the fact that if, or more likely when, I fry the board with my incompetent electronic skillz, it’ll cost me not much more than a pizza and a bottle of wine in a restaurant.

Luckily for me, some of my colleagues have developed the Pi-face, an interface that plugs on to the Pi and provides easy access to a number of inputs and outputs. It even has four switches and eight LEDS built in. Along with the supporting python libraries, it was a breeze to get going and I had flashing lights in no time. Woo-hoo! The Pi-face was nice as it allowed me to do a little bit of playing around without worrying too much about Pi-fry. After all, if I can choose to spend the money on pizza or pi then mine’s a Fiorentina and a glass of nice red please.

From there on it’s been a slippery slope. I got myself a breadboard and an assortment of LEDs. More flashing lights! I discovered a wealth of ebay shops that will sell all manner of components at cheap-as-chips prices. I’ve been spending increasing amounts of time in the garage surrounded by bits of wire and blobs of solder. Of course I have more disposable income than your average 10 year old, but when you can pick up an LCD screen for a couple of quid we’re still very much in pocket-money territory. Hooking up the LCD was a blast and meant I could actually begin to build useful projects. First of these was the piPlayer, a streaming radio. My next project (train times monitoring — coming soon) needed more than 8 outputs*, so once I was confident with the Pi-face, I started experimenting with direct use of the GPIO pins, using the Adafruit cobbler to break the pins out. “Break the pins out” — see, I’m even using the language now! And my soldering’s getting better.

There have been some other interesting learning experiences. When I wanted to use a π character in my piPlayer display I found myself downloading the HD44780 datasheet (my reaction two months ago: datasheet, what’s a datasheet?) to find the appropriate hex character to send. It also took me a fair while to realise that the PiFace outputs are pulled low when set to 1. So when I first hooked up my LCD after cannibalising some instructions, I was faced with what appeared to be a screen of Korean characters and obscure punctuation, reminiscent of a bout of swearing from an Asterix character. When I finally realised the problem, flipped the bits in my python code and saw the words  Hello Sean  appear in blue and white letters, I punched the air like a little kid. And that’s the whole point of the Pi.

*Although I understand that the Pi-face v2 will allow the use of the input pins as outputs, giving more than eight.

Advertisements

Written by Sean Bechhofer

November 8, 2012 at 5:23 pm

Posted in raspberry pi

Tagged with