Author Topic: arduino fan controller  (Read 24012 times)

0 Members and 1 Guest are viewing this topic.

Offline electronoobTopic starter

  • Newbie
  • Posts: 5
arduino fan controller
« on: May 17, 2013, 03:48:24 pm »
Hello all,

I'm new to this forum and new to electronics honestly...
So I hope anyone could lend a helping hand here?  :)

I have long played with the idea of making a custom fan controller for 3 and 4 pin fans, able to be controlled by a computer or by reading/receiving  CPU, MB and HDD temperatures.
I started to read about electronics and was overwhelmed by the possibilities of pics and ic's. Lol
So I got an Arduino Uno R3 and plunged into electronics-world.  :D

Eventually I gathered bits and scraps from the net and made a circuit in circuit labs.
I'm pretty eager to learn and one has to start somewhere, right?  ;D

The idea:

A circuit that can control 8 fans, 4 normal 3 pin fans and 4 PWM fans.
(I'll probably limit this to 6 so I can add a LCD, like shown here:
 http://arduino.cc/en/Tutorial/LiquidCrystal)

Now, concerning the PWM fans. According to this:
http://www.formfactors.org/developer%5Cspecs%5C4_Wire_PWM_Spec.pdf
the pwm signal needs to be sinked to be able to control duty cycle?

The operating frequency seems to be 25kHz. So for that i would make a triangle wave generator with a TL082 ic. If I understand correctly, R4 and C1 determine the frequency. Though I don't fully understand the fucntion and values of R2 and R3... If I got it right, this circuit would provide a waveform between 0 and 5V, centre 2,5V (cfr. Voltage divider R5 and R6?)?

Next I would use a quad comparator ic LM339 with open drain, to set the duty cycle. Apparently, if the PWM-signal isn't sinked, fan runs at 100%, so I thought I had to switch inputs, because I wanted to control it with the Arduino outputs?
I would convert the PWM signal coming from Arduino to analog 0-5V and feed it to the – input of a comparator, comparing it to the waveform and so making a variable duty cycle block wave (PWM?).
So if duty cycle in the Arduino is set to 100%, the output of LM339 is set to zero, which means the 3,3V from the PWM signal isn't sinked, making the fan running at 100%?
The LM339 seems to be able to sink 6 to 16 or more mA, perfect for the PWM-signal coming from the fan?

So for the 3 pin fans I would use this circuit, with the same Arduino pinouts as used for the PWM fans:
http://www.uchobby.com/index.php/2007/09/23/arduino-temperature-controlled-pc-fan/
but with a modification. I would like to put resistors between collector and emitter side of the BD139's, so that a minimum of 4V is put over the fans. This way Iwouldn't lose the tachometer signal which is lost when switching the 12V on and of?

Finally I would use jumpers for having a choice between tach signal coming from 3 pin or 4 pin fans, through a pull-up resistor? Got it from here:
http://fritzing.org/projects/reading-pc-fan-rpm-with-an-arduino/

I've added the circuit in attachement.

I would be very grateful if any of you enthousiasts and professionals could shed a light on this and give some pointers or remarks or anything. I'm pretty sure I messed up somewhere, so... Feel free to comment!

And I apologize in advance for mistakes that are made or will be made. :D

Thanks and greetings!

K as electronoob
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1433
Re: arduino fan controller
« Reply #1 on: May 18, 2013, 12:58:15 am »
I don't quite understand your question: "PWM needs to be sinked to control duty cycle?" 
I haven't a clue what you are trying to figure out here.
PWM is a method of controlling voltage or power and the method of  control achieves effect by changing Pulse Width and this is Modulation...changing  the duty cycle of the pulse.

The purpose of R2 and R3:  R2 creates feedback to get the oscillator to oscillate. R3 sets the frequency with a time constant (T=kRC) and F=(1/T). C in this case is C1 in your schematic, k is a constant you can calculate from the output frequency.

There is no need to create an oscillator becuase you do not need to generate your own PWM. You already have PWM from the Arduino PWM outputs.

I notice that you are using opto-isolators to interface to the fan control transitors. I would save a lot of money and circuitry and connect the PWM drive directly to the fan control transistors and forget abut photo-isolation.

----------------------------- here I see that you are not quite getting the point of PWM when you say:
"Next I would use a quad comparator ic LM339 with open drain, to set the duty cycle. Apparently, if the PWM-signal isn't sinked, fan runs at 100%, so I thought I had to switch inputs, because I wanted to control it with the Arduino outputs?
I would convert the PWM signal coming from Arduino to analog 0-5V and feed it to the – input of a comparator, comparing it to the waveform and so making a variable duty cycle block wave (PWM?).
So if duty cycle in the Arduino is set to 100%, the output of LM339 is set to zero, which means the 3,3V from the PWM signal isn't sinked, making the fan running at 100%?
The LM339 seems to be able to sink 6 to 16 or more mA, perfect for the PWM-signal coming from the fan?"
-----------------------------
There is no need to convert the PWM signal from your Arduino to analog voltages only to use the resulting voltage to create a PWM signal. You have the perfect PWM signal that can be varied by program control to control the fans. The PWM signal only has to drive the fan control transistors(though a resistor to the base or each transistor, as shown in your schematic).

------------------------- Maybe a good idea, maybe not...hmmm
I would like to put resistors between collector and emitter side of the BD139's, so that a minimum of 4V is put over the fans. This way I wouldn't lose the tachometer signal which is lost when switching the 12V on and of?
--------------------------
Just because the fan is turning slowly doesn't mean it is able to output a correct PWM signal.  If you read the Intel sheet, it offers some excellent advice...read it again! 
I have built fan controllers to silence load CPU fans and I just turn them off until the temperature rises enough for the fans to start cooling. But starting a fan can be tricky. A good idea from Intel's application note: Do not use the method of slowly raising the PWM control duty cycle to start the fans. If you try to do this, the fans will chatter like insane ant's with megaphones singing, while doing a tap dance to Trance Music.  Intel recommends to "kick start" the fans by an up to 2-second high duty cycle to get the fans going and stepping down the PWM to a slow, but running speed.

The decrease in effective voltage applied to the 3-wire fans by PWM will cause the tach signal from the fans to be corrupted by the PWM signal and, as the voltage lowers to slow the fans, the tach output will malfunction and quit altogether.  This is
not necessary a problem.  You should not be so interested in the speed of the fan as the motherboard might be. You should adjust the PWM duty cycle to control fan speed according to temperature, and the RPM must vary with PWM control as an effect of control, but temperature is the feedback of your interest, not RPM  which is a consequence of taking control of their speed. 
 

Offline electronoobTopic starter

  • Newbie
  • Posts: 5
Re: arduino fan controller
« Reply #2 on: May 18, 2013, 08:33:56 am »
Thanks for the reply!

First of all, I probably didn't explain my plans correctly, my English is far from impeccable...  :(  sorry for that.

About the PWM signal of 4 pin fans: I thought that this signal is a 3,3V or 5V voltage created by the fans internal pull-up, which, if not sinked (as in e.g. "not connected") to an open drain, has no consequences. Better explained, fan rotates at full speed in this case. So this lead needs to be connected to a, by duty-cycle varying, open or closed drain? So the pulse should open a drain then?
I came to this by following "http://www.formfactors.org/developer%5Cspecs%5C4_Wire_PWM_Spec.pdf" where 2.1.4 concerns the fan specs and 2.3.1 concerns the controller pins? Chapter 2.3.1 states that the "harware monitor device" needs to provide an open collector/open drain.
And 2.4 states that the motherboard (or controller in this case) shouldn't have a pull-up resistor.
Finally, "http://www.facstaff.bucknell.edu/mastascu/elessonsHTML/Interfaces/ConvComp.html" states that the LM339 outputs are all open collector.
Perfect for the job then I guess, so I thought, 1+1=2? Or am I interpreting this too simple? :-//

The purpose of R2 and R3: I meant to ask "the purpose of R3 and R4" actually, sorry...  :-[

About the PWM outputs from the Arduino: if possible, I actually would like to keep the Arduino frequencies unaltered.
I would prefer to provide an external 25kHz oscillating source. I know I'm probably making it difficult this way, but it adds to the challenge.  :D

Concerning the optocouplers: I assumed it wasn't possible to control the transistors directly because the PWM signal is 5V and the fan needs 12V?
It would make things easier for sure... Thanks for that!

The transistor bypass would only function as a minimum fan rpm provider. I know the low voltage can be tricky when starting fans, but it's easy to implement a kick start in the Arduino sketch I think. And maybe it would be better to create a bypass from transistor collector to base, with a resistor?

The fan reading would be nice to detect fan failure actually. I intend to use this (first) controller as prototype in a headless server located in a garage, you see...
This way I can make the Arduino read rpm and report something in some way if a fan fails. Just a nice extra. Doesn't need to be exact rpm.
High temperature readings tend to occur after a fan failure, so... A thought. :)

Thanks and greetings!

K
 

Offline RPBCACUEAIIBH

  • Contributor
  • Posts: 30
Re: arduino fan controller
« Reply #3 on: May 18, 2013, 11:00:10 am »
I'm far from professional, but as I know, at 3 pin fans
- You have a GND(always the BLACK at 4 pin fans as well) pin which should be connected to GND.
- You have a VCC(at 3 pin fan's it's RED, on my 4 pin fan it is red as well, but the link you showed says yellow, so don't believe that, it's right the 2nd wire beside the BLACK one...) pin which is voltage controlled, meaning that 12 V at that pin should be the max,(at max speed) but you can control the fan's speed by lowering the VCC voltage, and you have a feedback pin which drives your controller's input pin low as the fan turns, so you can measure the time between low impulses, and calculate how fast your fan is running, so you can set the VCC voltage higher or lower.
- In your case the feedback or monitor pin whatever you call it (3rd which is usually yellow in case of 3 pin fans, and blue at my fan but the description you linked says green, it doesn't matter it's the 3rd wire from BLACK), this wire as I know pulls down your controller's sense pin, so you must pull this up with a 10 K resistor as the description says, to YOUR ARDUINO's VCC which may be 3.3 V or 5 V not to 12 V otherwise you destroy your arduino. (I guess if you connect directly to the arduino, and you activate the internal pull up by typing "pinMode (pinname, INPUT_PULLUP)" instead of "pinMode (pinname, INPUT)" in your "void setup ()" function, that should be fine easier and more economic solution without any 10 K resistor, but I didn't tryed it.).
- You have on the 4 pin PWM controlled fan a 4th pin, which is the PWM input or control pin(whatever you name it), As the description says in case of pwm controlled fans, you should connect the fan's VCC directly to 12 V and control your fan with PWM via that pin. Now as I understand from your first post you ware planning to use aditional LM device and and/or some voltage devider circuit, but it's not required. The document you linked at section 2.3.1 shows that the pwm signal is not inverted, it can be driven at 5 V (5.25 V max), and it uses about 5-8 mA. As I know an LED consumes more then that, so you don't need anything else, just connect it directly to your arduino, and you must write the program right for it to function well. Don't forget that the arduino's PWM runs at about 400-500 Hz only, you need to set it between 21 and 28 KHz(as the document you linked shows), than you should be able to control it with simple "analogWrite (pinname, value)".
As you may observe the 2 Kind of control is similar, the GND, VCC, and feedback pins are connected to the same pin, so both kind of fan can be used at a PWM controlled socket, the only difference is that if VCC is directly connected to 12 V your 3 pin fan connected to a 4 pin PWM controlled socket will always be at full speed, but it should rotate, and you should be able to monitor the spped. As you see making the circuit is too easy... as soon as both works, try something harder, like making a socket that can control both kind of fans and able to recognize automatically which kind of fan is connected. Just 3 hint to do that: 1. use only 3 pin because it should be enough. 2. use to PWM control first monitor it on the feedback pin, and if there is no change in speed after 1-2 second, it should recognize that not PWM controlled fan is connected, so drive it by voltage. 3. You should also use a 4th pin on arduino to give a disable signal to a circuit if no fan is sensed in order to prevent owerheating. That's a fair project for a beginner I think.:P:D Good Luck!
« Last Edit: May 18, 2013, 11:33:35 am by RPBCACUEAIIBH »
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1433
Re: arduino fan controller
« Reply #4 on: May 18, 2013, 11:28:56 am »
Changing the PWM duty cycle by programming the Ardruino does not change the frequency of the PWM. The sum of the on and off periods of the PWM periods is always the same, so the frequency(1/T), where T is the total period in microseconds is always the same. You can take the PWM outputs from the Ardurino and connect the output directly to the base of a transistor controlling the fan through a resistor (1K ohm).  If you want to set a minimum speed for the fans, you could connect a 10K pot from the +12 V of the computer's power supply and the other end to ground, connect 10K resistors from the center(slider) of the pot to each of the bases of the fan controlling transistors, where the 1K is also connecting to the base(see schematic) Then, with the PWM outputs set to 0 duty cycle, you adjust the 10K pot until all the fans have started.

Three wire fans do will not output a stable tach signal if you try to control their speed, as I have already said. Only 4-Wire fans can output a stable tach signal...that is why they added a 4th wire.

If you add the 4.7V zener (shown in the revised schematic) across each fan control resistor then you may not need the pot and 10K resistors to set a minimum speed, the zener diode will do it for you.

If you want to create your own PWM signal, output a pulse to the fan controller transistors whose on and off times always total T   (Ton+Toff=T), that way the freq. of the pulse (around 25KHz) would be always the same and Ton is the ON duty cycle and Toff is the OFF portion of the duty cycle.  You control speed in small steps by slowly increasing Ton while decreasing Toff.
« Last Edit: May 18, 2013, 02:00:23 pm by Paul Price »
 

Offline RPBCACUEAIIBH

  • Contributor
  • Posts: 30
Re: arduino fan controller
« Reply #5 on: May 18, 2013, 12:05:04 pm »
To Paul Price: The problem with your circuit is that it drives the GND pin higher and lower while the sensing pin is pulled to GND which is not stable compared to the arduino's GND. Since you can't make the fan to pull up the feedback pin, you can't use the Arduino's VCC as reference, so you must drive the VCC pin in order to get stable reading on the feedback pin, but you're right, this should work in case of 3 wire voltage controlled fans if you don't care about the feedback, you just need a pwm control with a variable minimum fan speed.
« Last Edit: May 18, 2013, 12:48:26 pm by RPBCACUEAIIBH »
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1433
Re: arduino fan controller
« Reply #6 on: May 18, 2013, 12:36:11 pm »
I don't at all understand all this talk about driving the ground higher than lower?  Just  how are you planning to hook up the circuit. A .jpg sketch of your idea would greatly improve communication. Once schematic(even if hand drawn and scanned into a .jpg or .pdf file to save, is worth a thousand nerds.

A ground is a ground, all grounds are all about the same 0-V reference point if you connect them together with a decent sized wire.

The Arduino could monitor the temperature of the PC's CPU heatsink if that is the fan of interest, if it is too hot and the fan is set to full 100% PWM, and many seconds have passed, and your CPU temperature has not decreased,  then you know right away the fan is not working. If the fan is cooling the CPU with increases in Duty Cycle, then you have control of the CPU temperature and the fan's speed can be proportionally controlled by PWM settings.

You can create a very low cost temperature sensor from four to 8 switching diodes (any kind of small size sw. diode) connected in series(cathode to ground, anode to next cathode etc up to the top of the daisy chain) to a 22K resistor (anode of the top diode to 22K resistor to +5 or +12V. and the junction of the top diode/22K resistor is the output point to Arduino A2D input, cathode of bottom diode to ground)  to +5V on the Arduino or the PC's 5V power supply wires.  The temperature changes (decreases 2.2mV(approx.) per diode, so 8 diodes would give you about 4.8V (approx .6V forward voltage per diode), and it will drop -22 mV/deg C   Of course, you would have to relate the reading of your diode sensor to your "digital thermometer" (your finger to sense hot or cold) and get two voltage readings to get a rough calibration and determine exactly what is really cool and what is really kinda hot. You could also use a real thermometer for calibration. Then, you can interpolate the readings in between. You encase the 10 diodes soldered together in heatshrink tubing to keep them from shorting out when shoved between two fins of the CPU heatsink.  In this way you can monitor and control the temperature very easily by reading the temperature then setting PWM up or down in duty cycles settings to control fan speeds.
 

Offline RPBCACUEAIIBH

  • Contributor
  • Posts: 30
Re: arduino fan controller
« Reply #7 on: May 18, 2013, 12:53:13 pm »
I have attached my version which is modified of yours, the BC 857 and BC 847 is similar to the BC 557 and BC 547 but they are SMD.
I believe(but I have not tested) that this circuit makes you able to control both PWM controlled, and voltage controlled fans, the rest depends on your program.
I suggest you start with driving LOW the voltage controll pin, and driving with PWM, and monitoring the speed. If there is no low pulse on feedback, then no fan is connected, or fan is blocked. If there is pulse, but no change in speed while changing the PWM, then a voltage controlled fan is connected, so the program sholuld switch to voltage controlled mode and drive the vcontrol pin instead of the PWM.
I know that the PNP transistor works inverse, but you can compensate that with a "map (variable, min value, max value, max value, min value)" just before the "analogWrite(pinname, value)".

If you still don't understand me, hook up your curcuit, and a voltmeter between the power supply GND, and the fan's black wire, and you will have potencial between them as you set the potmeter. That potencial exceeds the 0.8 V low level on the arduino, and enter into an undetermined state, so your arduino no longer reads 1 and 0 but 1 and undetermined, which can be 1 or 0, so that's why your readings don't meet the specs, and you say that's not reliable. The fan pulls the feedback to it's own GND and if between the FAN's GND and your circuit's GND is a resistor or a not entirely open transistor, then you have a bigget potencial then it should be.That's why I say that GNDs must be connected...

Edit: Sorry for the previous image if you saw that, I realized that I made a mistake so I changed it... I make mistakes too... :P
« Last Edit: May 18, 2013, 01:34:23 pm by RPBCACUEAIIBH »
 

Offline elgonzo

  • Supporter
  • ****
  • Posts: 688
  • Country: 00
Re: arduino fan controller
« Reply #8 on: May 18, 2013, 02:01:52 pm »
Regarding 4-pin PWM-controlled fans, look at Intel's specification (for example here: http://www.formfactors.org/developer%5Cspecs%5C4_Wire_PWM_Spec.pdf?). From this document:

Quote
The Hardware Monitor Devise is required to provide an open-drain or open-collector type output for the PWM signal on pin 4 (see Table 1 and Figure 8 ) with the following properties:

Frequency: 25kHz nominal, 21-28kHz is acceptable
Current sink capability: 5mA required, 8mA recommended
Maximum voltage capability: 5.25V
Maximum VOL: 0.8V

3-pin fans need some voltage regulation, and i am not sure if a simple transistor toggling Vcc will work (not even considering that a 100mA transistor like the BC857 might not be sufficient with respect to the current needed by your fans).
Instead, i would suggest to use a simple buck converter design for 3-pin fan voltage control.

Silicon Magazine has published a fan controller for 3/4-pin fans in its July 2010 issue. The author has re-published the article on his web site: http://geoffg.net/fancontroller.html. Electronoob, you might want to look at it to get some inspiration for your project (especially about controlling 3-pin fans). You don't really need a complicated circuit...

When you design your PCB, try to keep the ground planes for the 5V (controller circuit) and the 12V (fan supply) separate. The reason for that is you don't want to have potential (electric :) ) noise from the fans affecting your controller.
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1433
Re: arduino fan controller
« Reply #9 on: May 18, 2013, 02:45:30 pm »
3-oin fans do not require voltage regulation...the 12V pc power supply or the PWM control is already the regulation.
It is not necessary to separate the 5V grounds from the 12V grounds, the noise from the fans will not upset the Arduino.
A  300mA BC547 is adequate to PWM control a typical PC 12V fan  which has a current rating < 125mA
 

Offline elgonzo

  • Supporter
  • ****
  • Posts: 688
  • Country: 00
Re: arduino fan controller
« Reply #10 on: May 18, 2013, 03:07:15 pm »
3-oin fans do not require voltage regulation...the 12V pc power supply or the PWM control is already the regulation.
It is not necessary to separate the 5V grounds from the 12V grounds, the noise from the fans will not upset the Arduino.
A  300mA BC547 is adequate to PWM control a typical PC 12V fan  which has a current rating < 125mA

Now, i have never done voltage control for a motor or fan with simply toggling Vcc, so i am certainly lacking experience in this area.

As the fan is just an arrangement of coil(s) (inductance), rapid switching of Vcc will lead to voltage spikes. What i don't know is what magnitude of spikes typical PC fans could cause and whether this would be a problem either as noise fed in the power loop or in the form of EMI. Anyway, if you are going to do it this way, a 300mA transistor should be well suited.

EDIT: If you toggle Vcc, the tacho signal from the fan becomes useless. With a regulated Vcc, the tacho signal still works (with its voltage levels depending on the regulated Vcc).
« Last Edit: May 18, 2013, 03:30:42 pm by elgonzo »
 

Offline RPBCACUEAIIBH

  • Contributor
  • Posts: 30
Re: arduino fan controller
« Reply #11 on: May 18, 2013, 04:32:57 pm »
elgonzo may be right about that the switching VCC will not work well as controll since the fan contains a circuit that which drives the motor since it's a brushless motor not a normal brushed dc motor (which vould make noise as he says), but if the feedback is pulled to ground, then the varying VCC will not affect, the signal however varying GND will!
You may try this modified circuit instead of the other one. The the capacitor charges up with each impulse, and you can control with R5 how fast it fades...
I still not sure if the capacitor and pot is required, or not because R2 is there to leave Q1 open, so the impulses will not be 0 and 1 but 0.4 - 0.7 and 1. If you put a capacitor, that may slow down the fan's response time to a new command!
« Last Edit: May 18, 2013, 04:52:37 pm by RPBCACUEAIIBH »
 

Offline elgonzo

  • Supporter
  • ****
  • Posts: 688
  • Country: 00
Re: arduino fan controller
« Reply #12 on: May 18, 2013, 05:08:57 pm »
@RPBCACUEAIIBH, you are right. I was not even remembering that PC fans are essentially brushless motors, until you pointed it out.

It was more than a decade ago i built some (simple) fan control, and since then i forgot a a lot about what i did for what reason. Well, today i just plug those fans into the motherboard, and apparently also getting dumber day by day :)
 

Offline electronoobTopic starter

  • Newbie
  • Posts: 5
Re: arduino fan controller
« Reply #13 on: May 20, 2013, 01:38:10 pm »
Thanks for all the replies! Just got a little smarter again.  :-+

I'm going to order some things and do some testing with all this information.
I'll probably start with an old PSU and some potmeters. A spare optocoupler should keep my Arduino safe, just in case.  :D

Thanks!  ;)

