2022-03-06 06:20 PM
My current design has +5V connected to an optocoupler output pin, the other optocoupler pin is connected to ground through a 25k resistor. (External pull down) The connection point between the optocoupler and the resistor is connected to the MCU pin which is configured as a floating input.
Can I replace this with the following circuit?
MCU pin connected to optocoupler pin. The other optocoupler pin connected directly to ground. The MCU pin configured as input with internal pull up.
Solved! Go to Solution.
2022-03-07 12:11 AM
Presumably because the STM8 do not offer an internal pull-down, but only an internal pull-up, you want to control the MCU pin against GND instead of 5V, right?
In principle you can do that, but you should consider two things:
Does it answer your question?
Regards
/Peter
2022-03-07 12:11 AM
Presumably because the STM8 do not offer an internal pull-down, but only an internal pull-up, you want to control the MCU pin against GND instead of 5V, right?
In principle you can do that, but you should consider two things:
Does it answer your question?
Regards
/Peter
2022-03-07 02:28 AM
Hi Peter
Thanks for your reply
It makes no difference to me if the signal is pulled to GND or 5V. The datasheet of my optocoupler doesn't state the emitter-collector leak current, but from other parts this is typically 100nA, so an 80k internal pull up should be no problem. (The leak current wouldn't drop the voltage at all due to current through the PU)
Do you agree?
The other concern people mention about doing this is that a high value interla PU will make the coupler switch slower. This is also no concern in this case, as the incoming signal is just a 10 Hz PWM.
2022-03-07 02:34 AM
I agree completely. 10Hz is indeed quite comfortable and if the leakage current is below the level you mentioned, you can use this configuration without any problems.
Good luck!
If the problem is resolved, please mark this topic as answered by selecting Select as best. This will help other users find that answer faster.
/Peter