Having trouble with comparator with hysterisis

SgtWookie

Joined Jul 17, 2007
22,230
What size are you using for RH now?

Your TIP3055 is drawing lots of current through it's base. That's why I suggested using the IRF510 to begin with. The TIP3055 only has a gain of 70; that is for 1mA of base current, you get 70mA out. Your comparator is capable of SINKING up to 20mA. With RH of 220K and a 1K resistor from V+ to the output of the comparator and nothing else, the 1k resistor has about 11mA of current flowing through it, and the comparator is sinking most of that.

If you put a 1.5K resistor between the comparator output and the base of the TIP3055, that limits the current the base can draw. However, that also screws up the hysteresis, because it changes the voltage divider network drastically.

In order to fix the problem, you either need to use the driver circuit that I put up last time and fix the RH, or go back to the 2nd version of the original solution with the MOSFET, the 220K RH and the 1k resistor to the comparator output.

Note that if you INCREASE the value of RH, your hystersis will DECREASE.

If you change the value of the 1K resistor on the output of the LM339, it will drastically affect the rest of the RH feedback.

The resistor network on the input side of the LM339 also has a strong impact on hysterisis, along with the voltage level the comparator trips at. If you've used values that are different from what I have in the schematic I made up, you should tell me - otherwise, I won't be able to help you pinpoint the problem.

See the latest version attached, using a PNP transistor driver for your TIP3055 transistor's base. The MOSFET would still be a better solution, but sometimes you need to go with what you have, or what you know.

If you decide to use the PNP driver circuit, and you use something else than the specified transistor, let me know. I chose that particular transistor because it's commonly available, inexpensive, has high gain, and carries a fair bit of current.
 

Attachments

nomurphy

Joined Aug 8, 2005
567
The LM339 is a quad comparator, it may be easier just to use what you have (see attached).

V2 is your input, R7 is the relay coil (as low as 50 ohms with given values), and R2/R3 can be replaced with a 10K pot.

Also, don't forget to ground the inputs of the two unused comparators to keep them from causing any issues.
 

Attachments

Thread Starter

Alvin

Joined Jan 22, 2008
22
arrgh.. I appreciate everyones help so far. I got the circuit working like I want but as the computer commands the fan off (thats what i'm doing) it gives it a couple quick burst of voltage on the signal side..

This causes the relay to chatter for about 2 seconds.. .. Its incredibly annoying and I'm not sure what to do to fix it..

Does anyone know how to add enough damping to the input to not let this happen?
 

SgtWookie

Joined Jul 17, 2007
22,230
Remember the small capacitor and the diode that I put in the schematic across the motor, which I later realized was the relay coil?

Do that to your fans as well, from the "switched" side of the relay to ground. The anode should be on ground, cathode on the switched side of the relay.

It's usually better to kill noise at the source, than try to put band-aids on it elsewhere. However, sometimes you have to do both.

If that doesn't kill the chatter, then you'll need to build a filter module. It can be pretty simple.

Oh, where are you getting the power for this circuit? Is there a capacitor across the Vcc and ground pins of the LM339?
 

Thread Starter

Alvin

Joined Jan 22, 2008
22
I've tried that :( I went up to 100uf and it wasn't making any noticable difference so i just gave up on it.

Actually, I tried it at the relay.. The fans we are running are driven by the relay. The fans are approx 40amp
 

SgtWookie

Joined Jul 17, 2007
22,230
See the attached schematic.

It's a simple filter to put on the signal input to the LM339 - that assumes it doesn't have anything else on the input, as I've shown in all the schematics I've put up.

The filter will slow the response of the circuit by a few seconds, but it'll take a 10Hz 10V peak-to-peak square wave and turn it into 60mV of ripple.

R3 represents the input to the LM339; you don't actually install it.

The signal generator on the left is actually your original incoming signal.

The whole hysterisis exercise wasn't in vain; that would be necessary anyway.

Two 4.7K resistors, and two 47uF caps. You don't have to be exact on those values. Larger resistors and/or larger caps will slow the response way down, but it may be necessary to make adjustments upwards if this doesn't fix the problem. Smaller caps/resistors won't give enough filtering.

Make sure the caps are grounded near your LM339 ground pin. Shorter is better here.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
You didn't get back to me yet about the capacitor across the Vcc and ground leads of the LM339 - do you have one there?

Also, your TIP3055 is going to pull a good bit of current when it turns on. Does it have a separate ground to chassis from the LM339 circuit, and/or is the wire at least pretty short and a fairly large gauge, like 16 or better?
 

Thread Starter

Alvin

Joined Jan 22, 2008
22
Hey thanks alot for your help. It looks like you have basically double stacked a high or low pass filter.. i can't remeber which.

As far as the cap on the Vcc and ground leads.. no I have't tried that. Your saying the power supplyand ground pin on the 339 needs a cap just to filter its power supply? I'll definately try that.

Yep, teh 3055 has a seperate ground. I think I have it on a 18 ga. Will the power it requries depend on the load? if so I suspect the load to be around 300ma
 

SgtWookie

Joined Jul 17, 2007
22,230
It's a low-pass filter of sorts. We're fortunate that the LM339 has a very low input current requirement. Otherwise, we'd be fooling around with LC filters with inductors the size of your engine. :eek:

Yes, actually ALL IC's should have caps across their Vcc and ground pins. They're called "de-coupling caps". they reduce noise a great deal. You usually use a 0.1uF cap, either tantalum or ceramic. They are far better at eliminating sharp transient "spikes" than electrolytic caps are.

Also, make certain that you have any unused inputs for the LM339 connected to ground, as otherwise they can "float" and cause trouble.

Your coil may draw an average of 300mA, but there is a sharp spike of current when power is first applied, and another sharp spike of reverse voltage when it's de-energized. A diode takes care of most of the reverse voltage, but a small capacitor (0.01uF down to perhaps 470pF) is needed to absorb voltage during the time it takes for the diode to begin conducting. A larger cap won't help; the wrong type of cap (ie: not tantalum or ceramic) would not help either. It's due to the way the different caps are constructed. All capacitors are not equal!

In schematics for power supplies, you'll often see (on both the input and output sides of the regulator IC) two capacitors; one with polarity, the other non-polar. The polarized one is generally a large-value electrolytic to smooth out the big bumps, and a small-value ceramic or tantalum capacitor (0.1uF) to take care of the high-frequency stuff.

Actually, it would be a good idea to add a 0.1uF cap in parallel with both 47uF caps in that filter I posted a bit ago. I'm simply getting tired, I've been at it all day ;)
 

Thread Starter

Alvin

Joined Jan 22, 2008
22
Everything is working Pefectly!!! I really appreciate the help guys!

Double stacking the filters fixed the issue I was having.
 
Top