EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: josr on September 24, 2020, 04:07:59 pm

Title: 4 Wire Arduino PWM Fan keeps running when OFF via Tacho pin.
Post by: josr on September 24, 2020, 04:07:59 pm
Hello,

I have a problem with a 4 wire PWM fan which I want to drive using an Arduio.

Everything works fine (including Tacho measuring), however in SOLUTION 1, when I turn off the FAN (via the mosfet), the fan keeps running on a low RPM (5-10%) via the Tacho pin. When I disconnect the Tacho pin from the Arduino it stops. The Pull Up Resistor at the tacho pin does not matter. It does matter for measuring the interrupts, but for the "it-keeps-running" problem it does not matter I remove it, or I make it a pull down resistor or keep it pull up.

When I switch to solution 2 (Relay on VCC), that works great. However I do not want a Relay.

So I came up with Solution 3. However this is entirely not working (fan does not start).

Why does in Solution 1 the fan not stop? Is there any way I can get solution 3 working?

(https://i.ibb.co/HxHknVD/fan.png)
Title: Re: 4 Wire Arduino PWM Fan keeps running when OFF via Tacho pin.
Post by: DrG on September 24, 2020, 05:15:42 pm
I also saw this with a 4-wire PC fan that I was using for something else.

You may want to look here https://www.eevblog.com/forum/beginners/fan-controller-circuit-with-an-op-amp-and-a-led/msg3178298/#msg3178298 (https://www.eevblog.com/forum/beginners/fan-controller-circuit-with-an-op-amp-and-a-led/msg3178298/#msg3178298)
User @Renate was kind enough to post the standard. That it never turns off completely using the PWM pin may be intentional.

The relay method certainly makes sense.


As for #3, and even #1, since you don't know the switching circuitry inside the fan, it may not be so easy (as you found out) to use a MOSFET. I will leave others who know more to suggest how that might be done.

Edit. For #1, are you connecting the fan ground and the Arduino ground? Also, as per your title...the PWM pin, not Tach pin is what you meant - right?
Title: Re: 4 Wire Arduino PWM Fan keeps running when OFF via Tacho pin.
Post by: pqass on September 24, 2020, 06:06:58 pm
You've got the wrong approach.  Leave Vcc and GND permanently connected and use the PWM input at 0% duty cycle to turn off and at 100% to turn on.  PC fans usually have TTL friendly input and the tach output is open collector.


See first answer here: https://electronics.stackexchange.com/questions/153846/arduino-how-to-read-and-control-the-speed-of-a-12v-four-wire-fan (https://electronics.stackexchange.com/questions/153846/arduino-how-to-read-and-control-the-speed-of-a-12v-four-wire-fan)

Also see first message with schematic: https://www.raspberrypi.org/forums/viewtopic.php?t=236017 (https://www.raspberrypi.org/forums/viewtopic.php?t=236017)


The internal circuitry of the fan is more complex than a simple two terminal DC fan so disconnecting the GND will just mean the internal circuitry may be powered by some other input pin.
Title: Re: 4 Wire Arduino PWM Fan keeps running when OFF via Tacho pin.
Post by: DrG on September 24, 2020, 06:35:31 pm
You've got the wrong approach.  Leave Vcc and GND permanently connected and use the PWM input at 0% duty cycle to turn off and at 100% to turn on.  PC fans usually have TTL friendly input and the tach output is open collector.

No, that is incorrect. Let me explain. I'm not sure what the OP is doing and we will have to wait until he responds. But, based on my own experience with this fan (b-PWM90 https://www.bgears.com/b-pwm/ (https://www.bgears.com/b-pwm/)) and others, it does NOT turn off completely when the PWM pin is at GND (equivalent to PWM=0 %). Yes, you can get effective speed control at various PWM percentages, but not at the very low end.

That was what I was getting at and why I made a reference to the other thread and the PC Fan 4 wire standard (see section 3.4 as I mentioned).

My interpretation is that it is intentional and it is within the standard. That is, when power is applied to a PC board, it may be an advantage to have the fan running at some minimal level at the least.

The OP may be confused about the tach pin which is sending a pulse frequency relating rpm TO the controller. As I recall, this is from 2 or 4 magnets on the fan mount and a hall effect sensor.

They "should" be logic level (5.0 or 3.3) connections but data on the fan itself should be consulted. I use something like this and it works fine:

(https://www.eevblog.com/forum/beginners/4-wire-arduino-pwm-fan-keeps-running-when-off-via-tacho-pin/?action=dlattach;attach=1073702)

...and...if I need the fan to be completely off, a relay, but I don't have much call for that and I don't know what MOSFET configuration to use (too lazy / ignorant). You do need to connect the fan GND and the Arduino GND - at least that is my thinking and experience.

Correct away and maybe I will learn more.

Title: Re: 4 Wire Arduino PWM Fan keeps running when OFF via Tacho pin.
Post by: pqass on September 24, 2020, 07:09:05 pm
Solution 3 doesn't work because he is using an n-channel mosfet that needs 10V above the source pin to fully turn on.

To make solution 3 work you'd need to replace the IRL540 with a logic level p-channel mosfet or a pnp power transistor (and 1k base resistor) rated appropriately for the fan current and working voltage.   That will guarantee 0RPM.

Correction: if Arduino Vcc and fan Vcc are not the same then you'd need to front the pnp bjt or p-channel mosfet with an npn or n-channel mosfet.   See schematic:  https://learn.sparkfun.com/tutorials/constant-innovation-in-quality-control/the-high-side-switch

Title: Re: 4 Wire Arduino PWM Fan keeps running when OFF via Tacho pin.
Post by: josr on September 25, 2020, 05:40:31 am
To make solution 3 work you'd need to replace the IRL540 with a logic level p-channel mosfet or a pnp power transistor (and 1k base resistor) rated appropriately for the fan current and working voltage.   That will guarantee 0RPM.

I really want to UNDERSTAND why "cutting off"" GND via MOSFET does not work (solution 1), and "cutting off" VCC does work (solution 2 via Relay or P Mosfet)?  Indeed the Fan VCC=12V and Arduino is 5/3.3V.
Title: Re: 4 Wire Arduino PWM Fan keeps running when OFF via Tacho pin.
Post by: viperidae on September 25, 2020, 06:25:59 am
Cutting off ground can mean current can flow to ground via the other connections, which can cause damage.
Title: Re: 4 Wire Arduino PWM Fan keeps running when OFF via Tacho pin.
Post by: pqass on September 25, 2020, 07:15:17 am
To make solution 3 work you'd need to replace the IRL540 with a logic level p-channel mosfet or a pnp power transistor (and 1k base resistor) rated appropriately for the fan current and working voltage.   That will guarantee 0RPM.

I really want to UNDERSTAND why "cutting off"" GND via MOSFET does not work (solution 1), and "cutting off" VCC does work (solution 2 via Relay or P Mosfet)?  Indeed the Fan VCC=12V and Arduino is 5/3.3V.

If fan pwm/tach pins have clamping diodes (or if the tach output is a mosfet; its body diode) then the voltage from the Arduino pin (either 0v or 3.3/5v) can flow through the diode to the internal [disconnected] GND and power the load.  See attached schematics.