Home     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science

### Author Topic: Adjustable SMPS power supply as fan controller  (Read 4576 times)

0 Members and 1 Guest are viewing this topic.

#### STaRGaZeR

• Guest
##### Adjustable SMPS power supply as fan controller
« on: August 12, 2011, 02:49:41 AM »
Hi there! Just found the site after seeing the some youtube videos of PWM controllers. I'd like to build one myself, but I need some help since I'm more or less a complete noob at this, I only know about ultra basic stuff from college, so please be gentle!

My first idea was to build a simple manual PWM controller to drive the fans. Linear regulators are simple and easy, but I can't stand the heat in the transistor when I slow down the fans. PWM has a much better efficiency, and that's the goal here. Then I heard about all this stuff of 3-pin fans creating all sorts of problems with PWM, so I decided to do a mix of the two: build a PWM generator using the 555 IC, then use a simple buck converter to convert the PWM signal to a stable constant voltage output (basically an adjustable SMPS power supply!). This should have very good efficiency while not having any of the PWM issues.

The circuit I built is as follows. Done in PSpice student:

- The POT is a 100k one.
- Since I didn't know what MOSFET to put as switch, or how to configure it, I just put a voltage controlled switch in there, should be the same as the real MOSFET.
- This is a 1 channel design, the final one will have more, once the first is done the rest is easy. Each channel has to support at least 1A.
- I simulated a 1A output with a 12 Ohm resistor.

Now the tricky parts, I need help from the experts:

- PWM frequency. Basically the freq is determined by the pot and C1. The higher the frequency, the smaller inductor and capacitor in the buck converter. What about efficiency? What freq should I use? Also the freq I'm seeing in the simulation is not constant at all, it varies with the position of the pot. For example, at 0.5 (in the middle, ~50% duty cycle) the freq is 126kHz, when the pot is at one end (100% or 0% duty cycle) the freq is 85 kHz.
- The MOSFET. What model, type, etc. should I use?
- The diodes. Are 1N4148 diodes suitable for this design?
- The inductor and the C4 capacitor. By simulating the circuit I found this combination to be a good one between size of the components and output ripple, getting around 25mV. However I'm not sure if there is a better combination of values. Also, what should I tell the seller about them? I mean: "I want 1 inductor with XX H, a capacitor with YY F". Keep in mind that this should be able to endure at least 1A output at ~12V.

#### kam

• Hero Member
• Posts: 1849
##### Re: Adjustable SMPS power supply as fan controller
« Reply #1 on: August 12, 2011, 10:28:57 AM »
hello STaRGaZeR

Linear DC motor speed controller using a simple PWM switching mode power supply

This is the first circuit that i began pcbheaven with. I was trying to make something similar like yours. First the good news: It works. The mosfet i use is an overkill and quite expensive. You can use a cheaper ans smaller N-channel mosfet. Since you will use it in cut-off / saturation region, any n-channel mosfet will do as long as it can handle your load. Regarding the frequency, you will go above 28KHz otherwise you may have acoustic noise. 35-40Khz is fine i think. The 555 is not very stable in PWM, so changing the duty cycle slightly changes the frequency as well.  Also, in you simulation, you have to use an inductive load and not a resistive. The 1N4148  is ok, but i would use shottky diodes instead. The inductor is measured in Henry and current (or powre). For example, you may want to ask for a 1mH (mili-henry) 0.65A. The capacitor is measured in farads and voltage. For example, 470uF (micro-farad) 25 volts.

And the bad news: This method is not perfect for rpm setting. There is one major issue that comes with this method, and this is the stalling. The torque is dramatically decreased when the voltage is decreased, thus the fan stalls in low rpm. In my experiments, i used a 1200rpm 120mm fan. With PWM, i managed to run it wit as low as 300 rpm before is stalls, but with this method i could not go lower than 700 rpm. The point is that with PWM, whenever a pulse arrives at the fan, this pulse has full amplitude, so the torque is always maximum.

The PWM pulses have only one issue to solve (with 3-wire fans), and this is the speed acquisition. There is one great solution for this though, but you need to use a microcontroller. This method is named "pulse stretching" and i made a circuit for this here: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)

Conclusion (from my experience): Do not use the circuit you proposed to control a fan, it is too much work for nothing. If you want to control the fan by adjusting the voltage, go to something simpler, like for example use a simple LM317 voltage regulator ( i think that i will design a quick circuit for this, because i do not have one in my collection ). Take a look here : 3-Terminal Adjustable Regulator
If possible, use 4-wire fans instead of 3 and control them with PWM, the only reliable, efficient and precise controlling method. If you do not want to have speed feedback from the fan, then you can use PWM with 3-wire fans as well with no problem at all.

Oh and something else: Not all 3-wire fans love lowered voltage supply. Some fans may not return a reliable speed signal if the supply voltage is low. For example, i had this problem with some 1800rpm fans that i tested.  thought that they would work like the 1200rpm fans i first had, but that was not the case. The 1200rpm returned a good signal, but the 1800 did not return a signal at all when the supply dropped below a certain value ( i do not remember which).

#### STaRGaZeR

• Guest
##### Re: Adjustable SMPS power supply as fan controller
« Reply #2 on: August 13, 2011, 17:18:37 PM »
Thanks for the response kam!

I'll use 1N5822 diodes then, they allow up to 3A. There are 1A ones, but I want some margin on them.

I know about the problems that come with voltage regulation, I have had a comercial controller for quite some time.  The thing is that some fans just don't like PWM, and it may cause problems with the Hall sensor, etc. so I want to have the voltage control option. After all it only adds a diode, an inductor and a cap to the circuit. What I'll do is use a switch to change between PWM and voltage mode: if in the PWM position, the pulses are passed untouched to the fan, if in the voltage position, the PWM pulses go thru the converter and output as constant voltage. This way I can have the best of both worlds, just in case my present or future fans don't like PWM.

I don't need RPM feedback, so no need for other tricks

How does the LM317 control the output voltage? I mean, does it dissipate the unwanted power as heat, like a simple pot+transistor lineal regulator does? If so then I'm not interested, the whole point of this is efficient voltage regulation: I don't want the controller to heat up the case like my comercial controller does (what an amazing source of heat!).

Some questions:

- The MOSFET, what are the voltages that switch it on/off? Out of curiosity.
- I've noticed that the MOSFET in those pcbheaven articles is between ground and the fan, instead of between VCC and the fan, is there any reason for this?
- What's the purpose of that diode in parallel with the fan?

#### kam

• Hero Member
• Posts: 1849
##### Re: Adjustable SMPS power supply as fan controller
« Reply #3 on: August 13, 2011, 17:49:36 PM »
If you do not want rpm feedback, then i suggest you test first pure PWM. Indeed, hall sensors do not like PWM, but since you need no rpm feedback.... no problem. There could be of course fans that will not properly operate with PWM, but if you find one, please send me details of this fan or send me the fan itself (all costs on me) to investigate it. I am very interested.

LM317 will dissipate power as heat. Suppose your fan draws 250mA current at 12 volts. I bet you cannot go lower than 7 volts without stall problems. So, the maximum power that the LM will have to dissipate is (12-7)*250*10-3 = 1.25 watts. Not to mention that when the voltage across the fan drops, the fan draws even less current. So, the LM will have to dissipate maximum 1.2 watts. This is less, than few.

Quote
- The MOSFET, what are the voltages that switch it on/off? Out of curiosity.
Depends on the mosfet (typical answer). I suppose for your requirements, it is around 1 volt.

Quote
- I've noticed that the MOSFET in those pcbheaven articles is between ground and the fan, instead of between VCC and the fan, is there any reason for this?
Yes, this is the way you have to connect a N channel mosfet

Quote
- What's the purpose of that diode in parallel with the fan?
Inductors (such as the fan which is an inductive load) have this behavior to "store" energy around the coils when you provide them power, and when you remove the power they "discharge" the energy and they generate a voltage across them with reversed polarity. The diode is a flyback diode and has the same operation like the diodes we generaly put in parallel with the coils of the relays (again inductive loads).

#### kam

• Hero Member
• Posts: 1849
##### Re: Adjustable SMPS power supply as fan controller
« Reply #4 on: August 13, 2011, 17:56:13 PM »
oh, by the way, i am currently designing one of my biggest projects, the second biggest i suppose (in terms of electronic complexity), and it is a fully automated fan controller system for my PC. It can simultaneously control 8 fans (3 or 4 wires) with PWM (pulse-stretching for the 3-wire, pure PWM for the 4-wire), and has 12 temperature sensors. The operator can write scripts and scenarios through a rotary encoder and an LCD, and set the fans to operate according to these scenarios. eg, if the ambient temp is below 20, all fans operate at low speed., if HDD1 temp goes above 42 then the HDD fans run at full speed. It has also 4 inputs for special cooling modes and 3 outputs for siren, PC shut-down etc etc etc...

There is only one problem. The first PCB i designed was HUGE, so i had to turn into SMDs and also i broke the PCB into 3 inter-lockable PCBs. This is what makes this project special for me. One 40-pin microcontroller was not enough so i had to use 2 which communicate with spi. If this project works, i will love it .

#### STaRGaZeR

• Guest
##### Re: Adjustable SMPS power supply as fan controller
« Reply #5 on: August 13, 2011, 22:08:37 PM »
My current solution (pot+transistor) disipates the same "insignificant" amount of heat as the LM317 would in the same situation. And I can guarantee you that with 3 0.3A fans regulated at ~6.5 volts the transistor gets so friggin hot it could boil water. It gets pretty hot with 1 fan only, but with 3 it's insane (same voltage, triple the current, triple the power, triple the heat). A heatsink is a must, and you can guess where all that heat is going, inside the case. This is unaceptable for an HTPC for example, or for a silent PC. Going the "let's dissipate the energy we don't want" route is not possible here, I wish it was, makes everything a lot easier  . And there are fans that can run (and start) at 5 volts, add more heat in there

I'll probably do that: go for the pure PWM solution, and if I find any issues, add the converter.

That's one huge ass project you have there, good luck with it!

By the way, what would be good values for R and L if you want to simulate a 12V 0.3A 1250rpm fan? Also where are you getting the fan headers for your project? I can't find them
« Last Edit: August 13, 2011, 22:11:22 PM by STaRGaZeR »

#### kam

• Hero Member
• Posts: 1849
##### Re: Adjustable SMPS power supply as fan controller
« Reply #6 on: August 16, 2011, 18:31:45 PM »
3 fans 300ma each means a whole amp, so at slow speed you may dissipate as much as 5 watts, 4 times more than i calculated. This temperature is still very low, but you feel it hot because it is generated and emitted from the small surface of a transistor.  Anyway, it is your call I would go for PWM no matter what, even for 0.5 watts.

I have never calculate R and L values for fans so i have no idea. But i do not think that you need them at all.

You can find the headers from ebay. search "header polarized 3 pins", you will find a ton of them

#### STaRGaZeR

• Guest
##### Re: Adjustable SMPS power supply as fan controller
« Reply #7 on: August 19, 2011, 02:14:18 AM »
Thanks again kam!