Question Building a simple 4-pin PWM-controlled to 3-pin voltage controlled fan adapter?

taw

Junior Member
Jan 3, 2021
5
0
11
I know you can plug 3-pin fans into 4-pin headers, this is about getting fan speed control on 3-pin fans with no bios/hardware support for regulating their voltage. I've got dead mobos and PSUs to source parts from, and time to tinker with the idea. I have no background in electronic engineering aside from the bear minimum understanding from watching EE yt channels.


The first three pins are the same for 4-pin and 3-pin fan headers, the 4th pin on PWM fan headers is the PWM control signal. If i take the meaning of PWM literally ("pulse width" modulation), i would think that the fan speed is proportional to the pulse width, and also think that "full power/RPM" is set by having the PWM signal always high?

Couldn't one build a simple PWM adapter for 3-pin fans by switching the 12V signal by the PWM control on/off using a FET, and then (optionally?) smooth the output with a capacitor?

I know i could just get a fan controller, but i want to try and build my own PWM-controlled 3-pin header/adapter for 3-pin only fans. Am i missing something, or is PWM controlling fans as simple as switching the 12V line with a FET according to the raw, "unprocessed" PWM signal?
 
Last edited:

Paperdoc

Platinum Member
Aug 17, 2006
2,307
278
126
There is an important difference between the two systems but I suspect you have deduced that without actually detailing it. That is the the power supply on Pin #2 for a 3-pin fan is a Voltage that varies from 12 VDC for full speed down to about 5 VDC minimum. Any lower risks stalling the fan. For a 4-pin fan, this is always the full 12 VDC. A 4-pin fan also includes in its internal circuit board a component (chip? some circuit) that modifies the flow of current from that 12 VDC supply line through the motor windings to effect speed control.

The PWM (yes, pulse width modulation) signal typically is a 5 VDC max signal like a square wave, but with the "% On" value changing rather than 50% always. Typical frequency of this is 20 to 22 kHz. So yes, it simply switches the current flow through the motor on and off. However, which way it works is important. The design of this system allows for connecting this fan to a 3-pin mobo header that is using the old Voltage Control Mode, and the 4-pin fan WILL work under controlled speed. That's a backwards compatibility feature. Now, in that connection situation, the 4-pin PWM fan is receiving NO PWM signal on Pin #4, and it does receive from Pin #2 a VARYING Voltage signal to control the fan speed. Thus I surmise the circuit inside the PWM fan somehow is used as an inhibitor: zero volts from the PWM signal equals full current flow, and +5 V equals no current flow. I do NOT know circuit design, no I am not at all clear how this is done in detail. I just know the result.

You also need to take into account the design of current computer case fan motors. You will be familiar with the classic simple DC motor. It has permanent magnets stationary around a rotating shaft which has attached to it an armature consisting of several small electromagnet coils arranged radially from the shaft. Those coils are attached to contacts fixed to the shaft called a commutator. The case of the fan carries two (usually) flexible contacts called brushes at fixed positions and in contact with the turning surface of the commutator. In this way, the brush / commutator set acts as a switching system to feed current from the source via the brushes to the correct sequence of electromagnets on the shaft, causing it to turn.

Today's computer fans are a different version called brushless fans. They reverse the placement of key components. In these, the permanent magnets are the items attached radially to the rotating shaft as a small array. The electromagnets that need to be energized in the proper sequence and speed are stationary in the case facing the rotating shaft's magnet array. Switching of power to the sequence of stationary electromagnets is done by a small circuit on a board inside the motor case, and the timing of that switching action must be synchronized to the position and rotational speed of the shaft. So there's a small sensor system built in that generates two 5 VDC pulses per shaft revolution, and the switching circuit uses these to time its actions. Since that signal is there anyway, many fans will send that out on Pin #3 and a mobo header can count it to tell you its speed. The mobo does NOT need that for its speed control work, but it will display it for you as info. It also monitors that for fan failure.

Thus, current brushless fans need a smooth relatively noise-free voltage to supply the switching control circuit as well as for power to turn the shaft. For a 3-pin fan the voltage available varies from 12 to 5 V or less, so the circuit also needs to adjust that power source to supply its own low-voltage needs. That's another reason why it may fail to function if fed a very low voltage.

This method of controlling the speed of a DC motor by Pulse Width Modulation is NOT the same as has been widely used with larger DC motors. On those applications, the DC voltage source connected to the common motor type with brushes and a commutator is pre-modulated with the PWM signal, so that feed is somewhat noisy with pulses that have little effect on such a motor. The makers of computer 4-pin PWM fans specifically tell you NOT to feed this small fan type with one of those external pre-modualted PWM DC drive systems. Doing so likely will damage a computer brushless fan (mostly in its internal circuit control board) with pulses and noise in the voltage source. Thus I suggest you need to ensure that the signal you convert to a controlled voltage needs to be relatively free of switching transients from the PWM modulation system output.

