RAIBOX-ORNX Industrial Input Output Interface Tutorial
WHAT YOU WILL LEARN?
1- The pinout of I/O connector
2- Setting and Reading Input Pin
3- Setting Digital Output as High and Low
ENVIRONMENT
Hardware: RAIBOX-ORNX
In this blog post, we will test the IIO (Industrial Input-Output) interface of RAIBOX-ORNX.
The Pinout of I/O Connector
First, let's look over the 12 pin IO connector. On the connector, there are 4 ground, 4 digital input and 4 digital output pins.
Setting and Reading Input Pin
Digital input side accepts signals between 12-24V (rated for 2.25mA). In our application, we used Heschen M12 Inductive Proximity Sensor (PNP & Normally Open(NO)) with 24V voltage source.
![](https://ucarecdn.com/5acc96cc-58cd-490b-9a73-2f8588f82729/-/format/auto/-/preview/1024x1024/-/quality/lighter/image_2023-07-19_102927047.png)
Find sysfs equivalent of the connected output pin from the table below. For this setup, it is DIGITAL_IN0. After proper hardware connection with industrial LED, we can continue with the software side.
![](https://ucarecdn.com/f56a0e81-4662-417a-8c8a-2c95a185a940/-/format/auto/-/preview/1024x1024/-/quality/lighter/Screenshot%20from%202023-07-19%2015-06-19.png)
Set DIGITAL_IN0 as input and read sensor value. To do this, you should use the commands below.
sudo sh -c "echo 399 > /sys/class/gpio/export"
sudo sh -c "echo in > /sys/class/gpio/PI.00/direction"
sudo sh -c "cat /sys/class/gpio/PI.00/value"
Setting Digital Output as High and Low
Digital output side can drive loads up to 24V and has a current limit of 1A. They work as low side switches, open-close between them and GND. So, you should have a circuitry as in the schematic below. In our application, we used GASHER 24V Indicator Light with 24V voltage source.
![](https://ucarecdn.com/bc04051b-2942-4172-99ab-97919ed5aa0a/-/format/auto/-/preview/1024x1024/-/quality/lighter/image_2023-07-19_103349003.png)
Find sysfs equivalent of the connected output pin from the table below. For this setup, it is DIGITAL_OUT0. After proper hardware connection with industrial LED, we can continue with the software side.
![](https://ucarecdn.com/bf285eda-4365-43fa-9d58-51b30ab2d1ff/-/format/auto/-/preview/1024x1024/-/quality/lighter/Screenshot%20from%202023-07-19%2015-06-23.png)
Then, set DIGITAL_OUT0 as output and control light state. To do this, you should use the commands below.
sudo sh -c "echo 352 > /sys/class/gpio/export"
sudo sh -c "echo out > /sys/class/gpio/PA.04/direction"
To short output:
sudo sh -c "echo 1 > /sys/class/gpio/PA.04/value"
To open output:
sudo sh -c "echo 0 > /sys/class/gpio/PA.04/value"
Thank you for reading our blog post.