K
 

Offline metalphreak

  • Frequent Contributor
  • **
  • Posts: 815
  • Country: au
  • http://d.av.id.au
    • D.av.id.AU
Re: arduino fan controller
« Reply #14 on: May 21, 2013, 10:47:56 am »
You can PWM 3 pin fans fine with an external transistor/mosfet. The "brushless motor control" ICs in them are fairly basic. There's no microcontroller core or anything in there to upset.

If you don't want to sense the speed, then you are done. If you do want to measure the speed, you have to get creative. As you are dropping the power supply to the entire fan, you're dropping power the part that provides the RPM pulses. The solution to this is "pulse stretching". During a speed measurement period, you hold the power constant. This period is usually just sufficient to gather the RPM info, without significantly affecting the speed of the fan.

Look at any of the major IC manufacturers that do a fan control IC. They all mention this method in great detail.

4 pin PWM fans are easy. Two wires carry your voltage which supplies everything in the fan, including the RPM sense part. Only the fan motor itself is powered through a mosfet, which is controlled by the PWM wire. Some fans have more complex circuitry internally, but are driven the same way (locked rotor detection, fan failure etc).


PWM fans make life so much easier when designing a digital control system. If you don't want to do pulse stretching on 3 pin fans, you really need to go for voltage control instead of PWM (again, only if you want reliable speed reading feedback).

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1433
Re: arduino fan controller
« Reply #15 on: May 21, 2013, 11:06:00 am »
Attempting to monitor 3-wire fan speed by short intervals of pulse stretching will cause the fans to create obnoxious sounds by this power modulation and this sound gets more and more bothersome as the sampled RPM becomes slower and slower. You cannot get the fan tach output to function without raising the effective voltage applied for a time sufficient for some large speedup of the fan for a large fraction of a fan revolution, and so when you finally get a  eading, it will be in error(much higher than the actual RPM before pulse-stretching) and you will very easily hear and see the unpleasant result of this voltage change. Users of the equipment will think the fans are malfunctioning. It is easy enough for most people to adapt to the consistent rushing sound of a fan, but most everyone finds jerky speed change sounds objectionable.

