LM339 definitions help needed!

Discussion in 'The Projects Forum' started by JOHN_T_65202, Sep 4, 2012.

  1. JOHN_T_65202

    Thread Starter New Member

    Sep 4, 2012
    7
    0
    I am trying to design a circuit for a low liquid level indicator using the LM339 Quad Comparator. I have done alot of searching and can't seem to find the details I need. I need about a 1 Volt hysteresis between switch points but can't find the resistor value or placement for that.I believe it would go between the output and the + input, is that correct? I also will only be using 1 comparator so I guess I need to ground the inputs of the other comparators, right? Also, I will be setting a Ref voltage with a 10 turn pot and I read somewhere that I should use a bypass cap somewhere on the divider. But should it go across the entire pot or one end and the wiper, or what? And what value would I use? By the way, the input sensor is a 90 ohm pot and I need to light an LED if the voltage from it goes below 3.0V and extinguish it if the voltage rises above 4.0V. So my Ref is tied to + input and my monitored voltage will be applied to -. Or should I reverse that and sink the current to the LED? Thank you for any help guys.
     
  2. #12

    Expert

    Nov 30, 2010
    16,310
    6,817
    You will have to post a schematic before anybody can calculate a resistor for you.
     
  3. wayneh

    Expert

    Sep 9, 2010
    12,139
    3,054
    Lots of questions!

    You can add hysteresis to either an inverting or non-inverting configuration. I think the datasheet for the LM339 will have examples of both.

    That said, 1V is a LOT of hysteresis and I believe you might be better off with a window comparator, which has one state when the voltage is within the window and another state when it is too high or too low.

    I believe the datasheet also says that the inputs and outputs of unused comparators should be grounded.

    IMHO, you don't need a capacitor on the pot. I've made several similar circuits without caps on the pots and they work fine.

    Your overall strategy of using a LM339 is sound. You could also choose an LM393, which is a smaller dual instead of a quad.

    You should be aware that the output of the comparator needs to be pulled high - it's either making a path to ground (when low) or it's open (when high). So for instance if you have the output controlling the gate of a MOSFET as a switch, you need a resistor of about 3K to V+ to turn it on. The comparator will pull the output low, but it cannot pull it high.
     
  4. JOHN_T_65202

    Thread Starter New Member

    Sep 4, 2012
    7
    0
    This is my proposed circuit. If the input voltage level falls below 3.0V the LED will Light. I am not quite sure how much hysteresis 1 Mohm for Rh will give me. If I want more do I increase or decrease Rh? As you can tell, I'm a real artist. don't mind my scribblings.
     
  5. wayneh

    Expert

    Sep 9, 2010
    12,139
    3,054
    Hysteresis increases as the resistor value decreases, and 1M will give only a few mV. But you need a resistor on the incoming input, or else the Rh doesn't matter. Again, read the datasheet.
     
    #12 likes this.
  6. JOHN_T_65202

    Thread Starter New Member

    Sep 4, 2012
    7
    0
    I appreciate all the help but you keep saying to read the Datasheet. I don't know which one you have but the Texas Instruments Data sheet does not even mention Hysteresis configurations. So could you give me an example of the value of an input resistor for a 1 Mohm feedback resistor. Thank You.
     
  7. JOHN_T_65202

    Thread Starter New Member

    Sep 4, 2012
    7
    0
    I have also since my first post decided that .25v would be a sufficient amount of hysteresis. And the 1 Mohm value I just threw out there for Rh.
     
    Last edited: Sep 4, 2012
  8. MrChips

    Moderator

    Oct 2, 2009
    12,446
    3,362
    If the impedance of your input source is very low the feedback resistor Rh will have no effect.
    You can add a source resistor such as 1kΩ in series with the input and your circuit.

    To increase the hysteresis you can try increasing the value of the input resistor or decrease Rh to 220kΩ.

    Edit: I just read wayneh's comment. I'm only repeating what he said.
     
    Last edited: Sep 4, 2012
  9. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Thing is, hysteresis is a function of design in this case, it is inherent in the schematic. The datasheet provides the basic information, but you need a schematic.

    You want non-inverting, correct?

    BTW, a simple 555 will have a hysteresis of 1/3 the Vcc right out of the box, but it is inverting in nature.

    If I don't see anything posted in a day or so I sketch something up. Gotta go to work.
     
    Last edited: Sep 4, 2012
  10. ramancini8

    Member

    Jul 18, 2012
    442
    118
    The TI data sheet doesn't include applications information because they second sourced the LM139/239/339 even though they just bought National. Look at AN-74 page 2 on the National Semiconductor application note web page for a complete discussion of hystersis on the LM139 (quality LM339).
     
  11. ramancini8

    Member

    Jul 18, 2012
    442
    118
    A slow signal like a ramp takes some time to travel through the comparator's threshold, and if there is any noise riding on the incoming slow signal the noise can cause the comparator to change state multiple times. Positive feedback or hystersis causes the comparator output to
    change the reference voltage enough to pull the reference past the noise.
    Noise is always present on the power lines, thus when a resistor divider is used to generate the reference voltage the divider injects noise into the circuit. The injected noise often causes false operation in sensitive circuits, so the center of the divider is decoupled with a capacitor to filter out divider noise. The capacitor is not needed in less sensitive circuits, but many engineers consider it good practice to include a small, inexpensive, ceramic cap for reliability's sake.
     
    wayneh likes this.
  12. JOHN_T_65202

    Thread Starter New Member

    Sep 4, 2012
    7
    0
    Thank you everyone for your help. does this circuit look workable now?
     
    • Scan.jpg
      Scan.jpg
      File size:
      105.9 KB
      Views:
      44
  13. #12

    Expert

    Nov 30, 2010
    16,310
    6,817
    Yes. If your, "monitored voltage" has an impedance that is insignificant compared to 6.8k this circuit will work and the math will come out right.
     
  14. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    Be aware that the LM393/339 can only sink 6mA, worst case. If you want to drive the LED with more than 6mA, you might need to add a transistor.
     
  15. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    I get ≈3.8V of hysteresis.
    You need to re-do your calculations.
     
  16. wayneh

    Expert

    Sep 9, 2010
    12,139
    3,054
    Is the output used only to light the LED? If you also need signal to pass along, I think it would be best to take it at the comparator and not at the opposite end of the LED, since that will not be taken to ground.
     
  17. JOHN_T_65202

    Thread Starter New Member

    Sep 4, 2012
    7
    0
    I could not get this circuit to work properly, The LED would not not shut off and the brightness varied with the input signal. So, I took off the Hysteresis resistor altogether and it works perfectly.
     
  18. wayneh

    Expert

    Sep 9, 2010
    12,139
    3,054
    I can understand it working better - that Rh had a lower value than I have ever seen - but do you have the hysteresis you need? I would expect less than 5mV without added hysteresis. Noise looks pretty big in the mV range, so I'd expect some chatter around the switching point.
     
  19. JOHN_T_65202

    Thread Starter New Member

    Sep 4, 2012
    7
    0
    Just curious, what value would you have used for Rh?
     
  20. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    As Wayne said, you hysteresis resistor value is too small, so the current through it lights up the LED.
     
Loading...