Hello,
I need to connect a light barrier (NPN or PNP) to an Arduino.
I am powering the barrier with 24V.
I need to be able to send the information that an object has been detected to my Arduino.
How can I do this safely?
I'd first try wiring a led, with a 4.7k series resistor between, 24v and NPN. It is not clear from the document if the led will be on or off during a detection but that would be the first thing you would discover with this experiment.
The optocoupler is a good idea so you don't have to share either of the 24v supply power rails with the Arduino.
Is your npn output an open collector output?
In that case you can put the load resistor on the 5V rail (instead of the 12 V rail and read the signal from the grey cable).