Searching \ for 'Need help controlling 12v fan speed with PWM outpu' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/power/batterys.htm?key=12v
Search entire site for: 'Need help controlling 12v fan speed with PWM outpu'.

Truncated match.
PICList Thread
'Need help controlling 12v fan speed with PWM outpu'
1996\11\01@152438 by NEIL GANDLER

flavicon
face
 I am trying to control the speed of a 12 volt .5A fan from
a PWM output of a PIC 16c74 microcontroller. I can vary the
duty cycle of this signal from 0-100% in software. But the
frequency of this PWM signal will vary from 5khz - 15khz
depending on the requirement of the second PWM channel of
PIC, used for another application. I have the following problems.

1. I tried a simple mosfet circuit to switch the fan directly
from the PWM output. But the 5khz-15khz frequency causes a
shrill audio tone to resonate in the fan, which of course is
no surprise. Adding an RC filter into the gate of the IRFZ44
N-Channel MOSFET reduces the whine, yet causes erratic and
undefined speed control if any at all.

2. I want to turn this MOSFET into a voltage controlled
resistor which I would think (correct me if I am wrong) will
eliminate the audio problem but cause losses in the MOSFET,
which wouldn't be a problem. Yet I have no idea how to set up
the circuit.

The bottom line is, I want to be able to control the speed of
this fan from 40% to 100% without the audible whine from this
PWM signal. I need a way to filter the PWM output to provide
a stable output voltage proportional to PWM duty cycle. I
would appreciate any advice.

Neil Gandler

1996\11\05@132239 by Jonathan King

flavicon
face
>   I am trying to control the speed of a 12 volt .5A fan from
> a PWM output of a PIC 16c74 microcontroller. I can vary the
> duty cycle of this signal from 0-100% in software. But the
> frequency of this PWM signal will vary from 5khz - 15khz
> depending on the requirement of the second PWM channel of
> PIC, used for another application. I have the following problems.
>
> 1. I tried a simple mosfet circuit to switch the fan directly
> from the PWM output. But the 5khz-15khz frequency causes a
> shrill audio tone to resonate in the fan, which of course is
> no surprise. Adding an RC filter into the gate of the IRFZ44
> N-Channel MOSFET reduces the whine, yet causes erratic and
> undefined speed control if any at all.
>
> 2. I want to turn this MOSFET into a voltage controlled
> resistor which I would think (correct me if I am wrong) will
> eliminate the audio problem but cause losses in the MOSFET,
> which wouldn't be a problem. Yet I have no idea how to set up
> the circuit.

Matching the FET resistance to the motor may be tricky if this
is for production.  Also, there will be variations over temperature...

The PWM approach is nice because it avoids these issues.

1) try an LC filter on the mosfet DRAIN to filter the PWM pulses.
  The L will have to carry the DC current without saturating, and
  a pole of a couple of hundred hertz should eliminate most of the
  noise.

2) Add an opamp to control the FET voltage with the feedback from the
  FET source.  Use the PWM output, filtered with an RC filter, to provide
  the setpoint.

The inductor for 1) might get rather expensive, making 2) a cheaper alternative

Hope this helps,






> The bottom line is, I want to be able to control the speed of
> this fan from 40% to 100% without the audible whine from this
> PWM signal. I need a way to filter the PWM output to provide
> a stable output voltage proportional to PWM duty cycle. I
> would appreciate any advice.


---------------------------------------------------------------------
Jonathan King                        |   spam_OUTkingTakeThisOuTspamuicc.com
Unitrode Corp.                       |   http://www.unitrode.com
7 Continental Blvd                   |   (603) 429-8715
Merrimack, NH   03054                |   (603) 424-3460

1996\11\05@172515 by optoeng

flavicon
face
NEIL GANDLER WROTE: > >   I am trying to control the speed of a 12 volt
.5A fan from
> > a PWM output of a PIC 16c74 microcontroller...... I have the following
problems.
> >
> > 1. I tried a simple mosfet circuit to switch the fan directly
> > from the PWM output. But the 5khz-15khz frequency causes a
> > shrill audio tone to resonate in the fan....
> >
> > 2. I want to turn this MOSFET into a voltage controlled
> > resistor ......

Jonathan King wrote:
{Quote hidden}

This is not necessary.  For the slow changes in fan speed required by
such applications, it's perfectly all right to filter the FET gate.  You
can use relatively large resistances and small capacitances to achieve
the required (very) low frequency cutoff.  Why not make the cutoff 1 Hz
or so?  You can even use gate capacitance in lieu of a capacitor.

