Transistor needs 4mA to saturate and turn on - my GPIO cannot source more than 0.1mA. What to do?

Discussion in 'General Electronics Chat' started by Mahonroy, Oct 3, 2017.

  1. Mahonroy

    Thread Starter Member

    Oct 21, 2014
    243
    7
    Hey guys,
    So I decided to use an IO-expander IC in a design, and I was not paying attention to the amount the GPIOs can source and sink. This thing can sink 20mA, and for some reason I assumed it could source close to 20mA as well.....turns out it can only source 0.1mA max on a GPIO! Because of this the MMBT3904 transistor cannot activate.

    Datasheet for IO-expander:
    https://www.nxp.com/docs/en/data-sheet/PCF8574_PCF8574A.pdf

    Circuit:
    darlington_question1.jpg

    Would a good solution be to use a darlington transistor instead, such as this one? (MMBTA13 or MMBTA14)
    Datasheet:
    http://www.mouser.com/ds/2/258/MMBTA13-MMBTA14(SOT-23)-349671.pdf

    The old transistor had a gain of 30, while this one has a gain of 10,000, thus only requiring around 0.01 mA instead of 4mA.... if I am understanding this correctly that is. So if it only needs 0.01, then I should be able to drive this directly with my IO-expander IC I am thinking, and don't need to change anything else.

    Is there a better way I should re-design this for the future? Or is the darlington transistor a good way of doing this?

    Thanks and any help or advice is greatly appreciated!
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    13,602
    3,834
    2n7000 'Fetlington'?
    Max.
     
    JWHassler likes this.
  3. crutschow

    Expert

    Mar 14, 2008
    17,033
    4,676
    If the transistor needs 4mA, just add a pull-up resistor between the power rail and the transistor input to provide the 4mA.
    Since the GPIO can sink 20mA it can readily pull the output to logic zero.

    Thus for example, if the power supply is 5V then the resistor value would be (5V-0.7V) / 4mA ≈1kΩ.
     
  4. Mahonroy

    Thread Starter Member

    Oct 21, 2014
    243
    7
    Cool, do you think this would be a better choise than the part number I chose above? Which value in the datasheet indicates how much amps it might take to activate this mosfet?

    Thanks for the advice. I had considered this, but I was worried that the relays would activate before the IO-expander had a chance to pull it down to zero. The default state for the pins are input at power up, so by default the relays would trigger.
     
  5. MaxHeadRoom

    Expert

    Jul 18, 2013
    13,602
    3,834
    Mosfets are not current operated devices, similar to valves, they are voltage operated (trans-conductance) devices.
    Max.
     
  6. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,956
    897
    You could switch the NO and NC contacts on the relay to overcome that.
     
  7. Mahonroy

    Thread Starter Member

    Oct 21, 2014
    243
    7
    Ok. So it looks like this would be a direct swap part for me?, SOT23 package, 2N7002K-7:
    https://www.diodes.com/assets/Datasheets/ds30896.pdf

    And I can just swap the 1K resistor out with a 100 ohm (or a 0 ohm?), and leave the 10K, and should be good to go?
     
    Last edited: Oct 3, 2017
    MaxHeadRoom likes this.
  8. Bordodynov

    Well-Known Member

    May 20, 2015
    1,200
    372
    Use npn 2SD2704K
    2SD2704K.png
     
  9. Mahonroy

    Thread Starter Member

    Oct 21, 2014
    243
    7
    Good call on that thanks!

    Would you mind explaining why this is a good choice? Just for my knowledge
     
  10. Bordodynov

    Well-Known Member

    May 20, 2015
    1,200
    372
    The transistor I proposed is more robust than a field-effect transistor. With a field effect transistor, you must act very carefully (you can say gently). Touching a hand or a soldering iron to the gate of the field-effect transistor, it is easy to break through a thin oxide and the transistor will die.
     
  11. MaxHeadRoom

    Expert

    Jul 18, 2013
    13,602
    3,834
    I have been using the 2n7000 since its inception some decades ago and other FET's and have never given any consideration these precautions, and don't ever recall losing one.
    I have applications out in the field that are ~ 30yrs since inception and still operating.
    Max..
     
  12. Bordodynov

    Well-Known Member

    May 20, 2015
    1,200
    372
    So you use an isolated soldering iron and do everything neatly!
     
  13. MaxHeadRoom

    Expert

    Jul 18, 2013
    13,602
    3,834
    Weller WTCPN which has a 24v transformer, but I don't really handle them with any consideration of static damage.
    Max.
     
  14. crutschow

    Expert

    Mar 14, 2008
    17,033
    4,676
    Power MOSFETs have a large gate capacitance, which tends to protect them from small ESD events.
    It acts as a voltage divider between the ESD voltage from your body capacitance and the gate.
    Thus they are much less sensitive to ESD then a device with very low capacitance and thin gate oxides such as 74HC CMOS logic gates.
     
  15. Mahonroy

    Thread Starter Member

    Oct 21, 2014
    243
    7
  16. dl324

    AAC Fanatic!

    Mar 30, 2015
    5,401
    1,199
    I try to handle them correctly and still had several damaged in the past few months. None completely dead, but experiencing high leakage.
     
  17. Audioguru

    AAC Fanatic!

    Dec 20, 2007
    9,624
    973
    Read the datasheet for the 2N7000 Mosfet. The gate must be +10V for all of them to fully turn on. Some of them barely turn on when the gate is +3V (the minimum threshold voltage) which is very close to the +3.3V or a little less from your IO expander. If the supply for the IO Expander is 5V then all 2N7000 Mosfets will turn on well enough for your circuit.

    What is the maximum allowed reverse voltage for your LEDs? Mine are 5V but your circuit gives them 8.7V which might destroy the LEDs or destroy the IO expander.
     
  18. Audioguru

    AAC Fanatic!

    Dec 20, 2007
    9,624
    973
    You said the MMBT3904 transistor has a gain of 30. But why talk about linear gain when you want it to saturate? Its base current must be 1/10th its collector current for it to saturate. I assume that your relay plus LED need 100mA.
    The same for the high gain oriental transistor. It needs plenty of base current for all of them to saturate.
     
  19. Mahonroy

    Thread Starter Member

    Oct 21, 2014
    243
    7
    I said that I tried the darlington transistor not the 2N7002.
     
  20. Mahonroy

    Thread Starter Member

    Oct 21, 2014
    243
    7
    So I experimented some more and I just can't figure this thing out. I was able to swap in both the darlington, and the 2n7002, changed the resistor values to this:
    Darlington: R11=1K, R10=60K
    2n7002: R11=0ohm, R10 = 10K

    Both will activate the relay on and off just fine..... however.... on power up the GPIO defaults to Input (with an internal 100uA pullup resistor). So because of this, on power up it activates the relay. Once the thing has finished booted up everything is fine, but this is a problem for before it boots up.

    I experimented with lowering R10 in an attempt to overpower the internal pullup resistor, but with no luck. I decreased it down to 15K and it still activates the relay at power up. Changing it to 12K and the relay stays off and remains off.

    How should I go about this? Do I just have messed up resistor values here?

    Thanks again and any help is greatly appreciated!
     
Loading...