GPIO Can Only Source/Sink 300uA. Best method for turning on LED?

Discussion in 'General Electronics Chat' started by Mahonroy, Sep 6, 2018.

  1. Mahonroy

    Thread Starter Member

    Oct 21, 2014
    262
    8
    Hello, I have a microcontroller that can only source/sink 300uA. What is the best method for driving a 20mA LED, or even a 150mA relay? A typical setup is to use a 2N3904 transistor to drive the LED or relay... but this typically needs around 5mA to activate the gate right?
     
  2. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    8,836
    2,072
    A 2N3904 should drive a 20mA load easily. Base current ought to be less than 300uA. But do you need as much as 20mA? Modern indicator LEDs give a useful light output at just a few mA. A logic-level MOSFET could drive a relay or LED.
     
  3. MaxHeadRoom

    Expert

    Jul 18, 2013
    16,383
    4,818
    2n7000 logic level fet.
    Max.
     
    -live wire- likes this.
  4. WBahn

    Moderator

    Mar 31, 2012
    23,160
    6,974
    Since a 2N3904 transistor is a BJT, it doesn't have a gate.

    When used as a switch, you typically want a base current that is about 10% of the collector current, so that might not work too well for you unless you take some care. But you could use a Darlington configuration and now you are in the ballpark.

    A better option would probably br to use a logic-level MOSFET.
     
  5. dl324

    AAC Fanatic!

    Mar 30, 2015
    7,434
    1,759
    +1 for logic level MOSFET.
     
    -live wire- likes this.
  6. BR-549

    AAC Fanatic!

    Sep 22, 2013
    4,124
    1,090
    I do not believe you. What microprocessor can only sink/source 300 uA?
     
  7. Mahonroy

    Thread Starter Member

    Oct 21, 2014
    262
    8
    BR-549 likes this.
  8. ebp

    Well-Known Member

    Feb 8, 2018
    2,221
    775
    Arrrgh! Edited about 3 time to try to fix errors - I think its finally right(ish)

    "... am I reading that correctly?"


    No. What is being specified is the gate to source voltage at which the drain (to source) current is 250 µA - that is, the FET is just beginning to be turned on. Note that this "gate threshold voltage" can vary between 1.9 and 2.6 volts from one device to another. Threshold voltage is usually spec'd at somewhere in the range of 250 uA to 1 mA, even for high current FETs.

    To get higher drain current you must have higher gate to source voltage. The parameter of interest is transconductance, which is the ratio of change of drain current to change in gate voltage and is expressed in Siemens (used to be called "mho", which is "ohm" spelled backwards because it is the inverse function of resistance in ohms). The transconductance for that FET is 530 mS, typical. It is annoying they don't specify a minimum so you can design with certainty. [EDIT - mS means milliSiemens, not milliseconds, which is abbreviated ms]

    Say you wanted to drive the LED at 20 mA. The transconductance is 530 milliamps per volt, so you would need 20/530 = 0.038 V above the threshold voltage. To be conservative, use the 2.6 V threshold voltage and perhaps take the transconductance as half the "typical" value, so we need 2.6 + 0.076 = about 2.7 volts. If you are running your processor at at least 3 volts, it should work well. Figures 1 and 2 of the datasheet show the curves, but as usual, they're rather hard to read accurately for low current. They are also "typical" values, which is almost always the case for performance curves.

    If you look around on the web you can find some good ap notes from ON Semi and others on introduction to power MOSFETs.
    e.g. https://www.fairchildsemi.com/application-notes/AN/AN-558.pdf

    If you need to drive several LEDs, you might consider using a CMOS inverter or non-inverting buffer. Families like the AC series (e.g for part 74AC04) can source or sink plenty of current for driving indicator LEDs. You can get 2 devices in a small package or 6 in a 14 pin package.
     
    Last edited: Sep 6, 2018
    Reloadron likes this.
  9. ebp

    Well-Known Member

    Feb 8, 2018
    2,221
    775
    If I try to edit the above again, I'll probably break it again:

    Left out an important thing:
    The current into or out of the gate is nominally zero because the gate is electrically insulated from the rest of the FET. The line from the datasheet of interest here is
    Gate−to−Source Leakage Current [abbreviated:] IGSS [measured at:] VDS = 0 V, VGS = ±30 V [value:] 200 nA [max]
    and note the whole table is at 25 °C. Leakage current will approximately double for each 10 °C increase in temperature from the test condition, so at 45 °C you would expect it to be about 0.8 µA - but this is a maximum spec and real leakage is likely very much less.
     
    Reloadron likes this.
  10. BR-549

    AAC Fanatic!

    Sep 22, 2013
    4,124
    1,090
    Check sheet. You can get 5 ma on high drive.
     
  11. ebeowulf17

    Distinguished Member

    Aug 12, 2014
    2,559
    474
    I may be reading this wrong, but your questions imply that you're expecting a MOSFET gate to draw current in much the same way that a BJT base does. In fact, they're quite different.

    A MOSFET gate behaves more or less like a capacitor. It takes some current for a (usually brief) period of time to charge or discharge the gate when transitioning between "on" and "off" states, but the current draw while maintaining either state is incredibly low (an ideal MOSFET would draw zero current while maintaining state, but in the real world there are leakage paths.)

    What this means is that, in many situations, you can basically think of the MOSFET as requiring zero gate current. Larger MOSFETs tend to have higher gate capacitance, which translates into higher gate current and/or slower transition times. If you're dealing with small, low power devices, and you're not switching at high speeds (high kHz to MHz range) you have nothing to worry about. If you're driving larger MOSFETs or higher speeds, then the instantaneous currents required become significant.

    You may want a gate resistor to limit inrush current to the MOSFET gate to some reasonable level, but rest assured that whatever peak current level you limit it to will only exist briefly before it settles to near-zero.

    Hope I didn't butcher those explanations too badly.
     
  12. ebeowulf17

    Distinguished Member

    Aug 12, 2014
    2,559
    474
    Oops, l was typing slowly and didn't realize ebp covered my points above succinctly in his follow up post.
     
  13. Xavier Pacheco Paulino

    Active Member

    Oct 21, 2015
    624
    64
    As @BR-549 said, you can get 5 mA on high drive. That is, maximum 3 pins at 5mA. However, if you have only one pin sinking/sourcing, you can go up to 15mA on that single pin. Anyways, that's not a big worry as for the purpose of your application.

    [​IMG]
     
Loading...