Libgpiod vs pigpiod vs wiringPi

This is a continuation of a discussion at: New pigpio - GPIO wrapper for Raspberry Pi If anyone has more information on libgpiod, then feel free to add it here so that everyone can learn more about this library. :slight_smile:

For those who are new at programming electronics on the Raspberry Pi with Xojo, there are currently two main libraries to work with the GPIO pins on a Raspberry Pi: wiringPi, and pigpiod.

The wiringPi library is deprecated and is not recommended for future work since there are no more public updates to the code. When a new OS, or system is released there is a good chance that the wiringPi will have issues with code. (Older book available at: There is a large amount of code that uses the wiringPi library on the internet.

PIGPIO (also called pigpiod) is the latest compatible library to be ported to Xojo and works well, although the library is harder to configure on a Raspberry Pi since it uses a server-type method of controlling the GPIO pins. The update to PIGPIO also happened when Raspberry Pi created their own OS, appropriately called Raspberry Pi OS. PIGPIO does not like to share processes with other programs, which can be hindering in some applications. There is some code available for PIGPIO on the internet, which is less than wiringPi, and more example code than libgpiod.

The previous discussion at New pigpio - GPIO wrapper for Raspberry Pi with @DerkJ revealed another library, and the purpose of this topic is to find out more about this library :slight_smile:

The libgpiod library is free and can be downloaded from github at:, and is written in C, so a library would need to be created to port it to Xojo. There is a low amount of code available for libgpiod and it might be something positive to examine in the future. Libgpiod is being actively developed and there are lots of frequent updates (as of 16 Dec 2020) that can be viewed here:

I’ll work on a ‘Hello-world’ example with Libgpiod and see how it is to setup.

Edit: Spelling


PIGPIO has 2 libraries. You do not have to use the server one, you can simply connect to the local one.

But its somehow harder than the old wiringp I admit, I been trying to convert some of my examples. (Or my mentality is just to stuck on the old ways).

For me then it also comes down to what will work on other boxes, with Wiring PI I was taking for example things and running them without changing anything on Orange PI boxes (using Orange PI adapted Wiringpi, which I guess was part of what made its author enrage)

1 Like

Libgpiod is the linux native gpio library ntively embedded in the kernel already. No need to download/compile on later pi Os systems
WiringPi is deprecated.
Pigpiod has multiple interfaces but can only be used by 1 application.

I’d go where the Pi foundation is going libgpiod in the kernel. Better support, etc…


If this is where the foundation is moving, then it is a good idea to follow them. After a day of searching I was not able to find APIs. Do you have a link for the Libgpiod API’s so that I can test some declares?

Edit: grammer

you can browse trough the sources. do note that pigpiod has more high level stuff (as wiring pi had).
libgpio is lower level but could practically do everything.

1 Like

One tip:

If you want to see all the methods inside the lib you can use declareLibraryMBS to do so, very useful


I was to understand that since pigpiod is a service multiple applications may make calls to it simultaneously. This is not correct?

only a single application may use the same gpio therefore it’s locked while in use.
perhaps you should read the manual of pigpiod? on their website?

1 Like

Derk is correct that a single application can access the GPIO at one time. This is for increased safety of the Raspberry Pi board. One application can accept and coordinate input/output from the board. Multiple programs accessing the same input/output ports can accidentally overload an input pin and short the chip. :slight_smile:

Edit: Yes, I have made this mistake before :slight_smile:

1 Like

I have good news about the existing pigpio library, as it makes very limited use of sysfs (the deprecated OS calls). Sysfs will be maintained in Linux for the forseeable future and there are no plans to remove it from the Linux kernel. In this sense, deprecation means no new features will be added and the existing code will be maintained.

Most of the calls in the pigpio library for Xojo use pigpio and pigpiod_if2 dynamic libraries. Only the gpioISR function in the pigpio library use the sysfs, which is the part that uses interrupts. Xojo does not recommend interrupts on any machine. There is a discussion about some workarounds in this part of the forums (gpio event at level change).

There is a newer library wrapper that I can create which uses the newer gpiochip interface that @DerkJ mentioned, which will be getting more updates and an increased number of functions.

I would like to know your thoughts and below is a poll and you can vote for one or both.

Would you like the newer pgiochip wrapper or keep the existing pigpio interface for Xojo Raspberry Pi?
  • Keep existing pigpio wrapper (sysfs interrupt deprecation)
  • Create a new libgpio wrapper (new kernel functions)

0 voters

Thanks for voting :slight_smile:

Edit: I made an error, and the poll is open to everyone now.

I just see the message: “You need to be a member of Xojo,Store,staff,Pro,MVP,moderators,admins,Testers to vote in this poll.”

Hmm… Ok… how do I make the poll open to everyone? I clicked on all of the possible categories?

What about deleting all the possible categories?

1 Like

Ok, no groups are added. Let see if this works for everyone to vote.

Would you like the newer pgiochip wrapper or keep the existing pigpio interface for XojoRaspberry Pi?
  • Create a new libgpio wrapper (new kernel functions)
  • Keep existing pigpio wrapper (sysfs interrupt deprecation)

0 voters

1 Like

Thanks Ivan

Thank you @Eugene_Dakin for your generous and likely time consuming efforts on this. :+1:t2:


I created a Blink example with lgpio that exclusively uses the newer c-language functions (libgpiod - gpiochip) for the Raspberry Pi, and is available at the following github link: Eugene’s Github lgpio. This can be downloaded for free.

When I can confirm that all of the functions work (I2C, SPI, etc.) then I’ll write a book.

Edit: Added gpiochip


Hello Eugene,

I’ve read the file.

Is lgpio already installed on the Raspberry Pi OS?

Why are these steps necessary?

  1. sudo apt install swig python-dev python3-dev
  2. sudo apt install python-setuptools python3-setuptools
  3. wget
  4. unzip
  5. cd lg
  6. make
  7. sudo make install

Hi Jeff,

This is a wrapper/library to make the c-language calls easier understand and work with. If this library was not created, then I would need to build one from scratch - which would have similar type of installation instructions to make it Xojo-friendly.

I am used to a single-installer on Windows, and it is typical on Linux for the source code to be compiled on the Linux machine (which are these instructions). Its just a different way of doing the same thing :slight_smile:

I hope this helps.

1 Like

Hi Eugene, I’ve followed the steps and was able to build and run the example Blink executable. I used PIN 17 however.

Will you be changing the I wish I know how to book extensively? Or just a few updated pages?