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)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.