Access the Raspberry Pi's GPIO
PiScope
Among the many possibilities offered by pigs
, nothing maps the wiringPi gpio -readall
function – and for good reason: To read the status of the GPIOs, Pigpio uses the PiScope tool (a Raspberry Pi-based oscilloscope), which is a GTK+3 application that runs on all operating systems. It connects directly to the Pigpio daemon and fetches the GPIO data, even if other programs are already connected to the daemon. In this way, you can conveniently debug projects that use the GPIO.
Figure 2 gives you an impression of how the tool comes up. The output shown here was generated by a program that switches GPIOs 0 to 15 on and off one after another. So I could access GPIOs 0 and 1, as well, I started the Pigpio daemon with the masking parameter -x 0xFFFFFF
.
I go into two of the several ways to install and use PiScope in detail. The most obvious variant is to install the tool directly on the Raspberry Pi and run the output through the Raspberry Pi:
$ wget abyz.me.uk/rpi/pigpio/piscope.tar $ tar xvf piscope.tar $ cd PISCOPE/ $ make hf $ make install $ ./piscope
This approach downloads the sources directly to the Pi and compiles them on the spot. PiScope then connects to the Pigpio daemon over the localhost interface. Depending on which basic installation of Raspberry Pi OS you use, you might need to resolve some dependencies.
The second variant is a bit more tricky. You need to download the binary version of PiScope to a Linux machine and connect to the daemon on the Raspberry Pi over the network. In this case, PiScope takes the IP address of the Raspberry Pi from the PIGPIO_ADDR
environment variable, which you will need to set up accordingly:
$ wget https://abyz.me.uk/rpi/pigpio/piscope.tar $ tar -xvf piscope.tar $ cd PISCOPE/ $ export PIGPIO_ADDR=<raspberrypi.local> $ ./piscope.x86_64
In the test, I was able to run PiScope on Ubuntu in this way without any problems. If you are interested in the other installation variants, you will find more details on the tool's website [5].
Conclusions
The Pigpio library is without a doubt useful as a powerful alternative to wiringPi. All common programming languages have wrappers and modules. The available tools let you work smoothly, and the daemon even supports monitoring the GPIO over the network.
You will quickly get used to the different naming convention for the individual GPIO pins, compared with wiringPi, when working with Pigpio. However, one small thing stood out: For more than a year, the project has been dormant on GitHub. I hope this is simply because no changes have been necessary since then.
Infos
- wiringPi project suspension: https://web.archive.org/web/20190823214617/http://wiringpi.com/wiringpi-deprecated/
- Pigpio: https://abyz.me.uk/rpi/pigpio/
- pigpiod parameters: https://abyz.me.uk/rpi/pigpio/pigpiod.html
- Pigs parameters: https://abyz.me.uk/rpi/pigpio/pigs.html
- PiScope installation options: https://abyz.me.uk/rpi/pigpio/piscope.html
« Previous 1 2
Buy this article as PDF
(incl. VAT)