Problems with adding Hysteresis to comparator

Thread Starter

Sitara

Joined May 2, 2014
57
Hi,
I am attempting to add hysteresis to a comparator input voltage level detector. For this I am using the following Reference Design:

http://www.ti.com/lit/ug/tidu020a/tidu020a.pdf

Page 7 of the above reference gives the design equations (equations 1, 2) for calculating the resistor values for a given high threshold voltage (V_h), low threshold voltage (V_l) and supply voltage (Vcc).

I am simulating such a comparator circuit in LTSpice, with Vcc = 12v, V_h = 5.64v and V_l = 1.4v. As there are only 2 equations and 3 unknowns, the designer must arbitrarily set one of the unknowns to some known value, before solving for the other two. I set Rx = 10k, which gave me Rh = 3.3k and Ry = 2.2k. I then constructed a simple comparator circuit with these resistors, a screendump of the LTSpice simulation is pasted below:
upload_2017-4-5_21-0-25.gif
R1 is to pull-up the open collector output of the comparator. I am feeding a 50Hz sinewave, which varies between 0V to 8V into the comparator's inverting input. My problem is that the comparator is not switching low at V_h = 5.64v nor is it switching high at V_l = 1.4v, but instead maintains a constant 6v output, regardless of the voltage at the inverting input. I have also uploaded the LTSpice schematic for your examination.

Many thanks in advance!
 

Attachments

wayneh

Joined Sep 9, 2010
17,496
You need to ground that lower middle (latch) pin.

I would have been highly unlikely to find that without your supplied model. Kudos for including that. Better questions get better answers.
 

Thread Starter

Sitara

Joined May 2, 2014
57
You need to ground that lower middle (latch) pin.

I would have been highly unlikely to find that without your supplied model. Kudos for including that. Better questions get better answers.
Thank you Wayneh! I followed your advice and got the comparator to switch. I now need to get it to switch at the design threshold voltages (currently it appears to be switching at 1.67v & 3.4v).
 

wayneh

Joined Sep 9, 2010
17,496
You'll get there. I think experiments within the simulation will be faster than sitting down to calculate it out, unless that's something you enjoy.

To my eyes, your pull-up R1 seems too large while the hysteresis R11 seems too small (but that's understandable, given the large hysteresis you need).
 

Thread Starter

Sitara

Joined May 2, 2014
57
You'll get there. I think experiments within the simulation will be faster than sitting down to calculate it out, unless that's something you enjoy.

To my eyes, your pull-up R1 seems too large while the hysteresis R11 seems too small (but that's understandable, given the large hysteresis you need).
You have a good point there Wayneh. By changing the pullup to 330R I got closer to my target V_h. I guess Its time for the breadboard. Sims can only go so far. Then its 'get real' time! Thanks again!
 
Thinking out loud, starting from zero volts on the comparator inverting input, the output is on. When the voltage on the - input exceeds that on the + input the output goes off, reducing the voltage on the + input. This means that the voltage on the - input has to drop lower than was required to turn the comparator on before it turns off. But if your comparator is open collector it can only sink voltage not source it, so the only source will be via R1, is that the problem? In other words when your comparator isnon, the output is 0V, when it's off the output is high resistance. When the comparator is on the voltage on its output is 0v, making the voltage on the + input the equivalent of R11 in parallel with R15, with R16 connecting this to 12v, or 1.39v. The comparator then switches off, meaning the output is high resistance, and your voltage on the + input is now 10K in parallel with 13.3k (10k + 3.3k), connected to 0V via 2.2k, which I reckon is 3.34v. This means that the comparator will immediately turn back on again, and because there's no time delay in the circuit will settle to a steady state of half the supply..........I think.
 

JohnInTX

Joined Jun 26, 2012
4,787
I am pretty sure you need the feedback resistor between the output and the (+) input. Hysteresis uses positive feedback. Your LTspice image shows negative feedback. I agree that the feedback resistor looks way too small unless you are looking for two widely different switching points as opposed to just getting a clean switch.
upload_2017-4-5_15-56-48.png
 

Thread Starter

Sitara

Joined May 2, 2014
57
I am pretty sure you need the feedback resistor between the output and the (+) input. Hysteresis uses positive feedback. Your LTspice image shows negative feedback. I agree that the feedback resistor looks way too small unless you are looking for two widely different switching points as opposed to just getting a clean switch.
View attachment 124081
Hello John,
The problem with Screendumps are they are too darn small. Too small to see things clearly :).
 
Not if it's open collector, but you could soon put a pull up resistor on the output & the nice thing about this circuit is that if you do, it won't interfere with the voltage levels to the comparator. In fact in the previous circuit any significant load connected to the output that acted as a current sink or source would have varied the voltage reference for the comparator
 

Thread Starter

Sitara

Joined May 2, 2014
57
Not if it's open collector, but you could soon put a pull up resistor on the output & the nice thing about this circuit is that if you do, it won't interfere with the voltage levels to the comparator. In fact in the previous circuit any significant load connected to the output that acted as a current sink or source would have varied the voltage reference for the comparator
Thank you Fierce! I spent the past several minutes checking what you said and can confirm it. Well spotted!
 

Bordodynov

Joined May 20, 2015
3,177
ComparatorHysteresisTestNew2.png Sitara.
Regrettably I have not looked datasheet microcircuits. And has offered its correction. Now I have looked datasheet and has found that You have broken limiting, possible parameters of the comparer.
 
Last edited:
Top