Biasing an NPN transistor as a switch with a pull up/down resistor

Thread Starter

dpetican

Joined Jan 13, 2016
38
I'm switching a relay using an NPN transistor which will be connected to a GPIO pin of a microcontroller. I want to insure that the transistor/relay circuit is in a known state while the system is powering up.

1) Does this type of circuit float like a mechanical switch would?
2) Can/should I use a pull up/down resistor between the GPIO pin and the base resistor or after?
3) How does this affect the usual calculation for base resistance?

Thanks.
 

AlbertHall

Joined Jun 4, 2014
12,625
Usually GPIO pins power up in the input state but check whether that is correct for your micro.
In that case the relay will be de-energised at power up but you might to add a pull down resistor just to make sure. 4.7k would do the job.
 

Thread Starter

dpetican

Joined Jan 13, 2016
38
Usually GPIO pins power up in the input state but check whether that is correct for your micro.
In that case the relay will be de-energised at power up but you might to add a pull down resistor just to make sure. 4.7k would do the job.
Thats what I thought, but I just want to be sure that the 4.7K-10K doesn't affect the base current and the biasing. Does the transistor effectively see the pull down resistor at all if it thats high a value? Thanks.
 

AlbertHall

Joined Jun 4, 2014
12,625
You need to consider the relay coil current and make sure that the GPIO feeds about 1/10 of that current to the base while allowing for the roughly 0.5mA which will flow in a 4.7k pull down resistor.
 

Thread Starter

dpetican

Joined Jan 13, 2016
38
You need to consider the relay coil current and make sure that the GPIO feeds about 1/10 of that current to the base while allowing for the roughly 0.5mA which will flow in a 4.7k pull down resistor.
Wouldn't that be 1.06mA for a 4.7K resistor at 5V and 0.5mA for a 10K? So anyway your saying the pull down is in parallel with base-emitter junction and nothing more is going on so the current divides. Is that correct?
 

AlbertHall

Joined Jun 4, 2014
12,625
I got the current wrong.
Yes the resistor is across the base emitter, but the current would be 0.7V / 4.7k = 0.15mA (the maximum the base emitter voltage can be is about 0.7V).
 
Top