samedi 6 avril 2013

Discovering the Raspberry Pi / Gertboard - Part B


A first example with the Gertboard

>>>>>>>  D'autres articles disponibles sur http://www.boichat.ch

The Gertboard revision I have used is marked 21 Oct 2012.

The related Gertboard User Manual document version 2.0 (Gertboard_UM_with_python.pdf) describing the hardware can be found in
http://raspi.tv/downloads

Playing with the Gertboard leds


The Gertboard fits directly onto the GPIO pins of the Raspberry Pi via a double row of pins socket on the back of the Gertboard.



We can see some leds active on the top.
The straps (the coloured wires) and jumpers as explained in this nice tutorial here:

http://www.tech-fruits.com/all-tutorials/the-gertboard-lesson-2-testing-the-buffered-io-section/

where we can find everything about the hardware and the software. This is not my intention to repeat here this information.

The wiring diagram for the LED test program is also described in the Gertboard User Manual at page 21.



To download the Gertboard C software, we can go for instance to the Web site http://www.element14.com.

I have downloaded the file gertboard_sw.zip into my Raspberry working directory and to install and compile the software:

unzip gertboard_sw_20120725.zip
cd gertboard_sw
make all

and to execute the program:

sudo ./leds



We could have a look at the leds.c source code to see how patterns are used for the leds and maybe understand what happens if we do not have enough wiring cables between the "GP" and "B" pins.



vendredi 5 avril 2013

WiringPi for the Raspberry Pi


Using WiringPi for verifying our relay

The small complete project described in

A STARTING POINT WITH RASPBERRY PI

could use the WiringPi package for testing the relay.

The WiringPi is a library part of the Gordons projects described in https://projects.drogon.net/raspberry-pi/wiringpi/

The installation

In case our Raspberry Pi software is not up-to-date, it's better to do:

sudo apt-get update
sudo apt-get upgrade

The git sotfware is a revision control and source code management which may need tp be installed on the Raspberry: 

sudo apt-get install git-core

The Drogon projects has a repository for WiringPi which can be downloaded and installed:

git clone git://git.drogon.net/wiringPi

Then, when done, we can see that the directory /home/pi/wiringPi has been created
and we should built it:

cd wiringPi
./build

The WiringPi is coming with a C/C++ library and some examples. The gpio utility is also provided in order to run GPIO command directly from a terminal.

Testing our relay

As explained in http://jbbraspberrypi.blogspot.ch/2013/03/discovering-raspberry-pi.html the relay is connected on the GPIO 14 and the gpio following command can be used to deactivate or activate the relay:


gpio -g mode 14 out
gpio -g write 14 0
gpio -g write 14 1

The parameter -g indicates that the pin numbers are interpreted as BCM_GPIO pin numbers rather than standard pin numbers.