If a four-wire fan is already installed in a piece of equipment, then some way has already been provided by design to control fan speed and so no further control might be necessary. If a three-wire fan is installed, attempting to monitor the RPM to control speed will fail unless you are satisfied  with the fan always spinning no less than at approx 50-75% of its max speed.
« Last Edit: May 21, 2013, 11:46:40 am by Paul Price »
 

Offline metalphreak

  • Frequent Contributor
  • **
  • Posts: 815
  • Country: au
  • http://d.av.id.au
    • D.av.id.AU
Re: arduino fan controller
« Reply #16 on: May 21, 2013, 11:39:41 am »
http://www.actel.com/documents/SmartFusion_cSoC_DC_Fan_Control_AN.pdf (also has a good diagram/comparison of the 2/3/4 pin types)

That's one example on pulse stretching. Assume you have a 1200rpm minimum speed fan which provides 2 pulses per revolution. 20 revolutions per second x 2 pulses = 40 pulses per second. That's 25ms per pulse. You really only need to measure the time between two pulses to work out the RPM, but say you used 4 for more accuracy. That's only 100ms of full PWM ON time. Couple this with the fact you may be driving the fan at 50% PWM anyway, its only effectively increasing the speed for half that time (50ms). With the inertia of the fan blades and the air resistance, I doubt it's going to significantly increase the speed. Depending on the fan, and how low you are running it, you might notice some noise. You only sample the speed every X intervals anyway. It is the downside of trying to PWM control a 3-pin fan AND have speed feedback. But it's a workable solution. If you go for voltage control, you either have a more complex DC-DC conversion or you use an adjustable voltage regulator circuit (in which case you dissipate the extra voltage as heat!).