DC motors generally have speed proportional to voltage and torque
proportional to current.  To properly control speed, you should vary
voltage, not current.  Unfortunately, you need 0 to 12V, and the PWM
output is 0-5V.  Using the FET as a variable voltage source is tricky at
best.  Different FETs have much different sub-threshold
transconductances, and this parameter is also highly temperature
dependent.  Even if your ambient temperature doesn't change, the
temperature of the FET surely will!  So, you really should use a 'source
follower' configuration and actually control load voltage.
Unfortunately, this means amplifying the 0-5V PWM output to something
like 0 to 16V! (if you use a Darlington instead, 0 to 14V will suffice).

Instead of a FET, you could consider using a voltage regulator chip in a
configuration where your PWM signal replaces the internal reference.
This also opens up the possibility of using feedback, so that output
device threshold variability doesn't matter so much.  The low forward
drop regulators would permit nearly the full 0 to 12V output range
without requiring a higher supply voltage.  This is a little like
Jonathon's suggestion #2 below.


>
> 2) Add an opamp to control the FET voltage with the feedback from the
>    FET source.  Use the PWM output, filtered with an RC filter, to provide
>    the setpoint.
>
> The inductor for 1) might get rather expensive, making 2) a cheaper
alternative
{Quote hidden}

--

Paul Mathews, consulting engineer
AEngineering Co.
optoengspamKILLspamwhidbey.com
non-contact sensing and optoelectronics specialists

1996\11\05@192035 by Steve Hardy

flavicon
face
> From: NEIL GANDLER <.....V064MB9KKILLspamspam.....UBVMS.CC.BUFFALO.EDU>
>
> The bottom line is, I want to be able to control the speed of
> this fan from 40% to 100% without the audible whine from this
> PWM signal. I need a way to filter the PWM output to provide
> a stable output voltage proportional to PWM duty cycle. I
> would appreciate any advice.

Try using an NPN transistor.  The current gain would be a bit
more predictable than the FET transconductance.  Select a
power transistor with a beta of about 40 (BD139?).  Use 1K/1000uF RC
filter on the PWM output (1 sec time const) and feed the
output of this into the base via a resistor.  A bit of experimentation
should find suitable values.  If you can't saturate the transistor
at full output, turn it into a darlington arrangement.

Regards,
SJH
Canberra, Australia

1996\11\05@213638 by Scott Dattalo

face
flavicon
face
NEIL GANDLER wrote:
>
>   I am trying to control the speed of a 12 volt .5A fan from
> a PWM output of a PIC 16c74 microcontroller. I can vary the
> duty cycle of this signal from 0-100% in software. But the
> frequency of this PWM signal will vary from 5khz - 15khz
> depending on the requirement of the second PWM channel of
> PIC, used for another application.

The last time you asked this question you received many
suggestions. I guess the "experiment" with modulating the
MOSFET's drain-to-source resistance was unsuccessful. Too
bad. However as I said the last time, it really is a power
waster.

The other solution I proposed last time but didn't elaborate
was the idea of using a DC-DC converter as a variable power
supply (Jonathan K. and Paul M. have suggested it again this
time around). And considering:

> The bottom line is, I want to be able to control the speed of
> this fan from 40% to 100% without the audible whine from this
> PWM signal.

(I can't stand whining PWM signals either). Now, 40% of 12 volts
is about 5 volts. This suggests that you could use a 5 volt
to 12 volt boost converter to achieve your bottom line. It's
way beyond the floating scope of the PIC list to discuss the
theory of DC-DC converters. However, let me make one observation
and if you want more details then let me know.

First, DC-DC converters monitor their output voltage and vary
(usually) their switching duty cycle to compensate for errors.
Typically, a simple two-resistor voltage divider samples the
output voltage. Now, there's no reason why you (i.e. the PIC)
can't fool around with the voltage divider to "trick" the DC-DC
converter.

Consider this simple circuit that adds (or subtracts) voltage
to the voltage divider:

from
DC/DC converter
---------------------+-------------------+
                     |                   |
                     \                -------
                     /                | FAN |
                     \ R4             |     |
                     /                -------
                     |                   |
              +------+--> To DC/DC      ---
              |      |    converter     ///
              \      \
              /      /
              \ R2   \ R3
              /      /
              |      |
from           |     ---
PIC's PWM      |     ///
---/\/\--------+
   R1         |
             === C1
              |
             ---
             ///

R3 and R4 form the voltage divider. If R2 were absent,
the output voltage would be constant. R1 and C1 low-pass
filter the PWM signal. In other words, most of the high
frequency stuff is sucked to ground. As you vary the PWM's
duty cycle, you vary the voltage on C1. This in turn
varies the current through R2 which finally varies the
feed back signal to the DC/DC converter.

Other issues to consider, are 1) the effect of the R2,
C1, R1 loading (specifically, it adds a delay to the
feed back path) 2) Response time to PWM signal, 3) output
voltage when there is no PWM signal 4) Calibration (the
PIC is generating an open-loop control; perhaps feedback
is desirable, or is it there already e.g. temperature
signal), Etc.

A really simple DC-DC converter that would work for this
application would be the LT1072. It has the DC-DC converter
and the MOSFET all wrapped up in one device. Digikey sells
them for about 5.50 USD. Also, it can supply the necessary
6 watts when it is configured as a boost converter.

Scott

1996\11\06@113053 by Byron A Jeff

face picon face
>
> NEIL GANDLER wrote:
> >
> >   I am trying to control the speed of a 12 volt .5A fan from
> > a PWM output of a PIC 16c74 microcontroller. I can vary the
> > duty cycle of this signal from 0-100% in software. But the
> > frequency of this PWM signal will vary from 5khz - 15khz
> > depending on the requirement of the second PWM channel of
> > PIC, used for another application.
>
> The other solution I proposed last time but didn't elaborate
> was the idea of using a DC-DC converter as a variable power
> supply
>
> [ DC to DC design deleted ]

Well considering the wattage and the fact that variable voltage will
affect the fan's speed, let me add to the direct voltage control
argument in the form of a PIC controlled variable power supply.

In several projects I've successfully used a LM317 variable voltage
regulator as a programmable power supply. The operation of the part is
simple: the Output voltage is 1.25V higher than the voltage at the
Adjust pin. So by setting the voltage at the Adjust pin, the output voltage
of the part can be controlled.

The logical part for varying the Adjust pin voltage is one of a number
of programmable potentiometers. The Dallas Semi DS1267 is the best example.
The PIC serially programs the correct resistance into the DS1267 and the
DS1267 is used as a voltage divider to select the LM317 Adjust voltage.
The last time I used that arrangement I used a op-amp in unity gain
following to provide the adj pin the proper impeadance. Worked like a
champ.

Hope this helps,

BAJ

1996\11\06@120825 by Martin McCormick

flavicon
face
       How about using a RC filter as several have suggested but feeding the
variable DC voltage in to the + input of just about any garden variety op
amp such as a 741 whose gain  is set to provide an output voltage range
from 0 to 13 volts with a 0-5 volt input.  The op amp's low-impedance output
would drive either a source follower or emitter follower circuit which would
be what actually supplied power to the fan motor.  The only problem is what
to do with the op amp's power supply.  If there is a duel-ended 15-volt supply,
it is almost trivial as long as one does not mind that the negative half
of the operational amplifier's range is never used.  The op amp can be used
with a single-ended supply by providing it with a fake ground at half the
supply voltage.  I would rather have the duel-ended supply up front than
to have to mess with the resistive divider net on each amplifier, but that's
just my opinion and worth just what you paid for it.

Martin McCormick WB5AGZ  Stillwater, OK 36.7N97.4W
OSU Center for Computing and Information Services Data Communications Group

1996\11\06@181652 by Tony Matthews

flavicon
face
Martin McCormick wrote:
>
>         How about using a RC filter as several have suggested but feeding the
> variable DC voltage in to the + input of just about any garden variety op
> amp such as a 741 whose gain  is set to provide an output voltage range
> from 0 to 13 volts with a 0-5 volt input.  The op amp's low-impedance output
> would drive either a source follower or emitter follower circuit which would
> be what actually supplied power to the fan motor.  The only problem is what
> to do with the op amp's power supply.  If there is a duel-ended 15-volt
supply,
> it is almost trivial as long as one does not mind that the negative half
> of the operational amplifier's range is never used.  The op amp can be used
> with a single-ended supply by providing it with a fake ground at half the
> supply voltage.  I would rather have the duel-ended supply up front than
> to have to mess with the resistive divider net on each amplifier, but that's
> just my opinion and worth just what you paid for it.
>
> Martin McCormick WB5AGZ  Stillwater, OK 36.7N97.4W
> OSU Center for Computing and Information Services Data Communications Group
I to wondered why a power op_amp could not be used with an r/c
integrator
on the non inverting input "high impedance" and a voltage divider for
the
inverting input or even just a darlington instead of the op_amp . No
feedback was
mentioned "I think" so have fun. Tony M.

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...