it depends what type of output your sensor has. Basically there are PNP (sourcing) and NPN (sinking) outputs.
- PNP (sourcing) typically outputs supply voltage of the sensor when the sensor is in ON state otherwise it is unconnected (high impedance).
- NPN (sinking) shorts the output against GND when the sensor is ON, otherwise it is unconnected (high impedance).
For example digital outputs on our units are NPN.
If your sensor has PNP output and its supply voltage doesn't exceed 24V, you can typically connect it directly to the UniPi's digital input.
If your sensor has NPN output, that's where it gets a little bit tricky. Digital inputs can only distinguish the ON state (voltage 5-24V). Any other state - be that 0V, short to the ground or high impedance (nothing connected) will result in OFF state. In order to use NPN sensor, you need to define the OFF state by connecting the NPN output to supply voltage via pull-up resistor. And there are two ways how to do it, depending on the supply voltage of the sensor
The pull up resistor will bring the OUT to the level of the supply voltage. In the first example it is 24V, in the second example it is 12V. The GND of the UniPi and the GND of the second power supply may or may not be connected, depending on the level of isolation you need between UniPi and the sensor. But that's another story. But the DIGND has to be connected in both cases.