Help with comparator design

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
trident
Posts: 23
Joined: Wed Aug 20, 2008 3:30 pm
Location: Indiana, USA
Contact:

Help with comparator design

Post by trident » Mon Dec 29, 2008 5:12 pm

My goal for this project is to control a thee wire brushless fan with the PWM signal from a four wire fan header. I have looked at number motherboards and discovered implementation the control signal varies. The INTEL specification is mute on a logic hi value, but requires a maximum logic low of 0.8 volts. The fan header is required to sink up to 5 mA and the signal must be pulled up on the fan side, 3.3 volts is recommended. The control signal must be 25kHz, but it can be 3.3 or 5 volt TTL logic. To overcome this, a comparator with a threshold of 2 volts looks like a viable solution. With a comparator, a fixed amplitude square wave to the low pass filter is possible and allows for an amplifier with fixed gain. At present, I have been unable to find information on op-amp comparator design. The 1 Meg ohm feedback resistor is best guess. How much feedback would give optimum function? The null resistor, R9 is also also best guess at this point. I would appreciate constructive criticism to correct omissions or departure from good design practice. Thank You.

Best regards,
trident

Image

User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl » Tue Dec 30, 2008 12:48 am

Hello,

Here are some points...

[1]
The LM358 can not slew fast enough to keep up with a 25kHz
square wave, let alone a PWM with low or high duty cycle.
Either the ic has to be changed or the frequency lowered.
Comparator LM339 instead of LM358 would work better and
this should work for the second ic section too. Of course
then the outputs need pullups, maybe 4.7k each.

[2]
With 3.3v high and 0.8v low inputs, the average is 2.05v
so 2.00v is a decent choice for the center target voltage.
With 2.00v as the center, a 100k feedback resistor would
provide about 0.5v total hysteresis, tripping at 1.7v low
and 2.2v high. Thus, R2=100k is a good choice.
Of course this assumes that your input slews fast enough
and it probably does if its source is a logic gate.

[3]
For better stability, add a 0.01uf cap across R7.
Also, R9 doesnt need to be that high. 220k is ok
or even 100k is fine.
LEDs vs Bulbs, LEDs are winning.

sghioto
Posts: 319
Joined: Wed Dec 26, 2007 5:16 pm
Location: N. Florida
Contact:

Post by sghioto » Tue Dec 30, 2008 8:24 am

trident,

Something doesn't sound right here. Can you or someone else explain to me why you are trying to control a three wire fan with a four wire header?

Steve G.

trident
Posts: 23
Joined: Wed Aug 20, 2008 3:30 pm
Location: Indiana, USA
Contact:

Post by trident » Thu Jan 01, 2009 3:43 pm

Hello, sghioto

The INTEL initiative is all well and good for motherboard designers, it eliminates the need for high current output transistors on fan headers. Many of the newer motherboards now only support four wire fans for the CPU. However if you are a person who wants you PC to be seen and not heard, there are presently many three wire fans in the market to pick from with low acoustic signatures, not so with four wire fans.

Regards,
trident

sghioto
Posts: 319
Joined: Wed Dec 26, 2007 5:16 pm
Location: N. Florida
Contact:

Post by sghioto » Thu Jan 01, 2009 6:15 pm

trident,

Thanks for the explanation. So if I understand correctly, you are trying to convert the PWM signal from the mother board to a variable DC voltage to drive the three wire fan. What is the minimum DC voltage required before the fan stalls? Are you using the "tach" output for any kind of feedback or control and do you have a working circuit?

Steve G.

User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl » Fri Jan 02, 2009 8:56 am

MrAl wrote:Hello,

Here are some points...

[1]
The LM358 can not slew fast enough to keep up with a 25kHz
square wave, let alone a PWM with low or high duty cycle.
Either the ic has to be changed or the frequency lowered.
Comparator LM339 instead of LM358 would work better and
this should work for the second ic section too. Of course
then the outputs need pullups, maybe 4.7k each.

[2]
With 3.3v high and 0.8v low inputs, the average is 2.05v
so 2.00v is a decent choice for the center target voltage.
With 2.00v as the center, a 100k feedback resistor would
provide about 0.5v total hysteresis, tripping at 1.7v low
and 2.2v high. Thus, R2=100k is a good choice.
Of course this assumes that your input slews fast enough
and it probably does if its source is a logic gate.

[3]
For better stability, add a 0.01uf cap across R7.
Also, R9 doesnt need to be that high. 220k is ok
or even 100k is fine.
Hi again Trident,

Did those comments help any with your circuit? You see there
are a few problems right?

Take care...
LEDs vs Bulbs, LEDs are winning.

Bigglez
Posts: 1282
Joined: Mon Oct 15, 2007 7:39 pm
Contact:

Re: Help with comparator design

Post by Bigglez » Fri Jan 02, 2009 11:42 pm

