Skip to content

Digital inputs

The Pigeon RB700 computer has 8 opto-isolated digital inputs and 4 dry contact inputs.

Digital optoisolated inputs

The 8 opto-isolated digital inputs are divided into two sections. See the diagram below.

opto-inputs

Fig. 1. Digital opto-isolated inputs connection

The following table shows the mapping between the opto-isolated inputs and GPIO.

Table 1. Digital opto-isolated inputs

INPUTS GPIOD GPIO SYSFS GPIO SYSFS kernel below 6.6
I1 gpiochip2 8 GPIO586 GPIO496
I2 gpiochip2 9 GPIO587 GPIO497
I3 gpiochip2 10 GPIO588 GPIO498
I4 gpiochip2 11 GPIO589 GPIO499
I5 gpiochip2 12 GPIO590 GPIO500
I6 gpiochip2 13 GPIO591 GPIO501
I7 gpiochip2 14 GPIO592 GPIO502
I8 gpiochip2 15 GPIO593 GPIO503

When the input voltage is between 0V and 5V, the GPIO logic state is high (negative logic). When the input voltage is between 10V and 28V, the GPIO state is low.

Table 2. Digital opto-isolated inputs parameters

PARAMETER VALUE
Quantity of inputs 8
Low-level input voltage 0 ... +5 V DC
High-level input voltage +10 ... +28V DC
Isolation voltage 5 kV RMS
Input resistance >=10kOhm

Dry contact inputs

The following table shows the mapping between the dry contact inputs and GPIO.

Table 3. Dry contact inputs

INPUTS GPIOD GPIO SYSFS GPIO SYSFS kernel below 6.6
ID1 gpiochip0 12 GPIO590 GPIO12
ID2 gpiochip0 13 GPIO591 GPIO13
ID3 gpiochip0 16 GPIO594 GPIO16
ID4 gpiochip0 17 GPIO595 GPIO17

When the input is shorted to GND, the GPIO logic state is high. Otherwise, the GPIO state is low.

dry-contact-inputs

Fig. 2. Dry contact inputs connection

Linux kernel GPIO user space interface

gpiod

Install gpiod tools:

$ apt install gpiod 

Read input I1 state:

$ gpioget gpiochip2 8 

Read input ID1 state:

$ gpioget gpiochip0 12 

GPIO Sysfs Interface for Userspace

Read input I1 state:

$ echo "586" > /sys/class/gpio/export 
$ cat /sys/class/gpio/gpio586/value 
1 
$ echo "586" > /sys/class/gpio/unexport 

Read input ID1 state:

$ echo "590" > /sys/class/gpio/export 
$ cat /sys/class/gpio/gpio590/value 
1 
$ echo "590" > /sys/class/gpio/unexport 

Direct control via the I2C interface

To control the opto-isolated inputs directly via the I2C interface, comment out the following line in the /boot/firmware/config.txt file (or /boot/config.txt in older distributions):

dtoverlay=mcp23017,addr=0x20,gpiopin=23 

Otherwise, you will receive the following message:

Error: Could not set address to 0x20: Device or resource busy. 

Reading input I1:

gpio -x mcp23017:100:0x20 read 108 

To read the next inputs, change the last argument accordingly: I2=109, I3=110, and so on.

Information for Codesys Users

If you want to use binary inputs/outputs in CODESYS, comment out the following line in the /boot/firmware/config.txt file (or /boot/config.txt in older distributions):

dtoverlay=mcp23017,addr=0x20,gpiopin=23