Orange Pi GPIO. Digital input/output for most Pi computers
Control I/O for Digital Pins
There are two nodes, one for output and one for input. These are Node-RED nodes that interface GPIO pins on Orange Pi boards as well as on other Pi's.
These nodes are using the great onoff library, which includes the pins via the sysfs filesytem. Therefore, it should work on all platforms that support sysfs. Your system should have the path /sys/class/gpio/ and this directory should be populated. Watch for additional entries if node-red start flows using GPIO.
Run node-red from console and watch for error messages. In order to use GPIO also as a standard user without root rights, some conditions have to be fulfilled.
- The user group
gpiomust exist and the user must belong to this group.
- The kernel must map gpio access to the user space, but this is not necessarily always the default behaviour.
To meet these requirements for user
pi, run this commands as root:
Check if user
pi belongs to
$ groups pi
Otherwise, run this:
$ addgroup gpio $ usermod -a -G gpio pi
pi is not allowed to use GPIO now, additional steps are required:
Create a new file:
$ touch /etc/udev/rules.d/99-com.rules
copy this text to the file:
KERNEL=="gpio*", RUN="/bin/sh -c 'chgrp -R gpio /sys/%p /sys/class/gpio && chmod -R g+w /sys/%p /sys/class/gpio'"
and do a reboot.
This is tested on Orange Pi PC, Banana Pi M1, Banana Pi M2+ under Armbian. Compared to the solution, which is provided for Raspberry Pi, this way is much more efficient. The whole code runs direct in Node.js and uses kernel live support. But Raspberry Pi I/O nodes create for each pin an own shell and run a not so lightweighted Python process in it... If you have a new set of gpio pins tested at another Pi, feel free to send me a file with pin-number, pin and IO-port name which I can include to the setup.
0.0.5 Added Orange Pi Zero Plus 2 (h5). Changed to the latest onoff library.
Wrong pin numbering corrected. Added pins to NanoPi Neo/Air. Section "other" now defaults to PA0 after initial selection.
Added some Pi's, changed interrupt initialisation and warning. If you upgrade your flows from 0.0.2, you should delete GPIO nodes and then add again.
0.0.2 First release