3 pin pc fan control via mosfet

I want to remind. that I asked specifically about the 3pin fan, because… 4pin is more expensive + it cannot be completely stopped. I just didn’t find a 3pin fan for the program in which the circuit was drawn)

Your diode is in right place, but you are making short circuit like that. Look at the arrow in the image I posted.

1 Like

Put a link or specs of your fan, so it’s clear.

The most common 12v / 120mm PC fans. There are weaker ~1000 rpm (0.12A), there are faster ones at 2000 rpm. (0.19A and 0.33A).

Ok, so if you don’t need speed control, you can go with relay.
If you need, you can use mosfet module that I showed before
or BC337 wired like your actual mosfet (but with ~500ohm resistor to base)
0.33A motor would be at the borderline to go with BC337

I just saw where both the module and the relay are used together, they write a script that when the speed is 0%, the relay triggers and completely turns off the power (I just don’t want my windings to burn out).

I have BC337 (~25%on / 75%off) controlled fan running three years without any problems.

For sure with NON logic level mosfet there are problems, it’s not meant to switch on/off but something between.

Well, I ordered lr7843 as you advised. If can’t turn it off completely, it doesn’t matter, the main thing is that you can turn on almost minimum speed so that it doesn’t interfere with sleep at night. =)

There are limits how low you can make it run. You also need to find sweet spot for pwm frequency.

Hello. Today the LR7843 modules arrived to me. What shim frequency would you recommend specifying in the firmware? The fan is still quite noisy/squeaking at low speeds. A 100mkf capacitor improves the situation a little. I’m glad that when you press turn off, only about 0.6V goes to the fan, which I think will not damage the windings.

By the way, I noticed that generating PWM loads the esp8266 quite heavily, I planned to hang at least 2-3 fans on it + 2-3 Dallas temperature sensors + I also wanted to read the speed of these fans.

I don’t know your fan, but I would expect 25-35Hz, try 32 to start with.
What you mean “loads the esp8266” ?

What is that actually?

I have never seen any fan indicate the frequency, usually voltage and amperes. This is probably the 10th time I’ve written this, this is a regular 3pin fan for a computer.

esp behaves inappropriately, it can take a very long time to respond to requests, for example, you press to turn off the fan, and this happens after about 3 seconds, this is especially noticeable when esp counts the fan speed.

What, you don’t know what a 100 microfarad polar capacitor is??? In the very first message I drew it on a scheme.

Do I have to remember what you wrote 10 days ago???
There is not specific frequency for “no pwm wire” fan. On computer they are driven with very low frequency, below audible.

Pwm shouldn’t be any problem to esp resources, counting the fan speed yes.

More less I know, if it’s written μF or even uF, but I had doubts with mkf.
Anyway, it’s frequency dependent and 100uF is quite high, I would guess 100nF

Whoever finds this topic, drop this idea. Buy fans with PWM wire and that’s it. So much nerves, time wasted and money wasted. No modules or mosfets will help, although they partially work.

I bought myself two ID-COOLING PWM Series [AS-120-K] fans; they can change the speed from 300 to 2000 rpm and are quite quiet, you don’t even need to turn them off completely. The only thing I added was to turn on the internal pull-up of the PWM wire, otherwise the revolutions would not be read.

Almost got it working :slight_smile:

It seems the BC337 isn’t the best choice… It works when the fan is set to a high speed. For example; setting fan-speed to 100% en switching the BC337 will stop the fan.

But, when (for example) the fan is running at 25% speed, the fan keeps spinning after swtichting the BC337. At 50%, the fan will keep spinnjg up and down while the BC377 is set to off.

If I understand correcltly, the difference in current may be too small for the BC337 to switch when the fan is set to a low RPM.

Am I right? If so, what can I do to fix this?

Weird, never faced a problem like that.
First check your transistor is not mounted reversed.
Control that base pulldown is ok.
Disconnect tach signal from Esp.

Reversing the BC337 results in bad behavior. The fan ‘squeezes’, spins up and down, and even reverse when the switch is turned off…

I disconnected the tach-signal.

Here’s a part of my schema:

Screenshot from 2024-08-06 16-22-15

U6=500 (instead of 13.3k)

and relevant part of the yaml:

switch:
  - platform: gpio
    pin: D7
    id: "BCswitch"
    name: BCswitch"

output:
  - platform: esp8266_pwm
    pin:
      number: GPIO14
      mode: 
        output: true
        open_drain: true 
    frequency: 25000 Hz
    id: pwm_output

fan:
  - platform: speed
    output: pwm_output
    name: "Living Room Fan"

Your circuit presented can’t even work, base resistor 13.3k is higher than pulldown 10k, so transistor is always off.

Edit: I saw your correction 500

1 Like

Sorry for the confusion. It’s a 500 ohm transistor…

The schema displays a 13.3k resistor as I needed the correct footprint :slight_smile:

I just cant understand that behavior, transistor surely have small leakage, but it’s temperature related, not that it’s leaking more when current is low…
Did you try to disconnect transistor pin from esp when misbehavior occurs?