Raspberry Pi I/O Library

I recently found an interesting measuring project with the Raspberry Pi from Tom Herbison, a HF Network Analyzer, see RaspberryPiWobbulator.

I have looked at the following I/O libraries, with the main focus on Python programming:

Following I will give short references to the above mentioned Libraries, and some hardware references. All information are about the Raspberry Pi model B, revision 2.

RPi.GPIO

Quick2Wire

From this company you can get an universal I/O board and good libraries, see at Links

WiringPi

Wiring is used for the Arduino computer modules, in order to simplify the Input/Output programming. It is also ported to the Raspberry Pi.

Raspberry Pi, hardware

Unfortunately there are 4 different naming systems for the I/O pins, and 2 hardware revisions (Rv1, Rv2). You always struggle which is which.

The I/O port from the Raspberry Pi can be fed via 26 pin flat cable to a half size proto board, price about 6.50 EUR, see Links. This is for me the cheapest I/O extension for doing prototyping.

For the pin naming please see at Links.

Raspberry Pi, software

For the I2C/TWI interface bus you need a driver library, see Links, and must be enabled in Linux. For installation do:

# install documentation tool
$ sudo apt-get install pandoc

$ make check-install

# tools to install
$ sudo apt-get install python-pip
$ sudo apt-get install python-virtualenv

# install GPIO library
$ cd quick2wire-gpio-admin-master
$ make
$ sudo make install
$ man gpio-admin
# logout and login again, to activate the group assignment

# check for function (24(BCM) = 18(pi_header_1) = 5(pins) = DATA on DDS-Generator)
$ gpio-admin export 24
$ cat /sys/devices/virtual/gpio/gpio24/value
0
$ echo out > /sys/devices/virtual/gpio/gpio24/direction
$ echo 1 > /sys/devices/virtual/gpio/gpio24/value
$ cat /sys/devices/virtual/gpio/gpio24/value
1
# shut off pin
$ gpio-admin unexport 24

# install
$ cd quick2wire-python-api-master/
$ sudo adduser $USER i2c
# logout and login again, to activate the group assignment
or reboot later

# install i2cdetect
$ sudo apt-get install i2c-tools

# Enable I2C bus software:
# edit file /etc/modprobe.d/raspi-blacklist.conf
  # Quick2wire software library needs it 2013-12-09 RR
  #blacklist spi-bcm2708
  #blacklist i2c-bcm2708

# edit file /etc/modules
# add line at the end:
  i2c-dev

$ sudo reboot

# check for i2c device descriptor
$ ls /dev/i2*
crw-rw---T 1 root i2c  89, 0 Dez  9 18:14 /dev/i2c-0
crw-rw---T 1 root i2c  89, 1 Dez  9 18:14 /dev/i2c-1

# check for modules
$ lsmod
Module                  Size  Used by
i2c_dev                 5620  0
snd_bcm2835            15846  0
snd_pcm                77560  1 snd_bcm2835
snd_seq                53329  0
snd_timer              19998  2 snd_pcm,snd_seq
snd_seq_device          6438  1 snd_seq
snd                    58447  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
snd_page_alloc          5145  1 snd_pcm
spidev                  5224  0
leds_gpio               2235  0
led_class               3562  1 leds_gpio
spi_bcm2708             4510  0
i2c_bcm2708             3759  0


$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- 05 -- -- -- -- -- -- -- -- -- --
....

# link Quick2Wire-API (i2c) library to Python
# edit /home/pi/.profile
# add
  # for I2C use
  export QUICK2WIRE_API_HOME=/home/pi/Install/quick2wire-python-api-master
  export PYTHONPATH=$PYTHONPATH:$QUICK2WIRE_API_HOME
# logout and login again, to activate the environment

In order to start the program wobbulator.py from the command line the first line must be a shebang line, see also Links:

List of pages in this category:

-- RudolfReuter 2013-12-19 09:29:08


Go back to CategoryRaspberryPi or FrontPage

RaspberryPiIOLibrary (last edited 2013-12-19 09:35:25 by RudolfReuter)