trident wrote: My goal for this project is to control a thee wire brushless fan with the PWM signal from a four wire fan header.
So your interface converts the PWM to a DC high current?
trident wrote: I have looked at number motherboards and discovered implementation the control signal varies.
Meaning the signal form the MoBo to
the fan, or the rotation detect signal from the fan to the MoBo?

Why not apply the PWM signal (form the MoBo) to a
MOSFET switch and a local 12V rail, that pulses the fan?
The inertia of the fan will intergrate the PWM signal.
A capacitor across the fan motor will eliminate the 25KHz.

trident
Posts: 23
Joined: Wed Aug 20, 2008 3:30 pm
Location: Indiana, USA
Contact:

Post by trident » Sun Jan 11, 2009 7:29 pm

Bigglez
The PWM signal varies, some use 5 volt logic others use 3.3 volt logic and I found one that uses 4 volts as logic high. One of the first designs I experimented with is similar to what you describe (see schematic), but it has a serious shortcoming, at some speed settings the fan will "sing" with vibration. I am guessing that it may be harmonic interaction with motor driver chip in the fan and the PWM signal. Since my objective is low noise, I discarded it.
Image

sghioto
Yes that is the goal. No I do not have a working design as yet. Most 12 volt brushless fans will stall below 5 volts. The tachometer signal will go to the motherboard for hardware monitoring.

MrAl
Thank you for for the recommendations to improve the design. Due to economic necessity, I will be using Stripboard for this project. Adding the LM339 with pull-ups and termination for unused channels increased the board area required and I would like to minimize size as much as possible, my original reason for choosing the LM358. I reworked the circuit using a resistor network threshold detector and discrete transistors for the amplifier. I am unsure how much drive Q2 will need, can I increase the value of R4? As always, your comments and mentoring appreciated.

Best regards,
trident

Image

Bigglez
Posts: 1282
Joined: Mon Oct 15, 2007 7:39 pm
Contact:

Post by Bigglez » Sun Jan 11, 2009 9:21 pm

trident wrote: The PWM signal varies, some use 5 volt logic others use 3.3 volt logic and I found one that uses 4 volts as logic high.
To get a clean signal from variety of inputs requires
some signal conditioning. You can go simple or go
complex to resolve this problem. Are you willing to
have a preset resistor in the solution to allow
adjustment on a case by case basis?
trident wrote: One of the first designs I experimented with is similar to what you describe (see schematic), but it has a serious shortcoming, at some speed settings the fan will "sing" with vibration. I am guessing that it may be harmonic interaction with motor driver chip in the fan and the PWM signal. Since my objective is low noise, I discarded it.
Have you experimented with running the fan from variable
DC? Perhaps the noise issue is only the fan? Or, as you
said, the type of PWM drive from the MoBo is critical.

The schematics presented have asymmetrical charge
and discharge times for the intergrator cap. This might
be the source of the problem, and is easily fixed with a
different circuit arrangement.

The correct circuit is an PM detector, if it is also an AM
detector (i.e. responds to input signal amplitude) you
could well be picking up other noise. PCs are notoriously
noisy due to high current, high speed, logic demands.

User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl » Sun Jan 11, 2009 9:37 pm

trident wrote:
MrAl
Thank you for for the recommendations to improve the design. Due to economic necessity, I will be using Stripboard for this project. Adding the LM339 with pull-ups and termination for unused channels increased the board area required and I would like to minimize size as much as possible, my original reason for choosing the LM358. I reworked the circuit using a resistor network threshold detector and discrete transistors for the amplifier. I am unsure how much drive Q2 will need, can I increase the value of R4? As always, your comments and mentoring appreciated.

Best regards,
trident

Image

Hi again Trident,

I was telling you before you might want to use an LM339, but there
is also the LM393 which is the same package size as the
LM358 only it has a faster response.
If you still want to go with a discrete circuit i'll look into it more
carefully a bit later.

Take care...
LEDs vs Bulbs, LEDs are winning.

sghioto
Posts: 319
Joined: Wed Dec 26, 2007 5:16 pm
Location: N. Florida
Contact:

Post by sghioto » Mon Jan 12, 2009 5:18 am

trident,

I don't see why it's necessary to use a comparator. Since the PWM signal is converted to DC in the low pass filter all you need is buffering and an amplifier.

Steve G.
Image

Bigglez
Posts: 1282
Joined: Mon Oct 15, 2007 7:39 pm
Contact:

Post by Bigglez » Mon Jan 12, 2009 10:56 am

sghioto wrote:trident,

I don't see why it's necessary to use a comparator. Since the PWM signal is converted to DC in the low pass filter all you need is buffering and an amplifier.
Why not include that Sziklai pair in your op amp feedback? (Connect the 33k to the 2N3904 emitter).

