cancel
Showing results for 
Search instead for 
Did you mean: 

Interface to 24V encoder via optocoupler

eva1000
Associate

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)?

1 ACCEPTED SOLUTION

Accepted Solutions
mƎALLEm
ST Employee

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 .

  • Vencoder = 24V
  • VF LED = 1.4V (see a screenshot from the optocoupler datasheet below)
  • IF LED = 10mA (see a screenshot from the optocoupler datasheet below)

screenshot1.png

R = 2,260K. Standard value: 2.2K.

Hope I've answered your question.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
mƎALLEm
ST Employee

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 .

  • Vencoder = 24V
  • VF LED = 1.4V (see a screenshot from the optocoupler datasheet below)
  • IF LED = 10mA (see a screenshot from the optocoupler datasheet below)

screenshot1.png

R = 2,260K. Standard value: 2.2K.

Hope I've answered your question.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.