Pages: 1 [2] 3   Go Down
Author Topic: 12V PC fan voltage control  (Read 7211 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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" smiley-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.
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Code:
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.
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 94
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Quote
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.
« Last Edit: November 17, 2012, 12:20:32 am by FlyingSteve » Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
                     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... smiley-razz
« Last Edit: November 17, 2012, 05:10:45 am by tuxduino » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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" ;-P

I'll try your suggestion.

Thanks!
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 94
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley )

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 smiley
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the info!

Quote
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... smiley-wink
Logged

Malaysia
Offline Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-razz

my 2 1 cent.

Logged

Malaysia
Offline Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: 1 [2] 3   Go Up
Jump to: