How to read a signal from an 24v speed sensor (two of them are available)

Hello people, I would like to connect the sensor cable (see picture) to the Arduino and read out the signal. However, the signal is 24 V, which is of course too much for the Arduino. Would a voltage divider make sense in this case?
And what is the best way to read the signal? Are there special code or libraries that are recommended for this? (this is a PWM signal)

The safest approach is to use an optoisolator between the sensor output and the Arduino input.

1 Like

I have seen similar units and the output is an open collector from an NPN transistor or contact. Try connecting it with a pull up to 5V and measure the voltage. This would be the simplest solution. For an optoisolator you will need power on both the diode side (from the encoder) and the output side to the Arduino. These could be simple resistors on the input and an Arduino internal pull up for the isolator output.

Thank you i did it, but i still need the Arduino code for it! Do you perhaps also have a suitable code that could be used to read the speed value?

Not anymore but the code also needs to support the clock rate you will be seeing. This has a big impact on how the code is written.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.