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.

Figure 2: PiScope in use. Reading the continuously changing states of pins 0 to 15.

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.

The Author

Martin Mohr has experienced the complete development of modern computer technology. After finishing university, he mainly developed Java applications. The Raspberry Pi woke his old passion for electronics.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Julia on the Pi

    Create GUIs and a web app that connects to sensors.

  • RFID over SPI

    Inexpensive components for the SPI interface let you upgrade a Raspberry Pi 4 to a display system for zero-contact RFID-based data acquisition.

  • Whiptail

    Whiptail interfaces add menus and information pages to your Raspberry Pi projects.

  • Kitchen Timer

    A simple kitchen helper with two timers assists budding chefs in coping with dishes that are unlikely to be ready at the same time.

  • ARM64 Assembly and GPIO

    Reading, writing, and arithmetic with the Raspberry Pi in ARM64 assembly language.

comments powered by Disqus
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.

Learn More

News