2026-03-06 5:02 AM - last edited on 2026-03-06 6:00 AM by Andrew Neil
Split from: Evaluation of Encoder Signal Level Shifting Approach as that was a different issue, and has been solved.
I am also working with this same issue, in my case i have a encoder operating at 24V, and signal in comparable frequency
i have implemented a simple voltage divider, the circuit works just fine, but as i don't have equipment to measure the noise and also i would prefer to have galvanic separation to my MCU, so in this case is there any good suggested level shifter or optocoupler, should i combine the both strategy of voltage divider and optocoupler or just 1 is fine (from perspective of noise and safety)?
Solved! Go to Solution.
2026-03-09 3:00 AM
Hello,
My standpoint: it is recommended to use an optocoupler to protect STM32 microcontroller from high-voltage spikes and ground loops in your case and you need to use a high-speed optocoupler. Example 6N137. (I think it can handle up to 5MHz as input. You need to contact its manufacturer Vishay).
You need to limit the current on the LED side from 24V. Example: if you use 6N137 as an optocoupler, to limit the current on the LED, you need to add a resistor in series Where R = (Vencoder - VF LED) / IF LED .
R = 2,260K. Standard value: 2.2K.
Hope I've answered your question.
2026-03-09 3:00 AM
Hello,
My standpoint: it is recommended to use an optocoupler to protect STM32 microcontroller from high-voltage spikes and ground loops in your case and you need to use a high-speed optocoupler. Example 6N137. (I think it can handle up to 5MHz as input. You need to contact its manufacturer Vishay).
You need to limit the current on the LED side from 24V. Example: if you use 6N137 as an optocoupler, to limit the current on the LED, you need to add a resistor in series Where R = (Vencoder - VF LED) / IF LED .
R = 2,260K. Standard value: 2.2K.
Hope I've answered your question.