There ARE commercially-available units that do this job of converting a 4-pin fan signal system into a Voltage Control signal system for 3-pin fans. But I gather your interest is not merely powering that fan type; it is in designing and building a device to do that job.
 

taw

Junior Member
Jan 3, 2021
5
0
11
Thank you for the detailed explanation! It is really helpful.

That's a backwards compatibility feature. Now, in that connection situation, the 4-pin PWM fan is receiving NO PWM signal on Pin #4, and it does receive from Pin #2 a VARYING Voltage signal to control the fan speed. Thus I surmise the circuit inside the PWM fan somehow is used as an inhibitor: zero volts from the PWM signal equals full current flow, and +5 V equals no current flow. I do NOT know circuit design, no I am not at all clear how this is done in detail. I just know the result.

I was wondering about that as well. If i take no consideration for the case where the PWM signal might be absent, my converter wouldn't work if i plugged it into a 3-pin header. Then there's also the question about the minimum current the fans can work with. I decided to keep it simple and work around both problems by using a resistor of yet-to-be-determined resistance from collector to emitter, so there's always a minimum current in the absence of the PWM signal, and the PWM signal would just raise it beyond that minimum. It wouldn't take into account varying voltage in the 3-pin headers, but for now that's fine with me. Depending on how successful anything of this goes, i might revisit this part later.


So there's a small sensor system built in that generates two 5 VDC pulses per shaft revolution, and the switching circuit uses these to time its actions. Since that signal is there anyway, many fans will send that out on Pin #3 and a mobo header can count it to tell you its speed. The mobo does NOT need that for its speed control work, but it will display it for you as info. It also monitors that for fan failure.
I was wondering how that signal is generated. I'll just pass that signal through unchanged.


You also need to take into account the design of current computer case fan motors. [...] Thus, current brushless fans need a smooth relatively noise-free voltage to supply the switching control circuit as well as for power to turn the shaft. For a 3-pin fan the voltage available varies from 12 to 5 V or less, so the circuit also needs to adjust that power source to supply its own low-voltage needs. That's another reason why it may fail to function if fed a very low voltage.

This method of controlling the speed of a DC motor by Pulse Width Modulation is NOT the same as has been widely used with larger DC motors. On those applications, the DC voltage source connected to the common motor type with brushes and a commutator is pre-modulated with the PWM signal, so that feed is somewhat noisy with pulses that have little effect on such a motor. The makers of computer 4-pin PWM fans specifically tell you NOT to feed this small fan type with one of those external pre-modualted PWM DC drive systems. Doing so likely will damage a computer brushless fan (mostly in its internal circuit control board) with pulses and noise in the voltage source. Thus I suggest you need to ensure that the signal you convert to a controlled voltage needs to be relatively free of switching transients from the PWM modulation system output.


That could explain the failure of my first "proof of concept" attempt. I simply used a FET to switch the 12V line according to the PWM signal, and while the emitter current behaved as i would have expected, the fan didn't spin and instead made whiny noises. I suppose the next step will be learning how i can smooth the output. From my current understanding i'd try a capacitor between emitter and ground, but i'll try any further experiments in simulators first.
 

Paperdoc

Platinum Member
Aug 17, 2006
2,307
278
126
I don't know enough about filtering noise and transients. But I wonder if you will need a better-quality filter design to "smooth out" the short high-voltage transients in the final voltage output. Perhaps something like a Pi filter with 2 caps and an induction coil.

There may be another design concept. The original 3-pin fan speed control circuit may simply be a DC amplifier. It has output up to its supply voltage (12 VDC) and a max output current capability of 1.0 A. Would it be do-able to use the PWM signal to control a DC amplifier that responds to the PWM signal available (instead of to an input voltage or current) to control its DC output? Maybe simply taking that PWM signal and really "smoothing" it out into a relatively noise-free DC voltage could serve as input to such an amplifier, without passing rapid transients through the amp. Maybe I'm really talking anpit the same thing, here.

In any case, note that the normal "load" of a fan (or hub, or whatever) on the PWM signal line is very small, so that nobody worries about how many devices (e.g.fans) can be connected to that header output line.
 
Last edited:

taw

Junior Member
Jan 3, 2021
5
0
11
I don't know enough about filtering noise and transients. But I wonder if you will need a better-quality filter design to "smooth out" the short high-voltage transients in the final voltage output. Perhaps something like a Pi filter with 2 caps and an induction coil.

I've had some fun in a simulator and i think i've come up with something one could call a design. It's probably not good by a long shot and some of the chosen quantities may be weird, but that's because those are just parts that i have.

circuit.png

