Maker Pro
Maker Pro

Transistor Base Resistor, how to calculate

TheGrovesy

Dec 19, 2011
6
Joined
Dec 19, 2011
Messages
6
Hi all,

I have designed a simple fan controller which is controller by an ATTiny85. I use one of the output pins to switch this transistor, which has up to 12v passing through it (to operate the fan using PWM).

My question is, I believe I should really have a resistor between the Microcontrollers output pin and the transistor base, but I'm not sure how I calculate this. I would be grateful for any input into this... please be gentle, I'm a software engineer by trade and just learning electronics.

Many thanks,
Chris
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I'm assuming that you've got an NPN transistor with the emitter grounded and the fan between the collector and V+

A transistor has current gain (check the datasheet for the transistor for HFE) Often you see a range, say 80 to 400 -- take the smallest value.

The fan requires a certain current. Let's assume it's 0.25A. Round it up to 0.3A.

Divide the fan current by the gain figure (0.3A / 80) = 3.75mA Just for luck, double this (it's not really for luck, we want to make sure the transistor is saturated).

So we need a base current of around 8mA.

the high voltage from an arduino is around 5V, Vbe is around 0.7V, so we need a resistor that will drop 4.3 volts at 8mA.

From ohms law we get 4.3/0.008 = 537 ohms. I'd grab the next lowest resistor value, 470 ohms.

But it works without a resistor, right? That's because the Arduino has only a limited current drive and that current is small enough not to damage the transistor, so it's generally pretty happy.

Once you fit a 470 ohm resistor*, check that the transistor isn't getting significantly warmer than it was before. If it is, reduce the resistor value. It's possible that the fan takes more current than you estimated.

*Note -- 470 ohms may not be the right value for you. Follow the steps and substitute appropriate values.

The datasheet may also indicate base current required for saturation at several collector currents. This will also provide a guide to the base current you may require. If the saturation figures are available, check your calculated base current for reasonableness.

You should be able to follow the math, If you want more explanation about anything else, please ask.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
How much current is the fan drawing? The transistor you point to can only handle 100ma, which sounds low to me.

Bob
 

Resqueline

Jul 31, 2009
2,848
Joined
Jul 31, 2009
Messages
2,848
Notice that the suggested BC548B is only good for 100mA collector current. Only the smallest fans draw as little current as that. You may want a beefier transistor.
 

TheGrovesy

Dec 19, 2011
6
Joined
Dec 19, 2011
Messages
6
Steve: Thank you so much, that's very clear and very helpful, and I think I understand it all. I should be able to work it out now. And yes my prototype, without a base resistor, does seem to work ok, but I wanted to do a proper job and understand everything I needed. I might post my proposed circuit diagram for you guys to review if that's cool.

Bob/ Resqueline: Yes, I need to check the current draw of the fan. The one I am using is one I found knocking around and does not have any info on it. Now that I understand it all I will be buying a 12v fan for this project.

Thanks again for the help.
 

Resqueline

Jul 31, 2009
2,848
Joined
Jul 31, 2009
Messages
2,848
This place ain't big enough for the two of us Bob.. ;) No, just kidding!
At least the timing was so close it didn't make me look like a fool.. :)

Chris; you may want to try the BC337-40 or BC338-40 instead, they're good for up to 800mA.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
This place ain't big enough for the two of us Bob.. ;) No, just kidding!
At least the timing was so close it didn't make me look like a fool.. :)
As knowledgable as you are, I am graitified each time I come up with the same comment as you do, no matter which of us gets it first.

Bob
 

TheGrovesy

Dec 19, 2011
6
Joined
Dec 19, 2011
Messages
6
Thanks for the advice Resqueline. Out of interest, with the fact I am using one rated at 100mA; does that mean they fan won't be able to draw more than that, or does it mean the transistor might have more current passing through it than it can cope with?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
It could mean either, however, given that the smoke hasn't come out of it, I suspect that the fan does not draw significantly more than 100mA (which is surprisingly little).

edit: either that or you've not left it turned on for very long.
 
Top