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

Thread Starter

Mahonroy

Joined Oct 21, 2014
315
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!
 

crutschow

Joined Mar 14, 2008
25,133
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Ω.
 

Thread Starter

Mahonroy

Joined Oct 21, 2014
315
2n7000 'Fetlington'?
Max.
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?

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Ω.
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.
 

MaxHeadRoom

Joined Jul 18, 2013
20,927
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?
.
Mosfets are not current operated devices, similar to valves, they are voltage operated (trans-conductance) devices.
Max.
 

Attachments

kubeek

Joined Sep 20, 2005
5,724
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.
You could switch the NO and NC contacts on the relay to overcome that.
 

Thread Starter

Mahonroy

Joined Oct 21, 2014
315
Last edited:

Bordodynov

Joined May 20, 2015
2,630
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.
 

MaxHeadRoom

Joined Jul 18, 2013
20,927
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.
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..
 

Bordodynov

Joined May 20, 2015
2,630
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..
So you use an isolated soldering iron and do everything neatly!
 

crutschow

Joined Mar 14, 2008
25,133
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.
 

Audioguru

Joined Dec 20, 2007
11,249
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.
 

Audioguru

Joined Dec 20, 2007
11,249
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.
 

Thread Starter

Mahonroy

Joined Oct 21, 2014
315
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.
I said that I tried the darlington transistor not the 2N7002.
 

Thread Starter

Mahonroy

Joined Oct 21, 2014
315
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!
 
Top