I haven't built it yet, but have already scavenged all the parts and did some simple tests using just the controller part, a single fan, and a 12V signal through a 1k resistor in place of the PWM signal, and that worked. I couldn't actually test the PWM yet because i don't have a motherboard with any support for it until my new one arrives (the old one died unrelated to this, bricked by bad firmware). All i can do now is test this on the dead mobo that still provides voltages but no PWM for the fan connectors. The schematic works well in a simulation, but since i'm not sure if i'm following the PWM spec correctly i can't say if any of that translates to reality.

Apparently according to a specification by intel, motherboard PWM headers are "open drain" and expect a "pull up resistor". If i understood any of that correctly, this schematic should hopefully conform to that? (Edit: I think i made a slight mistake there, if the transistor on the motherboard side is PNP and not NPN, the signal isn't inverted anymore. Everything else would still work regardless).

And since i'm going to have 4 fans attached to this at total load of ~960mA (should be in spec for all the parts i have), and since i'm using the 5V line from a 4-pin molex anyways, i may take the extra GND and 12V from that connector also (i'd mix it in with the 12V from the motherboard using diodes) to not load the motherboard header too much.

I also found that this kind of "voltage regulation" is really finicky. The capacitor in the filter assembly can charge enough during the on-pulse to supply nearly full power during the entire off-duration, eliminating any desired voltage regulation. Instead of coming up with something smarter, i just tuned the capacitance of the filter cap and the resistance before it such that i get a reasonable scaling of current across various PWM duty cycle percentages (for this and only this particular load).

Now i'll have to hope that the capacitance of the fans itself wont screw me over later, because i can't measure it now. I tried adding some in the simulation and unexpectedly it didn't seem to have much of an effect.

I used the simulator at: falstad.com
If you want to look over it, File>Import From Text:
$ 1 0.00000125 0.37936678946831776 42 5 43 t 192 288 224 288 1 1 0.6266598103922707 0.7715862247270237 1000 d 416 288 416 240 2 default r 480 336 528 336 0 12.5 r 416 240 352 240 0 1000 w 416 288 352 288 0 d 528 336 528 384 2 default d 352 288 352 336 2 default w 224 272 224 240 0 w 224 304 224 336 0 w 224 336 256 336 0 w 224 240 256 240 0 r 256 336 256 240 0 50 c 304 288 304 336 0 0.000001 7.921989496787656 0 w 304 384 224 384 0 w 304 240 352 240 0 r 304 240 304 288 0 10 w 528 384 480 384 0 l 352 240 352 288 0 0.09 0.5041866834497494 w 304 336 304 384 0 w 224 384 224 336 0 R 96 -32 16 -32 4 5 25000 5 0 0 0.5 t 144 -32 144 16 0 1 -0.7715862246270251 9.999854175122109e-11 100 r 96 -32 128 -32 0 1000 g 112 16 64 16 0 0 w 128 -32 144 -32 0 w 128 16 112 16 0 w 160 16 160 48 0 w 160 288 160 240 0 r 160 240 16 240 0 1000 R 16 240 -16 240 0 0 40 5 0 0 0.5 w 160 48 160 240 0 b -16 -64 171 39 0 w 352 336 480 336 0 w 304 384 480 384 0 b 560 416 450 299 0 x -15 56 137 59 4 11 PWM\s(mobo\sside,\sopen\sdrain, g 224 64 224 -32 0 0 R 304 80 304 -32 0 0 40 12 0 0 0.5 b 192 -64 326 -1 0 x 331 -12 439 -9 4 11 GND,\s12V\smainboard x 457 433 549 436 4 11 Load,\s4x\s50Ω\sfans x -15 70 115 73 4 11 signal\sis\sinverted\si\sthink?) x 129 434 419 437 4 11 Bad\sbut\sworking\s(for\sthis\sand\sonly\sthis\sset\sof\sfans)\sPWM- b 129 212 438 416 0 x 129 448 273 451 4 11 controlled\svoltage\sregulator w 160 288 192 288 0 b -32 208 27 271 0 x -65 287 25 290 4 11 From\s4-pin\smolex w 304 240 304 80 0 w 224 240 224 64 0 o 2 1 0 135425 5 0.8 0 2 2 3

Now that i think about it, i'd probably also do some filtering on 12V and GND (with an inductor in GND and cap between GND and 12v?) so i don't spew noise into the mainboard.

There may be another design concept. The original 3-pin fan speed control circuit may simply be a DC amplifier. It has output up to its supply voltage (12 VDC) and a max output current capability of 1.0 A. Would it be do-able to use the PWM signal to control a DC amplifier that responds to the PWM signal available (instead of to an input voltage or current) to control its DC output? Maybe simply taking that PWM signal and really "smoothing" it out into a relatively noise-free DC voltage could serve as input to such an amplifier, without passing rapid transients through the amp. Maybe I'm really talking anpit the same thing, here.

I'm not sure if with amplifier you are referring to readily available ICs or designs one could/should build oneself? If i understand correctly, smoothing out the PWM signal and feeding that into a transistor (?) to amplify it, wouldn't i be at the mercy of the spec for the transistor in regards to over what specific base-voltage range it gates the current? So far i have managed to scavenge just one transistor that is rated for this current (which may be overkill), but i can't find any detailed specs.

In any case, note that the normal "load" of a fan (or hub, or whatever) on the PWM signal line is very small, so that nobody worries about how many devices (e.g.fans) can be connected to that header output line.

So i'd have to add a resistor to the base of the transistor, i don't have that currently in the schematic above.
 
Last edited:

taw

Junior Member
Jan 3, 2021
5
0
11
Update:

It works!

The circuit above is mostly wrong, and some quantities are off by orders of magnitude because i didn't read them correctly. Also i solved the problem of the voltage regulation being dependent on the load and capacitances, it now works with a variety of loads (down to ~12 ohms) and regardless of capacitances and inductances in the load. The quantities may still be weird, but that is what i have. That's e.g. also the reason why i used two capacitors in series to filter GND and 12V on the input side, because i only have 10V capacitors with enough capacity. I added a diode to the input to avoid oscillations, which sadly also drops the theoretical efficiency down from 96% to 92%. Supposedly the PWM frequency is chosen at 20-25khz specifically to avoid creating audible noise in soundcards in the same system, so i guess one could just skip the input/gnd filtering and the associated diode for better efficiency, but i thought it was still a nice to have.

One can easily add a resistor between the emitter and collector of the main transistor to make sure the load always gets a minimum current (which is useful for fans), or replace the seperate 5V line by instead using a voltage divider with the 12V to feed the controller side for a cleaner design.

The box titled "PWM" shows how it is wired on the motherboard side, that's not part of the actual implementation and is only there to make the simulation work.

circuit.png


I'll spare you the pictures of the actual working implementation because i don't want to offend engineers (no circuit board, just wires, lots of electrical tape, and horrible soldering conveniently hidden under electrical tape). I may upload one later once i re-implemented it all neatly in a designated box
 
Last edited:

Paperdoc

Platinum Member
Aug 17, 2006
2,307
278
126
I gather you have not only made a design that works on a simulator, you also have built it that way and used it successfully with a real mobo and fans. Congratulations.
 

taw

Junior Member
Jan 3, 2021
5
0
11
I gather you have not only made a design that works on a simulator, you also have built it that way and used it successfully with a real mobo and fans. Congratulations.

Yes, and thanks :)

One thing i noticed. You mentioned earlier in this thread that 4-pin fans probably have some logic built in to detect whether a PWM signal is present, and behave accordingly. I replied that i might revisit that later once i have something that works. Luckily it turns out that, due to the way the PWM signal is wired ("open drain", ie the board doesn't send a current pulse _to_ the fan, it instead drains current _from_ the fan to ground during off-pulses), the absence of a PWM signal is equivalent to having the PWM signal set to 100% duty cycle. Because the 5V signal on the left is never drained if i plug this into a 3-pin header, it behaves as if i just plugged 3-pin fans into 3-pin headers. So no further logic is needed to account for that scenario.


The only thing that remains now is to find some (non-flammable) container to re-implement this in more nicely and in such a way that it fits behind the motherboard tray, i'll upload a picture of that when it's ready.
 

Paperdoc

Platinum Member
Aug 17, 2006
2,307
278
126
Actually, I never thought a PWM fan has any way to "detect" a PWM signal and make a decision. I DID think it uses the PWM signal as an "inhibitor" so that NO voltage corresponds to full power use, and FULL 5 VDC voltage requests NO power to the motor windings. Your explanation of how that is accomplished corresponds well with the result I had postulated (without my ever knowing how it is done).
 

aigomorla

CPU, Cases&Cooling Mod PC Gaming Mod Elite Member
Super Moderator
Sep 28, 2005
20,846
3,190
126
PWM on motors, which is what a fan is, is regulated by that 4th wire.
It tells whatever is sensing that wire to either decrease the pulse time interval for faster rotation, or increase it for slower rotation.
The voltage is held constant, its just the pulse time that isn't on a PWM fan.

So a PWM fan running at slowest speed will still be 12V, as well as full speed, unlike a 3pin fan which does it by current directly.

Also most PWN fans will take a 3 pin fan header.
You just need to make the edges fit by sniping the side guard off.
Its really only different on that 4th wire.

Red = +
Black = -
Yellow = RPM Sense
Blue = PWM Sense.

The blue wire when missing runs at 100% like you noted, the fan defaults back to current based logic until that 4th wire is reattached.