# Fan PWM driver - design question

I've been working on crating a simple PWM fan driver for my Raspberry Pi. To simply explain idea - I get 3 pin input (1 - PWM, 2 - 5V, 3 - GND), then using RC filter I turn PWM signal into voltage and feed it into positive side of OpAmp. Then output drives MOSFET which in turn works essentially as variable resistor controling fan speed (M1 motor on schematic).

My (newbie) questions are:

• PWM signal is 3.3V, is there a way to make OpAmp output do full 0-5V without adding additional OpAmp to scale it up?
• How should I protect circuit from effects that fan might have? It's an inductive load after all.
• And probably most important - am I missing something obvious to people who know what they are doing?

On the side note, speciafic OpAmp and MOSFET I will choose later, but I was thinking about rail to rail opamp that works in 0-5V range and for MOSFET I will use some TTL level one.

Also, C1 is planned to be 1uF

I'm confused why you would want to convert your PWM signal into a very inefficient linear driver. PWM divers are used to efficiently modulate the power directly to the motor with minimal losses in the switch gear.

The following circuit would be typical..

simulate this circuit – Schematic created using CircuitLab

PWM motor drivers of this type do the integration you performed with R1 and C1 using the inductance and inertia of the motor itself.

If you need tighter speed control you can, with appropriate timing, you can feed back the voltage at the top of the MOSFET, suitable scaled, to the micro and have the latter measure the back-EMF and hence the motor speed.

EDIT:

Switching a BDLC fan at high frequencies can however be problematic, and as you have indicated, and can be noisier that a linear drive.

In that case the principal of your circuit is ok as long a the time constants of the integrator is sufficient.

However: The way you have the MOSFET connected means you can never drive the fan with anything greater than Vcc - Vth (The threshold voltage of the MOSFET.)

As such it would be more appropriate to invert the amplifier and use a P-MOSFET instead. Something like the schematic below.

Notice I also changed the feedback on the op-amp to change it from a voltage follower into to a positive gain amplifier to convert your 3.3V signal to a full 5V signal.

BE AWARE: The OP-AMP needs to be rail-to-rail on inputs and outputs.

simulate this circuit

• Idea behind using linear drive instead of PWM was that PWM drive inheritantly causes a lot of noise on power lines which I wanted to avoid. Commented Jan 12, 2018 at 10:53
• @Migol fair enough. See my answer edit. Commented Jan 12, 2018 at 16:14
• I managed to figure out adding resistors to single opamp a bit earlier before your answer, but you are right with driving voltage. Thanks for your extensive help! Commented Jan 12, 2018 at 18:26
• BTW, since unlike me you seem to know what you're doing, any tips for choosing opamp and MOSFET? Commented Jan 12, 2018 at 19:28
• As I said mosfet needs to be rail to rail but does not need to be high frequency. MOSFET needs to be low RDSON with a Vgs threshold around 1-2V. Since it will be operating in linear mode, it will get hot, so a TO220 package with a heat-sink is prudent. Other than that I don't recommend actual parts, sorry, too many bad experiences with that. Commented Jan 12, 2018 at 19:33

BLDC fan motor current is internally commutated over a wide RPM range and this may experience IM or aliasing problems with PWM applied to supply current as opposed to those fans designed for this.

That is what I found , so I opted to make a thermistor to Voltage controlled fan speed control. Your analog loop control may be better If ripple aliasing can be prevented.

• True enough, high frequency PWM of an integrated BLDC can be problematic. Commented Jan 12, 2018 at 1:32
• About this: "high frequency PWM of an integrated BLDC can be problematic" ... six years later I posted this question: electronics.stackexchange.com/questions/399677/… where I asked precisely about what the dangers of driving DC brushless fans with PWM. Any information would be most appreciated! @Trevor_G Commented Oct 6, 2018 at 16:45