written at 12:00 by faberman
GPI automation

A client wanted to build a push button board connected to a rpi to trigger scripts in order to automate scene recall, audio routing and quick switching of setups. This is accomplished by this small daemon that listens to GPI changes and runs scripts depending on the type of the event.

USAGE

$ gpiod <gpi> [<gpi> ..]

e.g.

$ gpiod 4 17 22 10 9 11

If you want to have to use a GPI, create one or more scripts in /var/lib/gpiod/scripts with the following name(s):

  • <GPI>.sh for raising or falling edge (any change triggers the script)
  • <GPI>_up.sh for raising edge
  • <GPI>_down.sh for falling edge
The scripts will be invoked with two parameters, 1. the GPI id and 2. the new level (0 or 1).

SETUP

As usual, the GPIOs have to be configured in the system in order to use them. You can do this yourself (by writing the necessery values to /sys/class/gpio/...) or use the scripts provided in the archive:

  1. edit gpiod.conf so the list of GPIs and GPOs reflect your hardware setup
  2. run create_gpios.sh and run_gpiod.sh at startup (in that order!)

SOURCE

gpiod_v1.tgz 2013-09-04