Author Topic: Gpio digital power output from STM32F405RGT6  (Read 1051 times)

0 Members and 1 Guest are viewing this topic.

Offline stenespenTopic starter

  • Newbie
  • Posts: 4
Gpio digital power output from STM32F405RGT6
« on: April 04, 2021, 07:57:57 pm »
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.
« Last Edit: April 04, 2021, 08:01:32 pm by stenespen »
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14470
  • Country: fr
Re: Gpio digital power output from STM32F405RGT6
« Reply #1 on: April 04, 2021, 08:37:14 pm »
 

Offline stenespenTopic starter

  • Newbie
  • Posts: 4
Re: Gpio digital power output from STM32F405RGT6
« Reply #2 on: April 04, 2021, 09:00:42 pm »
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.

 

Offline drvtech

  • Regular Contributor
  • *
  • Posts: 111
  • Country: gb
Re: Gpio digital power output from STM32F405RGT6
« Reply #3 on: April 08, 2021, 09:38:36 am »
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.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12859
Re: Gpio digital power output from STM32F405RGT6
« Reply #4 on: April 08, 2021, 10:12:02 am »
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.   

 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5907
  • Country: es
Re: Gpio digital power output from STM32F405RGT6
« Reply #5 on: April 08, 2021, 01:18:52 pm »
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).




« Last Edit: April 08, 2021, 02:30:48 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Chalcogenide

  • Regular Contributor
  • *
  • Posts: 156
  • Country: it
Re: Gpio digital power output from STM32F405RGT6
« Reply #6 on: April 08, 2021, 01:31:24 pm »
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.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: Gpio digital power output from STM32F405RGT6
« Reply #7 on: April 08, 2021, 03:01:28 pm »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf