Fan only spins when given 255 pwm using TIP120

I am using the first diagram here:
http://www.thebox.myzen.co.uk/Workshop/Motors_1.html

When I put a full 255 out, it spins fine, when I put even 250, then the fan just hums. Any ideas what could be causing this?

We need to know more.
When you use a 12V motor on a 5V power supply, that could be the cause.
Or you have mixed up the pins of the transistor. Or the resistor to the base is too large, for example 330k instead of 3k3.

Like a whistle?
I think it's because the PWM isn't a real analogic signal but a square wave. So the fan could "sense" that, creating a whistrle.
You don't ear the noise if you use a pwm of 255 because the Arduino does a "trick" by disabling the PWM and writing an HIGH signal on the pin.

You could try to put an RC filter between the pin of the MCU and the base of the transistor, made with a 10K resistor and a 100nF capacitor.

The fan requires 12V and I am using a 12V power supply. I have tried a 1k resistor and a 220 resistor with the same results. I am fairly certain that I don't have the pins confused, I have looked over it several times and even pulled everything out and started over.

The noise is more of a hum than a whistle I would say.

Most small fans use brushless DC motors, and the circuitry in some of those does not work correctly with PWM power, or with reduced voltage.

jremington:
Most small fans use brushless DC motors, and the circuitry in some of those does not work correctly with PWM power, or with reduced voltage.

If I connect a lower voltage dc power supply directly to the fan, it works fine. I am not sure if this is meaningful.

I was able to find the stats on the motor I am using:

Have you tried the RC filter before the base pin?

leo72:
Have you tried the RC filter before the base pin?

Sorry, was going through my parts looking for things. This actually works. I had tried some different resistors/capacitors earlier without luck, but it seems I wasn't using a large enough value for either.

Is there an easily understandable resource for how to select these values? I am still pretty novice overall..

Try to use an online calculator, like this one:
http://sim.okawa-denshi.jp/en/PWMtool.php

With a "filter" you're smoothing the PWM into a DC level.
I think that, if this "noise" bothers you, you ought to change the Timer so that it runs at an "ultrasonic" frequency.
Choose an output with a timer other than the one that will affect millis()

http://playground.arduino.cc/Main/TimerPWMCheatsheet

I think he just could experience some noise reduction by changing the pin at which he connected the transistor.
Pins 5 & 6 work at ~976 Hz, that's almost the double of the frequency of the other PWM pins (3, 9, 10, 11) that work at ~490 Hz.

leo72:
I think he just could experience some noise reduction by changing the pin at which he connected the transistor.
Pins 5 & 6 work at ~976 Hz, that's almost the double of the frequency of the other PWM pins (3, 9, 10, 11) that work at ~490 Hz.

I will try this, but noise isn't really an issue currently. It initially wasn't spinning at all (that was the issue). Still, I will check this out anyhow thanks.

Then something's up here, something dissonant.

Dear Arduino-Community,

I got the exact problem with 2x 12v fans. the fans work perfect with low voltage (eg. 5v or 7v and up to 12v) but will not turn while using PWM signal.

i use a 12v supply, N-Channel Mosfet (IRF510) and 2 Fans. PWM pins on the arduino are 5&6.
I tried changing the PWM frequencies without results.

what exactly is an rc-filter?

thx for the help, greetings from Germany

The humming comes from the motor not having enough current to overcome the at rest physical resistance. Once it has enough to overcome it, it takes far less current to maintain speed.

Reducing the base resistor is the first step, 150-1K would probably be the range you want, start high and go down . Make sure the transistor you use is rated to take the current from the motor.

If that doesn't work its a more complicated box of worms so to speak. You'd need to take measurements at different points to get a better picture of whats not working.

The humming comes from the fact that the PWM is an audible frequency, depending which outputs are used this could be around 500Hz or 900Hz.

lionex:
i use a 12v supply, N-Channel Mosfet (IRF510) and 2 Fans.

Sorry, but 5V isn't really enough to get those IRF510 FETs to turn on good.
You need to spec a "logic-level" MOSFET, like STP40NF10L.
Depending on the fan (no current mentioned), you may not need a FET at all, a junction transistor (NPN) may likely do the job.

Here is an example that inspires some and repels others --

The humming comes from the fact that the PWM is an audible frequency, depending which outputs are used this could be around 500Hz or 900Hz.

True, but only when the motor is in a stall position. Meaning the problem is not enough current :roll_eyes:.
Or in a more unlikely case, the coils of the motor are not PWM compatible and designed only for non-switching voltages.

If its not working with a smaller base resistor there are a few common problems I see all the time.

#1 and by far the most common - You wired it wrong. (transistor is in backwards.....)
#2 wiring it wrong killed your transistor/fet.
#3 you motor doesn't work or you killed your motor somewhere along the way.
#4 you can't read resistor values for squat, that's a 100K not 100.

If these don't apply or not sure, try measuring the voltage across the motor and/or the transistor and see how it changes when you apply a voltage at the base.

Try hooking it up as a emitter follower but drive the base with 12V not 5V. (motor goes on the emitter side).

This is the kind of thing where the problem is obvious if your sitting right next to it with a a volt meter, but next to impossible threw a computer screen.

I'm surprised Pancake didn't catch this. The others ... well. Did anyone besides ME notice from the spec sheet this particular fan is a BRUSHLESS motor? Now what do you think happens to that embedded brushless controller when you give it PWM???

Confused? I bet it is! That's why it only works when you give it a 255 (full on) command!!!

I had to change my zoom to see the specs.
I thought that it was a blank page.

So there's the OP's (garcara's) issue.
And there's lionex

I have a "DC Brushless" blower, and it works fine (speed varies) with PWM.
BFB0512VHD
12V 0.28A
Do I need to work that out for youtube?