# Voltage regulator frequency range

I'm designing a new encoder pulses counter for my project, my encoder HE50B uses a 12-24 VDC Input, and it has 1,000 pulses per each revolution. also the maximum permissible speed is 5,000 RPM.

Now I want to count the output pulses of this encoder by my micro-controller ATMEGA-32 which has 5 VDC input ports, so I have to buck the output voltage of the encoder to reach this value.

My question is: which is better to do that (taking in consideration the output frequency of the encoder)?

1. using a 2-stage inverting op-amp to buck the voltage from 12VDC to 5VDC or
2. use a regular voltage regulator such as 7805 and it will work fine with that high frequency switching.

Neither. You should use a potential divider: simulate this circuit – Schematic created using CircuitLab

edit: Just to add, this will give a 0-4V wave at 24Vin, and a 0-2V wave at 12Vin. This is still fine, because the Atmega32 (supplied at 5V) will see anything above 2V as a "1".

• Also known as a "voltage divider". +1. Jun 20, 2018 at 11:33
• Plus, please provide the entire model number. Jun 20, 2018 at 11:36
• With a 50k/10k divider the peak output signal will be 4V. Make R1 smaller if you really want a 5V output signal. Jun 20, 2018 at 11:36
• Thank you BeB00 for your quick response. Great & easy answer. @ElliotAlderson yes I will consider that in my design, I will use this equation Vout = Vin * [ R2 / ( R1 + R2 ) ] Jun 20, 2018 at 11:43
• @AhmedM.Zahran - The data sheet says that you can use any voltage from 12 to 24 volts. If you use 12 volts, the voltage divider should be R1 = 14k, R2 = 10k. Also note, just to be accurate, the resistor values shown in the schematic will give a 0 to 4 volt signal, not 0 to 5. Jun 20, 2018 at 18:06