Sunday, July 08, 2012

Using GPIO pins on Raspberry Pi

The small size of the RasPi means that it lends itself very well to home automation projects. As my first step in understanding how hardware interfaces with the computer, I decided to follow the examples given at

I got myself a nice starter kit from The kit contains a plastic case for the RasPi along with a breadboard. The kit also contained connecting wires, 2 switches, a few LED lights and resistors.

My first crack at using the GPIO pins on the Raspi was with implementing tuxx crossing. As soon as I set up the first LED, I realised I could recycle some of the components from Siddharth's broken toys. There was a sword which we bought for haloween about 2 years ago. It had a speaker built in which made the sound of clashing swords as the press of a button. In the last play fight Siddharth had with the sword, the plastic blade had snapped and the sword had lost all interest for Siddharth. The speakers I extracted from the sword turned out to be suitable for use with the RasPi.

The project consists of an executable which can set/unset a pin or also read from it. This was used in conjunction with a shell script to write a Traffic Crossing system.

Here is the system in action.

The speakers are a nice touch and the entire system now mimics a Pelican Crossing quiet accurately.