Monday, 6 August 2012

Rpi and GPIO testing

In this article I'm showing my progress with the RPi using the GPIO. There are lots of interesting articles where people is doing the same, but you won't get the same feeling that I have until you test it by yourself. This application processor board is extremely delicate and you need the get used to its I/O, typical voltage values (3.3V), maximum current (8-11mA), etc. Few basic things that will help you not to burn the RPi (connect resistors after every LED, etc). My example is quite simple but with academical purposes and I'm sure it will inspire others. I'm using the slice of a pi extension board where you can easily get the connectors for GP0-GP7 outputs and lit some LED's programmatically.

Material (apart from your RPi):

First thing is to correctly identify the GP Inputs/Outputs from the Slice of Pi (GP0 to GP7 pins). Here are my findings and the correct pin numeration:
GPIO     Slice of Pi
Pin 11   GP0
Pin 12   GP1
Pin 13   GP2
Pin 15   GP3
Pin 16   GP4
Pin 18   GP5
Pin 22   GP6
Pin 07   GP7

As you can see, they are not in order, so you need to spend time looking for the right pins. I still need to identify all the other pins but I'll get to it.

The following code is just lighting up 8 LED's using 8 GPIO pins as outputs. Each pin is connected to a 220 ohm resistance plus a red LED and all terminations to GND.

Source code:

Example with two LED's:

Here is the video displaying the results:

Keep playing!.