Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Comparator (LM393) design question

Status
Not open for further replies.
I am working on a circuit that includes a LM393 comparator. I see that it has hysteresis and by the design notes should have lower threshold at 4.5V and an upper threshold at 6.0V. My testing has confirmed the thresholds. While testing I noticed something curious that I was wondering if anyone could explain. I expected there to be a hard cut over between the thresholds and on the output. If the input is slowly adjusted through the trigger range, the LED (as well as the comparator output) will come gradually instead of on/off. I tried increasing and dreasing the load with no effect. Can you take a look at the attached schematic and let me know what I'm missing.


View attachment 63630

TIA. Anthony
 
For the hysteresis to work right it has to be positive feedback, ie: from the output to the + pin.
 
The resistor connected to the negative input generates negative feedback, which makes it a linear amplifier, not a comparator. As ronv noted, you must connect the resistor from the output to the plus input to build a comparator with hysteresis.
 
Oh AG, if only it werethat simple. That also swaps the output polarity and subsequently the failure mode of the final output. I figure the resistors got moved from - to + in order to accomodate a failure-off polarity. If the transistor or the comparator die the relay will be left without a driver. Once the resistors are swapped the output will be need to be redesigned to ensure a failure-off mode.
 
The comparator is not designed to use negative feedback like an opamp can. An opamp has a frequency-compensation capacitor inside so that its does not oscillate at a high frequency when it has negative feedback applied. A comparator oscillates when it has negative feedback applied.

Instead of swapping the input pins which changes the failure mode then simply move the 220k negative feedback capacitor to pin 3 instead of pin 2. Its value might need to be reduced a little.
 
If I only move R2, how would I compute the threshold values, keeping in mind Rin is a mimic of the output of an instrument. The voltage at the wiper of the pot Rin (Vin) is a dynamic value, being the output of an upstream instrument.
 
Simple Ohm's Law determines the switching threshold voltages. The 100k output resistor is included in the calculations.
 
The LM393 datasheet has the formulas for the thresholds, but they have fixed reference voltage whereas the equivalent point in this circuit will be variable and the other input fixed. Without hysteresis and wired with the input on Vin- or Vin+ the operation is obvious. If I looked at the premade formulas in the datasheet, it would appear the thresholds will now be dependent on the input voltage. That doesn't sound right, so I must be missing or forgetting something.

View attachment 63661
 
Vin needs a series resistor for the hysteresis to work.

The transistor and LED will be destroyed by the high voltage spike produced by the relay coil's inductance when it is turned off because a clamp diode is missing in parallel with the coil.
 
The diode is there, just omitted by the simplified schematic. I wired that schematic, but when the output changes Vin jumps. That's not going to be acceptible as Vin is also used elsewhere. I used the same value resistors as in the original (33k and 220k).
 
Last edited:
Vin is supposed to be from a low impedance that does not jump when the comparator switches. If the value of the 220k resistor is much higher then the jumping will be much less and there still will be some snap-action hysteresis on the Schmitt trigger.
 
Maybe you should tell us what Vin is. You can either add a buffer amplifier to make Vin a low impedance source or if it is already fairly low you could look at 330k and 2.2 meg for the resistors.
 
Vin is the output from a variety of instruments, most pre-fab (ie., black boxes) that include pressure, flow, and temperature transmitters. I've been tasked to "back into" this project which has already been sent to fab and I'm supposed to make it work. I starting in the middle and working to both ends, making it work and figuring out why it was designed the way it was. I have decent design notes, but deciphering what was designed and realizing an error was made and where the error is are definately distant but related tasks.

I can't quite figure out how to use 330k and 2.2m resistors to get the proper threshold. Substituting them directly, raised the upper threshold over 250mV.
 
In your original circuit (your first post), try moving the right side of resistor R2 from the output of the comparator to the collector of transistor Q1. You will have positive feedback for hysteresis since Q1 inverts the signal. The + input of the comparator remains free. For this, you need to put the snubber diode across the relay coil and RL value should be reduced to minimize Q1 turn off delay.
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top