4 wire fans contain circuitry to regulate how much power is being delivered to the fan. You can think of it like a MOSFET with the PWM pin connected to the gate. When the PWM signal is HIGH, the MOSFET is on, current flows and the fan runs. When the PWM signal is low, the MOSFET is off and no current flows. This is typically done at around 25 kHz so the fan motor just "sees" the average, which, like you said, is the 12V * duty cycle
imagine relay is controlled by PWM input and his NC is in +12V circuit of fan, if nothing on PWM pin then Fan rotate at full speed. if on PWM is impulse with small duty then relay disconnect 12V for short time. and if duty cycle goes larger - disconnection remain longer. and so on, so that fan getting to short power impulses to support rotation. friction wins and fan stops.
In PC brushless fans the motor is commutated by Hall effect sensors that determine when each phase should turn on depending on the rotation of the rotor. The PWM signal is used to gate these signals so the commutating MOSFETs do two things simultaneously, commutation and power control. The same technique is used in RC model motor controllers (called ESC's), except that there the control signal is a servo signal and this is converted to the actual PWM by a microcontroller in the ESC as servo signals are not directly suitable.
You have 4 pins. When you apply 12 VDC to the 12V pin and ground the fan runs at about 1350 RPM which is maximum speed. Your fan has 4 pins. In addition to 12 volt power you have a tach out normally two pulses per revolution and you have a PWM (Pulse Width Modulation) input. Try something. With the fan powered as you have running full speed try connecting the PWM in pin to ground rather than have it just float. Does the fan stop?
Should that work and you have a source of PWM pulses you can apply your PWM pulses to the PWM in pin. The tach out is strictly an output so a cpu can determine the fan speed. The PWM as was mentioned is simply turning the fan On/Off at a very fast rate. This makes for fan speed control. Likely as mentioned using a MOSFET internal to the fan. Figure at full speed the fan only draws 110 mA so a tiny little N Channel MOSFET is easily embedded in the fan case.
It's a 12 V fan, isn't it? (Can't read the linked article as it wants to play silly buggers and get me to answer a totally unnecessary question which I simply refuse to do! )
So you notice that if you do not pull that wire down, the fan just runs at full tilt. This means it has a pull-up and it pulls up to 12 V because it is a 12 V fan. What voltage you read is the pull-up versus your meter input impedance. As your digital meter has a very high input impedance, the 7.35 V indicates a really high pull-up resistance value.
I believe the fan will in fact accept 5 V logic levels and that pull-up will not actually apply excessive voltage to the Arduino (to the input protection diodes that is, and that only applies until the pin is set to OUTPUT).
Inputs like an Arduino input or the fan pwm input are usually "high impedance" which means that when connected to a circuit, they will sense the voltage level in that circuit but because they allow only a very tiny current to flow in or out of the input, the voltage in the circuit is not affected by the connection. High impedance inputs are very sensitive and susceptible to electrical noise in the environment from anything like nearby electrical equipment or radio waves from space. This can make the device like the fan or the Arduino behave in strange random ways. A pull-up or pull-down resistor on the input ensures that, when not connected to anything, the input reads high or low consistently instead of randomly.
Pretty much. The input pin of a MOSFET is called the "gate" and has a very high impedance. It acts like a small capacitor. The pull-up resistor charges up the MOSFET gate and switches it on. When you connect the gate to ground, the gate discharges and the MOSFET switches off.
I thought it was the voltage from the Arduino's PWM pin that was controlling the speed of the fan, but would it be perhaps more correct here to say that it is the lack of any voltage that is actually doing the controlling?
For example, is the PWM pin essentially discharging the MOSFET by connecting it to the Arduiono's ground at a regular rate?
It is, and it should be. The pin is set as an OUTPUT so it switches between 0V and 5 V. By switching rapidly, it controls how much power is actually driving the fan and that influences how fast it will spin against the air pressure it is generating.
We don't know what components the fan has inside - BJTs or FETs though the latter are more usual nowadays and would be far more likely in regard to a high impedance input.
It does not matter. The only reason PaulRB mentions it is that the input capacitance of FETs does draw current to charge and discharge rapidly as is used in PWM and this is sometimes - but not at all likely in this case - something you need to take into account when using PWM to drive a FET.
Damn - this means that I still do not understand this, then - so frustrating.
Can I just check something, again, please?
Further to the above, I understand (I think) that the fan is being pulled up (i.e. the same as high) to 12v - this is the output on the pwm wire.
To get the fan to stop, I need to pull the wire down (to low).
How does connecting the wire to the PWM pin and pushing out 5v actually do this?
If it is outputting 0v, nothing will happen, but if you push 5v into a wire pushing out 12v, does that somehow mean that the net 7v will cause the switch to read low and turn off the fan?
I am reasonably sure that the design of the fan circuit is such that 0 V on the PWM pin will stop it, and 5 V on the PWM pin will set it to run at full speed.
The fact that you actually measured a voltage in excess of 5 V on the PWM pin using a high impedance meter, indicating that its internal pull-up connects to 12 V - as it is a 12 V fan and has no internal 5 V reference - turns out to have no relevance whatsoever and must be ignored. Just connect it to an Arduino PWM output.
It is also the case that the tachometer output is deliberately "open-collector" ("open-drain" for a FET) - it will pull down to zero but will not pull up either to 12 V or anything else. While the fan is designed to operate on 12 V, it is designed to interface to 5 V logic as used in a computer.
@elsmandino like you I was confused. However, I found a white paper by Noctua that cleared up how these pins and internal connections work on 4-pin connectors on PWM fans.
In essence, the PWM pin is pulled high by the fan. If you pull the fan pin low (to ground), then the fan will stop. The magic, however, is on the last page of that white paper.
If you look at the last page of that white paper at the bottom image, you can see that you can operate the PWM duty cycle by simply pulling the fan pin low for a given proportion of a PWM cycle, no high V on the PWM required, so it can be easily implemented using nothing more than a single NPN transistor and an output pin from your arduino on its base.
However, remember that the Arduino's PWM output in such a set up is inverted, so if you are not using a PWM inverting output/mode then a duty cycle of 0% will operate the fan at 100% and a duty cycle of 100% will operate the fan at 0% (off). You will have to adjust your coding accordingly.
Actually that is a Really Bad Idea® for a number of reasons as the article specifically recommends a 5 V PWM control signal from a 5 V CMOS device such as an Arduino output or any 74HC logic chip.
Sorry, @Paul_B , but which article are you referring to? I cannot find any reference to a 74HC logic chip in the Noctua white paper. Also, the last page of the white paper sets out exactly what they say are acceptable solutions (one push-pull and the other a pull-down), so why is the NPN pull-down a bad idea? They are the industry leaders after all.