Pages: 1 [2] 3   Go Down
 Author Topic: 12V PC fan voltage control  (Read 3019 times) 0 Members and 1 Guest are viewing this topic.
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)
 « Reply #15 on: November 16, 2012, 01:50:12 am » Bigger Smaller 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"
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
Edison Member
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
 « Reply #16 on: November 16, 2012, 01:24:27 pm » Bigger Smaller 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) {
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
Edison Member
Karma: 114
Posts: 2205
 « Reply #17 on: November 16, 2012, 04:16:54 pm » Bigger Smaller 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
Jr. Member
Karma: 0
Posts: 90
 « Reply #18 on: November 17, 2012, 12:13:14 am » Bigger Smaller 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
Edison Member
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
 « Reply #19 on: November 17, 2012, 05:04:18 am » Bigger Smaller 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...
 « Last Edit: November 17, 2012, 05:10:45 am by tuxduino » Logged

United Kingdom
Offline
Karma: 146
Posts: 4887
 « Reply #20 on: November 17, 2012, 05:24:57 am » Bigger Smaller 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. http://www.eschertech.com

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)
 « Reply #21 on: November 17, 2012, 05:44:18 am » Bigger Smaller 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

Thanks!
 Logged

Offline
Jr. Member
Karma: 0
Posts: 90
 « Reply #22 on: November 17, 2012, 09:05:22 am » Bigger Smaller 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
Edison Member
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
 « Reply #23 on: November 20, 2012, 02:44:40 pm » Bigger Smaller 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 )

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
 Logged

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)
 « Reply #24 on: November 20, 2012, 03:03:09 pm » Bigger Smaller 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
Karma: 146
Posts: 4887
 « Reply #25 on: November 21, 2012, 03:10:26 pm » Bigger Smaller 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. http://www.eschertech.com

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)
 « Reply #26 on: November 21, 2012, 04:12:48 pm » Bigger Smaller 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...
 Logged

Malaysia
Offline
Sr. Member
Karma: 7
Posts: 385
 « Reply #27 on: November 21, 2012, 06:01:42 pm » Bigger Smaller 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
Edison Member
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
 « Reply #28 on: November 21, 2012, 06:14:30 pm » Bigger Smaller 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

my 2 1 cent.

 Logged

Malaysia
Offline
Sr. Member
Karma: 7
Posts: 385
 « Reply #29 on: November 22, 2012, 01:25:54 am » Bigger Smaller 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