Really, you need to decide if you need speed detection anyway.

Are you setting a power level to the fan (ie 50% 75% 100%) that can simply be mapped to the PWM duty.
Or are you setting a specific RPM with the PWM changing to meet the set value.
Temperature inputs to control fans? Simply adjusting the PWM with a feedback loop to get the right temp is fine.

Besides that fuzzy feeling of being able to see what RPM your fan is running at, the only real use for it is for fan failure detection (no RPM, lower than expected, etc).
« Last Edit: May 21, 2013, 11:51:01 am by metalphreak »
 

Offline electronoobTopic starter

  • Newbie
  • Posts: 5
Re: arduino fan controller
« Reply #17 on: June 18, 2013, 01:18:56 am »
Ok so, I started making the 25kHz part...

So far so good, I used the TL082 dual op-amp with a computer power supply. The triangle wave generated with the 5V line wasn't very neat (too close to rails?), so I used the 12V line. This gives a very nice triangle, nicely within the 12 and 0V rails. By playing with the resistors and the cap I was able to make an exact 25kHz triangle wave with a 5V amplitude. And here's the problem...

The offset is around 6V. Since I want to feed the signal to an LM339, compared to an averaged DC voltage from the Arduino (through an RC low-pass filter) I need a 0 to 5V triangle, so an offset of 2,5V if I understand correctly...?

I've been searching for days now, but can't seem to find a simple solution to create this signal. Coming directly from the TL082 it goes from 3,5 to 8,5V and if I use a cap in series I get -2,5 to +2,5V...  Help? :-//

There's probably an easy solution to create an adjustable offset to one of these signals, but like I said, I'm a beginner and have no idea how to do it or what to look for...  :-[

Original circuit in attachement, for anyone who needs it (though I used other resistors and cap on breadboard!).

Thanks in advance and for the patience...
 

Offline electronoobTopic starter

  • Newbie
  • Posts: 5
Re: arduino fan controller
« Reply #18 on: June 18, 2013, 01:39:44 am »

If you add the 4.7V zener (shown in the revised schematic) across each fan control resistor then you may not need the pot and 10K resistors to set a minimum speed, the zener diode will do it for you.


Just to be sure:

Does this mean there's always 6,4V over the fan(s) when BD137 is not conducting? According to schematic then.

Thats' a very handy trick indeed. Thanks!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf