# Fan speed control, TIP120, which resistor?

Hi,

i want to use the pwm output from my arduino, a 12v power supply, a 12v 0,15A fan and a transistor to control fan speed.

my question is, how can i calculate what kind of resistors do i need between the fan, arduino and the transistor?

It's not very critical. You just want to turn the transistor ON or OFF. A 1k should work fine.

Be sure to also include a diode over the motor

nice, thank you.

looks like you want to control a computer fan.

this is the circuit I am using and have used this on many projects. The mosfet is a p-channel AO3401 mosfet. The parts are SMD, but you should be able to find through hole equivalent.

I used 3.3v teensy, but same circuit should work on 5v arduino.
you can connect the pwm pin directly to the fan.
I read the RPM value through the tach pin of the fan. That requires a pullup resistor.
The 12v power to fan is controller by the mosfet circuit.
The reason for this is if pwm signal is 0 on computer fan, the fan will still spin at 30%. This way, I can truly completely turn the fan off if needed.

I have not tried feeding the pwm signal to the mosfet circuit to feed pwm 12v to the fan. It probably will work, but this circuit is designed exactly for how a computer fan is supposed to work, that is, speed control is done via pwm pin.

someuser:
Hi,

i want to use the pwm output from my arduino, a 12v power supply, a 12v 0,15A fan and a transistor to control fan speed.

my question is, how can i calculate what kind of resistors do i need between the fan, arduino and the transistor?

Set base current to be 5 to 10% of collector current and calculate the base resistor from that.

To turn a BJT fully on takes this amount of base drive.

here is a demo of my pwm fan controller

MarkT:
Set base current to be 5 to 10% of collector current and calculate the base resistor from that.

To turn a BJT fully on takes this amount of base drive.

The tiltle of the post states a TIP120 (darlington).
Higher threshold, but lower base current needed.
Leo..

someuser:
Hi,

i want to use the pwm output from my arduino, a 12v power supply, a 12v 0,15A fan and a transistor to control fan speed.

my question is, how can i calculate what kind of resistors do i need between the fan, arduino and the transistor?

Here's how to figure out what resistor you need. First, a few things we know:

• The Darlington has two base-emitter junctions in series, so the turn-on voltage is about 1.4 volts (that is, the usual 0.7 times 2).
• The data sheet says the current gain MINIMUM is 1000
• The Arduino output pin should be limited to about 10 milliamps so that when other pins are also used, we don't exceed the specs of the AVR chip.
• For PWM motor speed control, we are not working in the linear region. We want the transistor to "slam" on and off as solidly as possible.
• The Arduino pin output voltage is 5 volts.

OK, now a few calculations:

• The voltage drop across the resistor is V/R. We don't know R yet, but we do know V... it's 5 - 1.4 = 3.6 volts.
• We want to put no more than 10 milliamps load on the PWM pin, so our I is defined... 0.01 amps.
• Georg Ohm says that R = V / I.... therefore R = 3.6 / 0.01 = 360 ohms which we can slide up or down to standard values (i.e. 330 or 470). Let's pick 330... that makes the pin current 10.9 milliamps... no big deal.

Now, are we giving the transistor enough drive? Let's see... 10.9 milliamps * minimum current gain of 1000 equals 10.9 amperes! Since the fan probably draws an amp or two at most, we are certainly WAY well into saturation of the collector.

Lastly, the TIP-120 has a built in snubber diode, so you don't even need an external diode.

In summary: Transistor: TIP-120. Base resistor: 330 ohms. You're good to go!

The TIP120 datasheet has a saturation graph with a ratio of 1:250.

That calculates to 470ohm for ~2Amp collector current.
The transistor has to be mounted on a heatsink for 2A, because it generates 2A x 1.65volt (sat) = 3.8watt.
That's why a TIP120, or any other darlington (high saturation voltage), is usually a poor choice abobe 1Amp, or when low saturation is needed (12volt LED strips).

A common medium power NPN transistor is a better choice for OP's ~150mA fan current.
You only "loose" ~0.6volt, the fan gets 1volt more, and you have a less hot transistor.
Base current needed is 1:10 to 1:20.

A mosfet is the best choice. Almost 12volt is available for the fan.

High-side switching, as doughboy explained, is a must if you want to use the fan's RPM output (un-interrupted ground is needed for that).
Leo..

Krupski:
Lastly, the TIP-120 has a built in snubber diode, so you don’t even need an external diode.

Where?

I don’t see any such thing!

A three terminal device cannot have a diode built in that's across the load!

BTW the symbol for a darlington is not the same as for a BJT - if you draw a circuit
diagram use the right symbols. Otherwise its hard to hippopotamus what you doorbell.

thanks for all the info,

using a 1000k resistor (didnt have 470) and diode(IN4001 MIC) now . Seems to work quite well.

2 problems,

1. fan makes weird noises. I was reading its because of the pwm frequency, gonna look into that now.
2. the DHT22 seems to be very slow or theres a problem with the code or connection, im not sure. If i heat it up its pretty fast, but when cooling down it only drops around 0.1 °C per second. Is that normal?

using a 1000k resistor (didnt have 470) and diode(IN4001 MIC) now . Seems to work quite well.

FYI: I know you meant 1000 Ohms... 1000K = 1 MegOhms and that would have been problematic.

Honestly, the TIP120 is Fully On in your setup with 1000 Ohms... 330 ohms is overkill.

Paul__B:
Where?

I don't see any such thing!

The link in your post points to a PDF file of the TIP-120 datasheet. It clearly shows the diode.

Try looking for a symbol that looks like this:  pwillard:
FYI: I know you meant 1000 Ohms... 1000K = 1 MegOhms and that would have been problematic.

Honestly, the TIP120 is Fully On in your setup with 1000 Ohms... 330 ohms is overkill.

I agree... 1000 ohms will work fine. The point of the "330 ohm" resistor was to show how to CALCULATE the proper part values needed based on certain parameters rather than the "dartboard engineering" methods usually presented here.

I was shooting for a 10 milliamp load on the Arduino digital output pin and showed how to calculate the proper value of R to obtain 10 milliamps.

NO transistor circuit should be designed based on an expected current gain (other than is the minimum enough?).

Experienced engineers who have worked with this stuff for year can get away with "dartboard engineering based on experience", but since the OP asked how to calculate the resistor value, that's what I replied with.

In reality, I wouldn't even use a TIP-120 for this job... I'd use an enhancement mode MOSFET with a gate turn-on voltage low enough to work with TTL voltage levels and simply connect the gate to the Arduino (no resistor needed) and of course the VGSsat is MUCH lower (i.e. better) than the VCEsat of the BJT... but that would not have answered the OP's QUESTION.

MarkT:
A three terminal device cannot have a diode built in that's across the load!

BTW the symbol for a darlington is not the same as for a BJT - if you draw a circuit
diagram use the right symbols. Otherwise its hard to hippopotamus what you doorbell.

The snubber diode does not need to be across the load. The idea of the snubber is to "grab" the reverse polarity inductive kickback produced by the motor inductance (when the PWM switches the transistor off).

Putting the diode across the motor causes the diode to absorb the kickback. Having it in the transistor dumps the kickback into the power supply (which is no problem if the power supply is properly bypassed... as it should be).

Krupski:
Having it in the transistor dumps the kickback into the power supply (which is no problem if the power supply is properly bypassed... as it should be).

Was already typing that when you posted I already assumed you and Paul know it and laughed at the question of Paul 