ISO-Digital Output Relay Driver Card Setup
The ISO-DIGOUT card provides 4 x Digital outputs in the form of open collector drivers rated for maximum of 1A per channel as well as 1 x Digital Input (>=5V Input)
This card requires an external PSU from 5-40V DC to operate as this is used as the reference and ground, extra protection diodes have been fitted to each channel to allow relay usage.
The GPIO lines are connected to is as follows :
GPIO25 => DIGOUT4
GPIO26 => DIGOUT3
GPIO27 => DIGOUT2
GPIO37 => DIGOUT1
GPIO38 => DIGIN1
The easiest way to configure this is via the command sequence below as root user :
# gpio export 38 in
# sudo -u pi gpio export 25 out
# sudo -u pi gpio export 26 out
# sudo -u pi gpio export 27 out
# sudo -u pi gpio export 37 out
# ln -s /sys/class/gpio/gpio38/value /dev/diginput0
# ln -s /sys/class/gpio/gpio37/value /dev/digout0
# ln -s /sys/class/gpio/gpio27/value /dev/digout1
# ln -s /sys/class/gpio/gpio26/value /dev/digout2
# ln -s /sys/class/gpio/gpio25/value /dev/digout3
This will create the below shortcuts :
# ls -l /dev/dig*
lrwxrwxrwx 1 root root 28 Mar 10 12:00 /dev/diginput0 -> /sys/class/gpio/gpio38/value
lrwxrwxrwx 1 root root 28 Mar 10 12:00 /dev/digout0 -> /sys/class/gpio/gpio37/value
lrwxrwxrwx 1 root root 28 Mar 10 12:00 /dev/digout1 -> /sys/class/gpio/gpio27/value
lrwxrwxrwx 1 root root 28 Mar 10 12:00 /dev/digout2 -> /sys/class/gpio/gpio26/value
lrwxrwxrwx 1 root root 28 Mar 10 12:00 /dev/digout3 -> /sys/class/gpio/gpio25/value
Read/write of I/O is possible as as a non-root user due to the use of the gpio command (see GPIO blog section for more details)
To change a relay state :
$ echo 1 >/dev/digout0
$ echo 0 >/dev/digout0
To read a digital input state :
$ cat /dev/diginput0
0
$ cat /dev/diginput0
1