Electronic – Fan PWM driver – design question

fanmosfet-driverpwm

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

Schematic

Best Answer

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..

schematic

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.

schematic

simulate this circuit