Page 1 of 1

GPIO pin output impedance?

Posted: Tue Sep 08, 2015 9:12 am
by Hove
What's the output impedance of GPIO output pin?

Simple calculation based on my testing suggests 50 ohms.

I'm using the pins to light up 8 LEDs (no more than 2 at a time), and switch mosfets to drive 2 unipolar stepper motors. The LEDs work well, but the mosfet is not turned hard on despite its Vgs << 3.3V - the torque from the motors is very low as a result. So I measured the voltage across the LED and got about 2.2V - enough to power the LED but not to switch the mosfet hard-on. Either the LED is acting as a zener, or the GPIO pin has a 50ohm output impedance or I've got something wrong. There is a 100k pull-down resistor gate to ground to keep the mosfet off when the GPIO has not yet been set up as an output.

Any idea which or other suggestions as to the problem? Circuit driven by 2A 5V phone recharge battery pack

Re: GPIO pin output impedance?

Posted: Tue Sep 08, 2015 11:08 am
by Burngate
Yes, LEDs act like rather poor zeners, so your 2v2 measurement gives little information about the GPIO output impedance.
And anyway, since the GPIO drive circuitry consists of fets the characteristics of which are probably not linear, giving a nominal output impedance wouldn't be particularly useful.

When you say "Vgs << 3.3V" for the mosfet, does that mean its threshold?
If you remove the LEDs (I'm assuming you've got them across the mosfet gate-source) so that there's another volt on the source, it might be better.
If that's not good enough, you'll be looking at a more complicated drive circuit to increase the voltage on the gate.

Re: GPIO pin output impedance?

Posted: Tue Sep 08, 2015 12:22 pm
by Hove
Burngate wrote:Yes, LEDs act like rather poor zeners, so your 2v2 measurement gives little information about the GPIO output impedance.
And anyway, since the GPIO drive circuitry consists of fets the characteristics of which are probably not linear, giving a nominal output impedance wouldn't be particularly useful.

When you say "Vgs << 3.3V" for the mosfet, does that mean its threshold?
Yes, Vgs ~ 2V threshhold. These are designed for digital switching for up to 2A: http://uk.farnell.com/webapp/wcs/stores ... reId=10151
Burngate wrote:If you remove the LEDs (I'm assuming you've got them across the mosfet gate-source) so that there's another volt on the source, it might be better.
If that's not good enough, you'll be looking at a more complicated drive circuit to increase the voltage on the gate.
Yup - LEDs over gate/source, gate attached to GPIO, and gate attached to ground via 100k pull down. Removing the LEDs is my next step, though a bit of a pain as the LEDs are soldered on to my HAT prototype PCB.. A shame though - the aim here is a turtle robot which can be used as a hands on tutorial at the Cotswold Jam to show how a flashing LED can become so much more with very few code changes.

Re: GPIO pin output impedance?

Posted: Tue Sep 08, 2015 4:00 pm
by Burngate
According to this (from the datasheet):
Id-Vds.jpg
Id-Vds.jpg (56.29 KiB) Viewed 2932 times
with Vgs at above 3v, you should be able to sink a couple of amps with only about 0.2v across the fet.
Hove wrote:Yup - LEDs over gate/source, gate attached to GPIO, and gate attached to ground via 100k pull down. Removing the LEDs is my next step, though a bit of a pain as the LEDs are soldered on to my HAT prototype PCB.. A shame though - the aim here is a turtle robot which can be used as a hands on tutorial at the Cotswold Jam to show how a flashing LED can become so much more with very few code changes.
I see your problem.
Would it be possible to put a 1k resistor in series with one of the legs of each LED? Might look less pretty, but would allow the the GPIO (and therefore the gate) to rise to 3v3.

Re: GPIO pin output impedance?

Posted: Tue Sep 08, 2015 4:26 pm
by Hove
Burngate wrote: Would it be possible to put a 1k resistor in series with one of the legs of each LED? Might look less pretty, but would allow the the GPIO (and therefore the gate) to rise to 3v3.
It seems I might have to, though currently the PCB is a work of art, and very tightly packed; there isn't really space for those resistors, and they'll make it very ugly! Thinking cap time!

Re: GPIO pin output impedance?

Posted: Tue Sep 08, 2015 8:13 pm
by jbeale
There's always room for a resistor, if you are willing to use SMT parts! (well, unless you have to dissipate much power in it)

Re: GPIO pin output impedance?

Posted: Wed Sep 09, 2015 8:41 am
by Burngate
Hove wrote:... the PCB is a work of art ...
Show us a piccy then!!!

Re: GPIO pin output impedance?

Posted: Wed Sep 09, 2015 8:50 am
by Hove
Burngate wrote:
Hove wrote:... the PCB is a work of art ...
Show us a piccy then!!!
Obviously my personal opinion only!
DSC00869.jpg
Lego turtle
DSC00869.jpg (49.17 KiB) Viewed 2792 times