node-red-contrib-opi-gpio 0.0.2

Orange Pi GPIO. Digital input/output for most Pi computers

npm install node-red-contrib-opi-gpio

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.

Background

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.

Additional Setup

To check out, if everything is working correctly, first you should make a short test as user root. In order to use GPIO also as a standard user without root rights, some conditions have to be fulfilled.

  • The user group gpio must 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.

User setup

To meet these requirements for user pi, run this commands as root: Check if user pi belongs to gpio:

$ groups pi

Otherwise, run this:

$ addgroup gpio
$ usermod -a -G gpio pi

If pi is not allowed to use GPIO now, additional steps are required:

Kernel Setup

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'"

then do:

$ service udev restart

or better do a reboot.

Remarks

This is tested on Orange Pi PC. 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...

Node Info

Version: 0.0.2
Updated 2 months, 2 weeks ago

Downloads

9 in the last day
44 in the last week
241 in the last month

Nodes

  • opi_out
  • opi_in

Keywords

  • node-red
  • Orange Pi
  • Banana Pi
  • Nano Pi
  • Raspberry Pi
  • GPIO

Maintainers

  • gprandst