I am trying to control a load switch from the GPIO pins of an STM32 which outputs 3.3V. They need to be isolated using the optocoupler shown.

The problem is that the isolated voltage supplied is 24V, but 5V maximum is needed to drive the load switch enable.

Will the voltage divider work the way I am intending to at the output? What is throwing me off is the pullup resistor in parallel. How does this look?

Lower current for little power dissipation is also of interest

My calculations so far:

MCU Sink current =25mA enter image description here

Ic = (3.3V - 1.2V) / 1200ohm = 1.7mA Opto CTR = 50%, Ic = 0.85mA

This is a safety switch, high switching speeds are not necessary.

enter image description here

  • \$\begingroup\$ Use a 19V Zener diode to drop 24V to 5V. \$\endgroup\$
    – Deepak
    Oct 7, 2020 at 16:32
  • 1
    \$\begingroup\$ No, your "5V" will vary widely according to how many outputs are ON. But you can very easily generate a 5V supply from your 24V source. \$\endgroup\$
    – user16324
    Oct 7, 2020 at 17:04

1 Answer 1


IMO you should be using a linear voltage regulator, not a Zener and especially not a resistor divider. Both those options waste power, which you said you didn't want to do. The resistor divider won't be stable and that 5 V will change depending on how many loads are switched on/off.

A 5 V regulator can be had for pennies. You need make sure:

  1. It can handle the power i.e. 2 mA * 19 V * 5 = less than 1/4 W (verify this, your numbers are a bit confusing to me) Not sure what you have connected to the 5 V line. If it's just those 10K pull-ups, then the power required goes to "almost nothing". If you need the CPU powered (25 mA?), you'll need a little beefier regulator as the power goes to about 3/4 W.
  2. It can handle the 24 V input voltage.

Digikey has hundreds of regulators in stock that meet these criteria, such as these.

The best thing is actually a buck regulator, as it'd be most efficient, but it's usually a bit more complex thing to deal with. Linear regulators are easy. I'd start with the linear, and consider a buck if you find you can't tolerate the power loss.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.