cancel
Showing results for 
Search instead for 
Did you mean: 

Can an optocoupler be connected between MCU pin and ground without resistor?

lyoy
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

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:

  • the significantly higher value of the pull-up (min 30k, typ 55k, max 80k).
  • the reversed logic (active low instead of active high)

Does it answer your question?

Regards

/Peter

In order 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

3 REPLIES 3
Peter BENSCH
ST Employee

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:

  • the significantly higher value of the pull-up (min 30k, typ 55k, max 80k).
  • the reversed logic (active low instead of active high)

Does it answer your question?

Regards

/Peter

In order 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.
lyoy
Associate III

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.

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

In order 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.