Lower the voltage

I'm working in a project and trying to read an encoder. The input voltage for the encoder is 7-24V and most likely I'm going to use 12v.

The problem is the output voltage is the same than the input and 12v is too much for the arduino input.
How can I fix this?

actuator with encoder

thanks

Just use one of these options coupler isolators, they are designed for Arduino and can handle up to 24v

I hope this helps you,

Mike

A simple resistive divider network is all that you need. Three 33K resistors would be fine, all in series between the encoder output and ground. Tap at the top of the resistor connected to ground and you'll have approximately 4 volts out with 12 volts in.

Thank you guys,

I like the idea of the optocouple better. Seems to be more safe than the resistive diviser. Can't find any good diagram. it should be something like this?

wiring diagram

or

PC817

If the encoder has open collector outputs, you may only need pullup resistors to 3.3V, but?
If you do use optos, make sure they can reliably transmit your encoder's highest pulse rate, which is?

What is the maximum speed of this encoder? Standard photo-transistor output opto-couplers aren't
particularly fast so this might be an issue if its a high rate of pulses.

The only information about the encoder on the website is this.

The chip built-in encoder, the signal has been a little wave processed, the accuracy of 400 pulses per second.

A plurality of photoelectric sensors built in, can be output Standard square wave, can be directly connect with microcontroller or PLC board, determine the motor reversing, speed control, stroke position control, synchronous operation paired synchronization and batch funcions.

Red line: DC7v-24v power input, needs a stable and less interference DC power supply
Green line: Pulse output, high level equal to the input voltage, low 0v, the standard square wave.
White line: Pulse output, high level equal to the input voltage, low 0v, the standard square wave.
Black wire: Negative pole of power supply

Hope this helps. unfortunately don't have a background in electronics to give more information.

Thanks