DIY Projects

Orange Pi (Armbian): install the WiringOP library (WiringPi equivalent)

The WiringPi library that allows you to use the Raspberry PI expansion slot (GPIO) has been adapted to Orange Pi. The source code of the library is available on GitHub at this address The version for Orange Pi takes the name WiringOP. Many examples are available in the examples directory and show how to use it with some common expansion boards: PiFace, PiGlow, GertBoard … All you have to do is test it!

Equipment used

For this tutorial, I used an Orange Pi Lite (Wi-Fi version) but the method should apply to all the range (to check for Orange Pi Zero which has a 26-pin connector instead of 40). I installed the Armbian distribution (Desktop version).

Installing the WiringOP library

Log on to the user account where you want to install the library, go to the / home directory for example, and then start recovering sources from GitHub.

git clone -b h3 && cd WiringOP

Then we enter the file, and we start the compilation after giving the appropriate rights.

cd WiringOP
chmod +x ./build
sudo ./build

Knowing the state of the GPIO (and the correspondence with the Raspberry GPIO)

Run the gpio readall command. In return, you will get the status of each pin. For example in column V, a 1 means that the output is active, not let’s see right after. In the table, there is also the correspondence of each pin with the Raspberry GPIO.

Enable, disable an output

Connect a Led to pin 29 (PG7) through a 220Ω resistor, then close the circuit by returning to a GND pin (0V in the table above).

Let’s start by changing the output mode of pin 29.

gpio mode 29 out

Now, if you want to turn on the led

gpio write 29 on

Now look at the status of the pins by making a gpio readall.

In column V of output 29, the spindle is in state 1.

To turn it off, you switch off

gpio write 29 off

Using the WiringOP library in a script

Open a new script named for example then paste the code below. Save it with CTRL+X then Y

gpio mode 29 out  
while true; do  
    gpio write 29 on
    sleep 5
    gpio write 29 off
    sleep 1

This script flashes the LED (one pulse per second) until the script is stopped at the keyboard (CTRL+X).

Make the script executable

chmod +x

And run the


Here you can now use the Orange Pi GPIO in your scripts.

Click to rate this post!
[Total: 0 Average: 0]
Exit mobile version