12V PC fan voltage control

but if I turn it when it's off I can feel "magnetic force hills" so to speak.

That's a brushless motor.

Then the fact that I could vary its speed with just an analogWrite() and a couple of transistors seems to contradict what dc42 said earlier... ?-|

tuxduino:
Then the fact that I could vary its speed with just an analogWrite() and a couple of transistors seems to contradict what dc42 said earlier... ?-|

How wide a speed range did you get? Come to think of it, I've heard of people PWMing brushless PC fans before. I remember they had problems with the tacho output.

This particular fan I have has only two wires: black and red.

The control range I had was quite narrow: IIRC from about 50% upward. At lower pwm values the fan would just "play a note" :wink:
Once started though, the lowest acceptable pwm value decreased. Start inertia, I guess.
If I have a minute I'll rewire the thing and note down the exact values.

Here's the sketch I wrote to control the fan. It's simply parsing integers from the serial line and analogwriting them directly to pin 6.

int cnt = 0;
char buf[100];
int pin = 6;

void setup() {
    Serial.begin(115200);
}


void loop() {
    if (Serial.available() > 0) {
        char ch = Serial.read();
        if (ch == 0x0D || ch == 0x0A) {
            if (cnt > 0) {
                buf[cnt] = 0;
                int value = atoi(buf);
                analogWrite(pin, value);
                Serial.println(value);
                cnt = 0;
            }
        }
        else {
            if (cnt < 100-1) {
                buf[cnt++] = ch;
            }
        }
    }
}

Pin 6 goes to a 1k resistor which goes into a bc237b base. bc237b collector to +5 and emitter to a 1k resistor, to bd135 base.
Fan red wire to +12v, black to bd135 collector. bd135 emitter to gnd.

When the fan is stopped, it only starts with values 120 and above.
When it's running, I can go to as low as 25 without it stopping.
When running under 150 I can clearly hear a sort of note.

When the fan is stopped, it only starts with values 120 and above.
When it's running, I can go to as low as 25 without it stopping.

That's perfectly normal.

I'll give Tuxedo's transistor setup a try... Should work. The PWM freq. from the Pololu motor controller was too high, that's why the fans didn't respond. PWM would actually be the preferred method so I can set different fan speeds for different temperatures.

** What radioshack friendly transistors could I use to setup a pwm circuit like the one Tuxedo mentions

Pin 6 goes to a 1k resistor which goes into a bc237b base. bc237b collector to +5 and emitter to a 1k resistor, to bd135 base. Fan red wire to +12v, black to bd135 collector. bd135 emitter to gnd.

?
Again, sorry for lacking so much electronics knowledge lol I knew more a few months ago when I was learning something new every day, but then I stopped working on Arduino projects for a few months and now I'm back to stupid.

                     5V                12V
                     |                  |
  +------------------+                  +-------Fan red wire
  |                  | 
  |                  |                  +-------Fan black wire
--+--+               |                  |
A    |     1k        C                  |
R  6 |---/\/\/----B     Q1   1k         C
D    |               E-----/\/\/-----B     Q2
U    |                                  E
I    |                                  |
N    |                                  |
O    |                                 GND
--+--+
  |
 GND

FAN = 12V 0,13A brushless PC-type fan
Q1 = BC237
Q2 = BD135, no headsink required

I hope some kind hw-sould will step in and correct any silliness I've written... :stuck_out_tongue:

Q1 in that circuit is redundant, because of the value you have chosen for the base resistor of Q2. You could just as well drive Q2 from the Arduino pin through a 1k base resistor. Although I would reduce the base resistor to about 470 ohms, to make sure that Q2 turns on fully.

dc42:
Q1 in that circuit is redundant, because of the value you have chosen for the base resistor of Q2. You could just as well drive Q2 from the Arduino pin through a 1k base resistor. Although I would reduce the base resistor to about 470 ohms, to make sure that Q2 turns on fully.

TBH that circuit comes from an experiment I made (too) many years ago... I was using the parallel port of 286 and writing to it with qbasic 50-or-so lines "program" :stuck_out_tongue_winking_eye:

I'll try your suggestion.

Thanks!

Ok, so could I do this circuit with a TIP120 Darlington?

I'd imagine the circuit would be Pin 6 to Base, Fan Ground to Collector, Emitter to Ground? Would I need a pull-down resistor to Ground on the Base?

dc42:
Q1 in that circuit is redundant, because of the value you have chosen for the base resistor of Q2. You could just as well drive Q2 from the Arduino pin through a 1k base resistor. Although I would reduce the base resistor to about 470 ohms, to make sure that Q2 turns on fully.

I tried you suggestion and it worked (I had no doubt :slight_smile: )

It seemed to make no difference if I used a 1k, 470 or even 220 ohm resistor between pin 6 and bd135 base.

Thank you :slight_smile:

Edit: for the record, with a 100uF 25V connected between the fan wires I could silence it at low speeds. The relationship between pwm raw value and fan speed changed - now I can go as low as 16, provided the fan is already running, and the start pwm value is now about 50.

tuxduino:
Edit: for the record, with a 100uF 25V connected between the fan wires I could silence it at low speeds. The relationship between pwm raw value and fan speed changed - now I can go as low as 16, provided the fan is already running, and the start pwm value is now about 50.

Be careful, with that capacitor in place you may easily exceed the current rating of the BD135 at the start of each PWM pulse, especially if you use a low-value base resistor. Also, the capacitor will make the fan run faster at low PWM values - which is why you can now go down to 16.

To silence the fan, it would be better to use a PWM frequency above the audible range, say 25KHz. If the fan doesn't work well at that PWM frequency, then an inductor and capacitor can be used to smooth the voltage. Or (more simply), buy a PC fan with a separate PWM input.

Thanks for the info!

Or (more simply), buy a PC fan with a separate PWM input.

The "buy" option is good when you don't want to waste time in details and get a project done. But I'm just experimenting with some electronic "waste" I have accumulated over the years from my dad's shop... :wink:

sorry for me to interrupt. but for me since the motor would be always on then why not use a relay?
connect the red wire to the comment of a relay and the black to ground. on the one of the N.O. just put a 12VDC or the V max of the motor while the other use a well any kind of volatage converter you know to power that motor. just put a transistor and a diode to activate the relay. this will make it run at different speed.

As you can see I'm no expert when it comes to electronics, let alone motor control, but thinking about the pros and cons of a relay vs. pwm, some words come to mind: cost, noise, reliability (no mechanical failure for the transistor option).

I'm just thinking out loud... I'm curious too about the answer from the gurus :stuck_out_tongue:

my 2 1 cent.

technically i would say that yeah i would always choose the pwm way. but if your the type that is result oriented then the method i suggest will get you far enough.

I set a PWM circuit up using a FET and any time I try to slow the fans down (4 120mm PC fans, 350mA) at all they start making an unhappy noise. Any idea's? The fans are definitely a brushed motor.

Thanks