Gpio digital power output from STM32F405RGT6 - Page 1
Forum section: electronics / general

author: stenespen
author_rank: Newbie
timestamp: April 04, 2021, 07:57:57 pm
content: I am designing my first board using KiCad, I plan to use JLCpcb and have come up with the following solution for isolated digital outputs using only basic parts(See attached picture.).GPIO_Output0 is connected directly to the STM32.Does this look ok?If this is the wrong section for this question, just tell me and Ill remove the post.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 04, 2021, 08:37:14 pm
content: Quote from: stenespen on April 04, 2021, 07:57:57 pmNot really.

author: stenespen
author_rank: Newbie
timestamp: April 04, 2021, 09:00:42 pm
content: Ok, can you point me in which direction the problem is?It seems to work fine in LTspice.The only difference is that I`m using AO3416/PC817A there, since I cant find the right parts in LTspice.

author: drvtech
author_rank: Regular Contributor
timestamp: April 08, 2021, 09:38:36 am
content: Look at the 2n7002. You have configured it as a "source follower". This is the FET equivalent of an emitter follower. Google it.You need a common source circuit for this. In other words, put the FET source to ground, then the anode of the opto to 3v3 with the 100 ohm resistor between the cathode and the FET drain. This way the gate to source voltage (which is what matters for turning on a MOSFET) will be clearly defined.

author: Ian.M
author_rank: Super Contributor
timestamp: April 08, 2021, 10:12:02 am
content: Blue LEDs typically have a Vf or 3V or higher. Driving them from 3.3V logic is often marginal. I strongly recommend putting the output status LED on the output side of the isolation, with one additional power LED for all the outputs to indicate the isolated output supply is present.If you use a sensitive enough (high enough CTRR) optocoupler, you can directly drive its LED (+ appropriate series resistor) from the MCU I/O pin.

author: DavidAlfa
author_rank: Super Contributor
timestamp: April 08, 2021, 01:18:52 pm
content: You're using it like a NPN follower, the mosfets work with voltage, not current.All the voltage will drop in the led and resistor, and the mosfet will barely turn on if it does at all.This is the way :If you're keeping the LED, I'd put it to be driven by the mosfet too.ELS817 has VF = 1.2 , you can drive it directly with the digital pin.5mA is enough for CTR=1:It's just for low frequency signals, right? Datasheet shows 4/3uS rising/falling time, and up to 18uS.You can save power by rising R1 value, ex. 1K, it will have slower response / higher rising time, but for something simple like powering a relay and such, it's perfectly OK.(I put 3.3V, but whatever it uses).

author: Chalcogenide
author_rank: Regular Contributor
timestamp: April 08, 2021, 01:31:24 pm
content: Also beware that the AO3400A is only rated to a maximum of 12 V of Vgs, and with your circuit it could easily get to more than 20 V. You will need either a voltage divider or a zener to clamp it.

author: mikerj
author_rank: Super Contributor
timestamp: April 08, 2021, 03:01:28 pm
content: Even with the optoisolator LED in the drain rather than the source, the 2N7002 doesn't have a lot of margin in this circuit. Vgs(th) is up 2.5v measured at a drain current of 250uA.