trident
Posts: 23
Joined: Wed Aug 20, 2008 3:30 pm
Location: Indiana, USA
Contact:

Post by trident » Mon Jan 12, 2009 11:08 am

Hello Bigglez
You have framed the problem well, what I require is a circuit that detects the duty cycle of the PWM signal and ignores the amplitude. Ideally it will give a 12 volt DC output for 100% duty cycle. My desired output range is 5 to 12 volts to the fan, assuming that the output is proportional, 0% duty cycle equal 0 volts, the detector must be fast enough to respond down to approximately 40% duty cycle. I would much prefer an install and forget solution to a one that requires tuning to a specific motherboard. I would like to keep the board size in the 100mm x 50mm range without resorting to a custom PC board. I do not have the equipment to produce one and cannot at present justify the cost of contracting the work.
The fan in question behaves very well with variable DC, weather it is from my bench supply or a ZALMAN FAN MATE 2 powered from the PC. Researching data sheets from Rohm and Sanyo, some motor driver chips inside the fan are using an on chip PWM generator to control the armature transistors and this may explain the behavior I found or it could be that brushless fans are inherently a pulse controller and a harmonic is exciting the natural resonate frequency of the mechanical assembly. what ever the cause, it is an undesired behavior.
Please explain about the asymmetrical charge/discharge and possible solutions

Hello sghioto
when I started this project I had an ABIT motherboard that used 5 volts for logic hi in the PWM signal. The original circuit was a low pass filter and an amplifier configured with a gain of 4.0. It did control the fan, but with a considerable loss of span. The fan speed did not reduce untill the duty cycle was less than 62%. I set the amplifier gain at 2.4 and all was well. When I upgraded to a Core 2 CPU, the MB was replaced with an INTEL board, it uses 4 volts for logic hi. Since the circuit is still on breadboard it takes little effort to change resistor values to adjust the gain for a 12 volt output. As Bigglez suggested, I want a circuit that ignores the amplitude and only responds to the duty cycle of the control signal. This project has yet to be incorporated into my PC. I am currently using an ARTIC COOLING brand four wire fan on the CPU heat sink. I believe it is manufactured by ADDA for ARTIC COOLING. While it looks to be a high qulity fan, it is not as well optimized for low noise as say the Nidec Servo "Gentle Typhoon" currently being distributed by SCYTHE. To my knowledge they are not available in four wire variant as this would be an ideal solution.

Regards
trident

sghioto
Posts: 319
Joined: Wed Dec 26, 2007 5:16 pm
Location: N. Florida
Contact:

Post by sghioto » Mon Jan 12, 2009 12:09 pm

trident,
If the level of the PWM signal is set by the MB then I see two options. Rearrange the circuit with the amplifier up front with a gain of four. The output will be limited by the 12 volt supply. Or you could use a comparator with say a 2.5 volt reference. The variable DC output is controlled by the duty cycle of the PWM and possibly regulated by the tach signal.

Steve G.

Image

Bigglez
Posts: 1282
Joined: Mon Oct 15, 2007 7:39 pm
Contact:

Post by Bigglez » Tue Jan 13, 2009 1:17 am

trident wrote: what I require is a circuit that detects the duty cycle of the PWM signal and ignores the amplitude.
...
I would much prefer an install and forget solution to a one that requires tuning to a specific motherboard.
...
The fan in question behaves very well with variable DC, weather(sic) it is from my bench supply or a ZALMAN FAN MATE 2 powered from the PC.
...
Please explain about the asymmetrical charge/discharge and possible solutions
Okay, I think we have a target spec (including physical
details and costs). As the drive signal from the MoBo is
a PWM logic signal you should be able to extract the
data with a simple schmitt trigger (possibly in a logic
gate as part of a multi-gate package). Typically these
operate at 50% of the supply rail and have hysteresis,
but are fast enough to get clean edges at 25kHz.

To get a DC average from the PWM signal an intergrator
circuit is used. Ideally this should react equally to the
on and off periods of the PWM signal, and follow any
changes made by the MoBo. For example, if the fan
were either off or idling, and the demand goes to 100%.
Or, the opposite, the fan is at 100% and the demand
abruptly drops to low or off (stopped). In both these
cases the fan power should change at the same rate.

As the fan has a tachometer feedback to the MoBo the
closed loop system (Mobo PWM to fan DC to fan tach
to MoBo detection) has two or more loops inside the
main one. It could well be that these are unstable and
cause the fan's speed to oscillate and cause the noise
that you reported.

I noticed that earlier diagrams has different time
constants for the on and off portion of the PWM signal,
and that in turn would likely upset the overall loop.
Just a hunch (from the school of hard knocks).

Once you have a clean signal from the front end of your
circuit you can apply this to an intergrator and manipulate
the resulting DC to a range and power level to suit
the fan. I think some of the latter diagrams are almost there!

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests