Shop OBEX P1 Docs P2 Docs Learn Events
Controlling 12V DC Fans — Parallax Forums

Controlling 12V DC Fans

ArchiverArchiver Posts: 46,084
edited 2003-01-27 17:27 in General Discussion
I've been working on a project now to create a fan controller for my computer
using the BS2. While I have figure out how to read the tach with the stamp,
speed control has alluded me. I tried PWM, using one of Al William's Pak
coprocessors and was able to control the fan's speed but failed to get tach
feedback, which in it's place I would get a count of the current pulse rate. I
also heard that PWM causes interference... is this true? I've considered trying
linear control but have failed to get that to work and from what I understand
linear produces excess heat. Any suggestions on how I might best control the
fan's speed and if possible be able to read the tach output as well?

BTW the fans I'm interested in controlling are mainly those standard 80mm X 80mm
case fans, which typically run at 12VDC and usually consume less then 3 watts of
power.

Also I noticed that on the PWM Pak that there is two PWM modes. From the scope
screen shots on Al's web site I see the difference between the two, but I don't
understand in which situation each would be most appropriate, could someone
elaborate this for me?

Any help is much appreciated!

Thanks,
Chris

[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-01-24 17:53
    > create a fan controller for my computer... I have figure out how
    to read the tach with the stamp, speed control has eluded me.

    > standard 80mm X 80mm case fans, 12VDC ...usually consume less than
    3 watts of power.

    Of course if you just want a slower fan, put a 50 ohm 1 watt
    resistor in series with it. Or even wire it to 5V instead of 12V,
    but be aware that as the bearing grease gunks-up it will stall much
    sooner on 5V than on 12V.

    Do you really want to control fan speed, or case temperature?
    Generally you want to stay cool. Who cares how fast a fan spins? It
    is not likely to over-speed and burst like a dive-bomber propeller.
    If it is noisy, try a simple resistor, a diferent fan, put wool or
    foam sound absorption around the PC (leave air-flow), or long cables
    to a PC in another room. While you can slow a fan, you generally
    can't slow a hard drive, which is what you hear after you quiet the
    fans,

    If you do want to control fan RPM:

    Bang-bang it. If the fan is slow, turn it on; if the fan is fast
    turn it off. The self-inertia of a quality PC fan will keep it
    spinning pretty constant. You only need the Stamp, 2 parts, and 12V
    power.

    Get a 500milliAmp NPN transistor and a 470 ohm resistor. Ground the
    transistor Emitter. Connect the transistor Base through the 470 ohm
    resistor to Stamp pin 7. Connect the (-) fan power wire to
    transistor Collector. Connect the (+) fan power wire to +12V power
    supply.

    I don't know what the tach output looks like but I'll assume one
    pulse per turn with enough amplitude to trip the Stamp's inputs. And
    I'll assume 1,000 RPM speed goal.

    Connect the tach output to Stamp pin 0.

    Pseudo-Code--
    (Must be checked for logic errors and translated to PBasic syntax)

    IF PulseIn 0 > 60 milliSeconds ' if less than 1,000 RPM or 16
    revs/second
    THEN
    Make Pin 7 High ' turn transistor and fan ON
    ELSE
    Make Pin 7 Low ' turn transistor and fan OFF
    END IF
    Repeat forever


    > I've considered trying linear control but have failed to get that
    to work

    Not knowing what you tried (a zillion ways to "linear control"),
    can't say what's wrong.

    > linear produces excess heat.

    It wastes the excess power. In many cases this is no big deal. At
    worst in this case, you might be wasting 3 watts, which is not going
    to over-heat the house and is small inside a 100-watt PC. However it
    is large compared to the 0.5W-1W rating of power transistors without
    heatsinks, so it would be nice to either prove the motor can be
    controlled with less than 1W of waste or avoid linear.

    Also, you will have big trouble getting the usual brushless PC fan
    to run at very-low voltage and RPM, because it needs a certain
    minimum voltage to start at all. For super-slow speed you will end
    up running bang-bang mode anyway: up to 5V to get started, rev-up to
    too-fast, drop to 0V to kill speed, repeat. The brushless PC fan is
    not linear at very slow speed, so why try to handle it as a linear
    controller?

    > I also heard that PWM causes interference... is this true?

    With a 12V fan, you have 12V spikes repeating at the PWM rate. Using
    the Stamp-style PWM, this is a few KHz with harmonics well up into
    the AM radio range. Using my bang-bang technique, it might be a
    pulse every second though that will still make ticks in the AM
    radio. For perspective, the whole PC is full of 3V and 5V spikes
    from KHz to GHz which tend to wipe-out radio from AM all the way
    past the TV and cellphone bands. So you have a forest full of
    croaking bullfrogs; if you add one more frog will anybody notice? If
    we must have digital machines, we have to have metal cases to try to
    contain the Smile they radiate. Mostly that works.

    -PRR
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-24 19:35
    Just thought I'd butt in here...when controlling 12V DC stuff with
    the stamp, do you use a separate 12V supply, and run the stamp with
    a 9V battery, and just connect the grounds together so the
    transistor can control it? Or do you just run the stamp on 12 volts?

    Bill


    --- In basicstamps@yahoogroups.com, "paul54reid <preid@r...>"
    <preid@r...> wrote:
    > > create a fan controller for my computer... I have figure out how
    > to read the tach with the stamp, speed control has eluded me.
    >
    > > standard 80mm X 80mm case fans, 12VDC ...usually consume less
    than
    > 3 watts of power.
    >
    > Of course if you just want a slower fan, put a 50 ohm 1 watt
    > resistor in series with it. Or even wire it to 5V instead of 12V,
    > but be aware that as the bearing grease gunks-up it will stall
    much
    > sooner on 5V than on 12V.
    >
    > Do you really want to control fan speed, or case temperature?
    > Generally you want to stay cool. Who cares how fast a fan spins?
    It
    > is not likely to over-speed and burst like a dive-bomber
    propeller.
    > If it is noisy, try a simple resistor, a diferent fan, put wool or
    > foam sound absorption around the PC (leave air-flow), or long
    cables
    > to a PC in another room. While you can slow a fan, you generally
    > can't slow a hard drive, which is what you hear after you quiet
    the
    > fans,
    >
    > If you do want to control fan RPM:
    >
    > Bang-bang it. If the fan is slow, turn it on; if the fan is fast
    > turn it off. The self-inertia of a quality PC fan will keep it
    > spinning pretty constant. You only need the Stamp, 2 parts, and
    12V
    > power.
    >
    > Get a 500milliAmp NPN transistor and a 470 ohm resistor. Ground
    the
    > transistor Emitter. Connect the transistor Base through the 470
    ohm
    > resistor to Stamp pin 7. Connect the (-) fan power wire to
    > transistor Collector. Connect the (+) fan power wire to +12V power
    > supply.
    >
    > I don't know what the tach output looks like but I'll assume one
    > pulse per turn with enough amplitude to trip the Stamp's inputs.
    And
    > I'll assume 1,000 RPM speed goal.
    >
    > Connect the tach output to Stamp pin 0.
    >
    > Pseudo-Code--
    > (Must be checked for logic errors and translated to PBasic syntax)
    >
    > IF PulseIn 0 > 60 milliSeconds ' if less than 1,000 RPM or 16
    > revs/second
    > THEN
    > Make Pin 7 High ' turn transistor and fan ON
    > ELSE
    > Make Pin 7 Low ' turn transistor and fan OFF
    > END IF
    > Repeat forever
    >
    >
    > > I've considered trying linear control but have failed to get
    that
    > to work
    >
    > Not knowing what you tried (a zillion ways to "linear control"),
    > can't say what's wrong.
    >
    > > linear produces excess heat.
    >
    > It wastes the excess power. In many cases this is no big deal. At
    > worst in this case, you might be wasting 3 watts, which is not
    going
    > to over-heat the house and is small inside a 100-watt PC. However
    it
    > is large compared to the 0.5W-1W rating of power transistors
    without
    > heatsinks, so it would be nice to either prove the motor can be
    > controlled with less than 1W of waste or avoid linear.
    >
    > Also, you will have big trouble getting the usual brushless PC fan
    > to run at very-low voltage and RPM, because it needs a certain
    > minimum voltage to start at all. For super-slow speed you will end
    > up running bang-bang mode anyway: up to 5V to get started, rev-up
    to
    > too-fast, drop to 0V to kill speed, repeat. The brushless PC fan
    is
    > not linear at very slow speed, so why try to handle it as a linear
    > controller?
    >
    > > I also heard that PWM causes interference... is this true?
    >
    > With a 12V fan, you have 12V spikes repeating at the PWM rate.
    Using
    > the Stamp-style PWM, this is a few KHz with harmonics well up into
    > the AM radio range. Using my bang-bang technique, it might be a
    > pulse every second though that will still make ticks in the AM
    > radio. For perspective, the whole PC is full of 3V and 5V spikes
    > from KHz to GHz which tend to wipe-out radio from AM all the way
    > past the TV and cellphone bands. So you have a forest full of
    > croaking bullfrogs; if you add one more frog will anybody notice?
    If
    > we must have digital machines, we have to have metal cases to try
    to
    > contain the Smile they radiate. Mostly that works.
    >
    > -PRR
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-24 19:56
    In a message dated 1/24/2003 11:37:19 AM Pacific Standard Time,
    billak@f... writes:

    > Just thought I'd butt in here...when controlling 12V DC stuff with
    > the stamp, do you use a separate 12V supply, and run the stamp with
    > a 9V battery, and just connect the grounds together so the
    > transistor can control it? Or do you just run the stamp on 12 volts?
    >
    > Bill

    Both will work, but running the stamp on 12 volts will result in more power
    dissipated by the stamps 5 volt regulator. If your Stamp will not be sinking
    or sourcing much current, then 12v is ok to run the stamp.
    Power stamp regulator = 12v - 5 volts / Total current used by stamp


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-25 00:39
    I normally run the stamp on it's own power supply separated from the fans,
    but I do tie the grounds together in order to use a transistor.

    Chris

    Original Message
    From: <billak@f...>
    To: <basicstamps@yahoogroups.com>
    Sent: Saturday, January 25, 2003 3:35 AM
    Subject: [noparse][[/noparse]basicstamps] Re: Controlling 12V DC Fans


    > Just thought I'd butt in here...when controlling 12V DC stuff with
    > the stamp, do you use a separate 12V supply, and run the stamp with
    > a 9V battery, and just connect the grounds together so the
    > transistor can control it? Or do you just run the stamp on 12 volts?
    >
    > Bill
    >
    >
    > --- In basicstamps@yahoogroups.com, "paul54reid <preid@r...>"
    > <preid@r...> wrote:
    > > > create a fan controller for my computer... I have figure out how
    > > to read the tach with the stamp, speed control has eluded me.
    > >
    > > > standard 80mm X 80mm case fans, 12VDC ...usually consume less
    > than
    > > 3 watts of power.
    > >
    > > Of course if you just want a slower fan, put a 50 ohm 1 watt
    > > resistor in series with it. Or even wire it to 5V instead of 12V,
    > > but be aware that as the bearing grease gunks-up it will stall
    > much
    > > sooner on 5V than on 12V.
    > >
    > > Do you really want to control fan speed, or case temperature?
    > > Generally you want to stay cool. Who cares how fast a fan spins?
    > It
    > > is not likely to over-speed and burst like a dive-bomber
    > propeller.
    > > If it is noisy, try a simple resistor, a diferent fan, put wool or
    > > foam sound absorption around the PC (leave air-flow), or long
    > cables
    > > to a PC in another room. While you can slow a fan, you generally
    > > can't slow a hard drive, which is what you hear after you quiet
    > the
    > > fans,
    > >
    > > If you do want to control fan RPM:
    > >
    > > Bang-bang it. If the fan is slow, turn it on; if the fan is fast
    > > turn it off. The self-inertia of a quality PC fan will keep it
    > > spinning pretty constant. You only need the Stamp, 2 parts, and
    > 12V
    > > power.
    > >
    > > Get a 500milliAmp NPN transistor and a 470 ohm resistor. Ground
    > the
    > > transistor Emitter. Connect the transistor Base through the 470
    > ohm
    > > resistor to Stamp pin 7. Connect the (-) fan power wire to
    > > transistor Collector. Connect the (+) fan power wire to +12V power
    > > supply.
    > >
    > > I don't know what the tach output looks like but I'll assume one
    > > pulse per turn with enough amplitude to trip the Stamp's inputs.
    > And
    > > I'll assume 1,000 RPM speed goal.
    > >
    > > Connect the tach output to Stamp pin 0.
    > >
    > > Pseudo-Code--
    > > (Must be checked for logic errors and translated to PBasic syntax)
    > >
    > > IF PulseIn 0 > 60 milliSeconds ' if less than 1,000 RPM or 16
    > > revs/second
    > > THEN
    > > Make Pin 7 High ' turn transistor and fan ON
    > > ELSE
    > > Make Pin 7 Low ' turn transistor and fan OFF
    > > END IF
    > > Repeat forever
    > >
    > >
    > > > I've considered trying linear control but have failed to get
    > that
    > > to work
    > >
    > > Not knowing what you tried (a zillion ways to "linear control"),
    > > can't say what's wrong.
    > >
    > > > linear produces excess heat.
    > >
    > > It wastes the excess power. In many cases this is no big deal. At
    > > worst in this case, you might be wasting 3 watts, which is not
    > going
    > > to over-heat the house and is small inside a 100-watt PC. However
    > it
    > > is large compared to the 0.5W-1W rating of power transistors
    > without
    > > heatsinks, so it would be nice to either prove the motor can be
    > > controlled with less than 1W of waste or avoid linear.
    > >
    > > Also, you will have big trouble getting the usual brushless PC fan
    > > to run at very-low voltage and RPM, because it needs a certain
    > > minimum voltage to start at all. For super-slow speed you will end
    > > up running bang-bang mode anyway: up to 5V to get started, rev-up
    > to
    > > too-fast, drop to 0V to kill speed, repeat. The brushless PC fan
    > is
    > > not linear at very slow speed, so why try to handle it as a linear
    > > controller?
    > >
    > > > I also heard that PWM causes interference... is this true?
    > >
    > > With a 12V fan, you have 12V spikes repeating at the PWM rate.
    > Using
    > > the Stamp-style PWM, this is a few KHz with harmonics well up into
    > > the AM radio range. Using my bang-bang technique, it might be a
    > > pulse every second though that will still make ticks in the AM
    > > radio. For perspective, the whole PC is full of 3V and 5V spikes
    > > from KHz to GHz which tend to wipe-out radio from AM all the way
    > > past the TV and cellphone bands. So you have a forest full of
    > > croaking bullfrogs; if you add one more frog will anybody notice?
    > If
    > > we must have digital machines, we have to have metal cases to try
    > to
    > > contain the Smile they radiate. Mostly that works.
    > >
    > > -PRR
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-25 00:58
    Yah the general idea of this project was to reduce the PC's noise output as
    it runs 24/7 with in 5 feet of my bed.

    So based on what you said would it be a better idea just to simple turn the
    fan off when the system is cool and on when it's hot? Cause according to
    what you said it's not always the best idea to run them at a slower speed?

    As for tach output, it's two pulses per turn actually, and they're 12v
    pulses. Hmm your suggestion would work but I want the stamp to be available
    to do other things, such as check temp sensors and output the current stats
    to a serial LCD.

    Hmm... you gave me a lot to think on, I have gotten it to work as a basic
    temp based on and off controller... system is too hot? turn the fan on...
    system cool? turn the fan off.

    Chris

    Original Message
    From: <preid@r...>
    To: <basicstamps@yahoogroups.com>
    Sent: Saturday, January 25, 2003 1:53 AM
    Subject: [noparse][[/noparse]basicstamps] Re: Controlling 12V DC Fans


    > > create a fan controller for my computer... I have figure out how
    > to read the tach with the stamp, speed control has eluded me.
    >
    > > standard 80mm X 80mm case fans, 12VDC ...usually consume less than
    > 3 watts of power.
    >
    > Of course if you just want a slower fan, put a 50 ohm 1 watt
    > resistor in series with it. Or even wire it to 5V instead of 12V,
    > but be aware that as the bearing grease gunks-up it will stall much
    > sooner on 5V than on 12V.
    >
    > Do you really want to control fan speed, or case temperature?
    > Generally you want to stay cool. Who cares how fast a fan spins? It
    > is not likely to over-speed and burst like a dive-bomber propeller.
    > If it is noisy, try a simple resistor, a diferent fan, put wool or
    > foam sound absorption around the PC (leave air-flow), or long cables
    > to a PC in another room. While you can slow a fan, you generally
    > can't slow a hard drive, which is what you hear after you quiet the
    > fans,
    >
    > If you do want to control fan RPM:
    >
    > Bang-bang it. If the fan is slow, turn it on; if the fan is fast
    > turn it off. The self-inertia of a quality PC fan will keep it
    > spinning pretty constant. You only need the Stamp, 2 parts, and 12V
    > power.
    >
    > Get a 500milliAmp NPN transistor and a 470 ohm resistor. Ground the
    > transistor Emitter. Connect the transistor Base through the 470 ohm
    > resistor to Stamp pin 7. Connect the (-) fan power wire to
    > transistor Collector. Connect the (+) fan power wire to +12V power
    > supply.
    >
    > I don't know what the tach output looks like but I'll assume one
    > pulse per turn with enough amplitude to trip the Stamp's inputs. And
    > I'll assume 1,000 RPM speed goal.
    >
    > Connect the tach output to Stamp pin 0.
    >
    > Pseudo-Code--
    > (Must be checked for logic errors and translated to PBasic syntax)
    >
    > IF PulseIn 0 > 60 milliSeconds ' if less than 1,000 RPM or 16
    > revs/second
    > THEN
    > Make Pin 7 High ' turn transistor and fan ON
    > ELSE
    > Make Pin 7 Low ' turn transistor and fan OFF
    > END IF
    > Repeat forever
    >
    >
    > > I've considered trying linear control but have failed to get that
    > to work
    >
    > Not knowing what you tried (a zillion ways to "linear control"),
    > can't say what's wrong.
    >
    > > linear produces excess heat.
    >
    > It wastes the excess power. In many cases this is no big deal. At
    > worst in this case, you might be wasting 3 watts, which is not going
    > to over-heat the house and is small inside a 100-watt PC. However it
    > is large compared to the 0.5W-1W rating of power transistors without
    > heatsinks, so it would be nice to either prove the motor can be
    > controlled with less than 1W of waste or avoid linear.
    >
    > Also, you will have big trouble getting the usual brushless PC fan
    > to run at very-low voltage and RPM, because it needs a certain
    > minimum voltage to start at all. For super-slow speed you will end
    > up running bang-bang mode anyway: up to 5V to get started, rev-up to
    > too-fast, drop to 0V to kill speed, repeat. The brushless PC fan is
    > not linear at very slow speed, so why try to handle it as a linear
    > controller?
    >
    > > I also heard that PWM causes interference... is this true?
    >
    > With a 12V fan, you have 12V spikes repeating at the PWM rate. Using
    > the Stamp-style PWM, this is a few KHz with harmonics well up into
    > the AM radio range. Using my bang-bang technique, it might be a
    > pulse every second though that will still make ticks in the AM
    > radio. For perspective, the whole PC is full of 3V and 5V spikes
    > from KHz to GHz which tend to wipe-out radio from AM all the way
    > past the TV and cellphone bands. So you have a forest full of
    > croaking bullfrogs; if you add one more frog will anybody notice? If
    > we must have digital machines, we have to have metal cases to try to
    > contain the Smile they radiate. Mostly that works.
    >
    > -PRR
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-25 16:41
    Chris:

    Recently I have been working on a project which requires thermal
    managment of enclosed environment utilizing a 12vdc fan. In my
    travels I came across two very inexpensive chips either which are
    targetted to perform exactly what you are looking to do.

    They are a TC646 or MIC502. Both are very inexpensive, rather easy to
    deploy and will pwm the fan and such.

    Hope this helps.

    Dennis

    --- In basicstamps@yahoogroups.com, "Chris Shuster" <cpuman3@h...>
    wrote:
    > I've been working on a project now to create a fan controller for
    my computer using the BS2. While I have figure out how to read the
    tach with the stamp, speed control has alluded me. I tried PWM,
    using one of Al William's Pak coprocessors and was able to control
    the fan's speed but failed to get tach feedback, which in it's place
    I would get a count of the current pulse rate. I also heard that PWM
    causes interference... is this true? I've considered trying linear
    control but have failed to get that to work and from what I
    understand linear produces excess heat. Any suggestions on how I
    might best control the fan's speed and if possible be able to read
    the tach output as well?
    >
    > BTW the fans I'm interested in controlling are mainly those
    standard 80mm X 80mm case fans, which typically run at 12VDC and
    usually consume less then 3 watts of power.
    >
    > Also I noticed that on the PWM Pak that there is two PWM modes.
    From the scope screen shots on Al's web site I see the difference
    between the two, but I don't understand in which situation each would
    be most appropriate, could someone elaborate this for me?
    >
    > Any help is much appreciated!
    >
    > Thanks,
    > Chris
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-27 17:27
    > simple turn the fan off when the system is cool and on when it's
    hot?

    No; I said "If the fan is slow, turn it on; if the fan is fast turn
    it off."

    You could do as you say: on for hot, off for cool. But that would be
    annoying "with in 5 feet of my bed".

    What I said was: if it hits 1001 RPM, turn it off, if it hits 999
    RPM turn it on. (You will have to experiment to find an RPM that
    cools well.) The result is that it hovers around 1000 RPM. And
    unlike trying to run on reduced voltage, this way the fan always
    gets full 12V or zero, no wimpy 3 or 5 volts which may or may not
    work smoothly.

    If you tried this with a REAL fan, couple-horsepower, it would be
    nasty. HRNNNN-coast-HRRNNN-coast. (Why the technique is called "bang-
    bang".) But with the low-power motors and large blades on PC fans,
    there is no big start-up bang and plenty of inertia. It may work as
    I said: just pick an RPM (or a time-between-tach-pulses, which the
    Stamp can do easily) and on/off the motor is it is under/over that
    RPM. If that does sound "twitchy" because it is constantly cycling,
    you might want to add some hysteresis. Simplest is to add a PAUSE
    250 in the loop, so it can't on/off faster than 4 per second.
    The "pretty way" is to have two set-points: ON at 950 RPM, Off at
    1050 RPM, and let mechanical inertia be the delay.

    > I want the stamp to be available to do other things, such as check
    temp sensors and output the current stats to a serial LCD.

    But most "run forever" programs (at least in PBasic) are going to
    have that same "Loop forever" structure. You can check the fan,
    check the temperature, send output to LCD, check for buttons,
    whatever, and loop.

    As long as you are checking temp anyway, your fan set-RPM should be
    a variable that has a minimum, but high temperature will raise that
    set-RPM if things get hot.

    TachRate = 60000
    IF Temp < 100 THEN Skip
    TachRate = 30000 ' speed-up if hot
    Skip:

    As others are pointing out: I didn't really think about the power
    connection and my plan for the switch transistor will not work for a
    fan with common ground for Tach and Motor. You will need another
    transistor or some kind of 250mA switch chip.
Sign In or Register to comment.