Window Comparator Hysteresis  - Page 1
Forum section: electronics / beginners

author: Christopher
author_rank: Frequent Contributor
timestamp: December 27, 2014, 07:56:31 pm
content: Attached is a basic simulation (no decoupling caps etc) of my latest creation. Basically I need to monitor a ton of voltages to see if they are in spec then latching some LEDs if they fail. No go tester.I am worried about the no hysteresis and it causing false triggering of the circuit.What would the best way to add some hysteresis to this circuit?

author: Simon
author_rank: Unknown
timestamp: December 27, 2014, 08:48:25 pm
content: Adding hysteresis is fairly simple. In my experience for it to work you will need to use the inverting input as the input that takes the measurement as despite what a certain app note claimed when I followed it I ended up converting my comparator into an operational amplifier by doing it the other way around as suggested. Then you set up your reference voltage on the non-inverting input, take note of the resistor values you are using. You then connect a resistor from the noninverting input to the output. This apparent feedback resistor is what gives you the hysteresis. If you bear in mind that when the output is high that resistor will in effect be connected in parallel to the high side resistor on the noninverting input. When the output is low that resistor will be in parallel with the low side resistor. So depending on what state the output is in the reference voltage will actually shift up and down by a value which is determined by the relationship between the "feedback" resistor and the resistors you are using to set the reference voltage. For example if high low and feedback resistor are all of the same value you will have when the output is low a reference voltage of one third of the supply voltage to that resistor network and when the output goes high moving the resistor in parallel with the high side resistor instead the reference voltage will shift to 2/3 of the supply voltage to that resistor network. So you will achieve a hysteresis of one third of the supply voltage. To reduce that you would need to increase the value of the "feedback" resistor.

author: Zero999
author_rank: Super Contributor
timestamp: December 27, 2014, 09:13:55 pm
content: In order to produce hysteresis, there needs to be positive feedback which is applied to the non-inverting input.Here's how it's done. The diodes are not needed, since the comparator has open collector outputs.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 28, 2014, 12:34:31 am
content: If the output is latching, that serves the same purpose. Just set the window wider by an amount equal to the desired hysteresis band.Tim

author: IconicPCB
author_rank: Super Contributor
timestamp: December 28, 2014, 03:56:29 am
content: hysteresis is produced by providing a small amount of POSITIVE FEEDBACK.This hint ought to give You sufficient information to analyse the comparator in either state ( output high, output low ) with respect to input voltage range..

author: Christopher
author_rank: Frequent Contributor
timestamp: December 28, 2014, 04:41:09 pm
content: thanks all. I now have a solid understanding. I think the thing that threw me off was not being able to have any positive feedback on the lower comparator.Now for design calculations it's as easy as having two separate comparators with the outputs paralleled!--I think for this project I will increase the tolerance Vrefs as the output will be latched. But very useful information none the less.

author: Simon
author_rank: Unknown
timestamp: December 28, 2014, 05:43:26 pm
content: If it's a window comparator I'm surprised you want any hysteresis as you would want to be sampling between a specific window that's the point isn't it?Hysteresis is usually used on a single comparator where you want to avoid chattering say for example on a thermostat that has to turn something on and off, we had this problem at work where we had a heater with a sensor in it. Because there was no hysteresis in this case it was in software in a microcontroller the relays that control the heating element continually chatted due to fluctuating measurements and noise in the sensor measurement.

author: Christopher
author_rank: Frequent Contributor
timestamp: December 28, 2014, 06:29:22 pm
content: We use window comparators to measure the output of a switching regulator, to less than 1% of its output.Normally hang an RGB LED off the window comparator outputs to see if they are in spec. A little noise (from a load transient for instance) sends it hay wire, resulting in an led that is all over the place. That is why we add the hysteresis.I would say just increase the limits as you say Simon, but the boss is always right.(off topic: simon I saw your websitehttp://www.simonsphotography.org.uk/and notices you have taken some photos of the beautiful Island I live and work on! Lovely place in the summer isn't it!)

author: Simon
author_rank: Unknown
timestamp: December 28, 2014, 06:35:37 pm
content: Well if the boss is always right then good luck. What I would do is lowpass filter your input.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 28, 2014, 09:50:05 pm
content: Adding hysteresis is literally the same as widening the threshold. Tell your boss he's an idiot (in no uncertain terms!).Tim

author: Simon
author_rank: Unknown
timestamp: December 29, 2014, 09:40:14 am
content: Quote from: T3sl4co1l on December 28, 2014, 09:50:05 pmQuite it's utterly pointless as it will mean you have a moving threshold whereas you are expecting a specific window. To filter out spikes you need a wait for it....... filter circuit how surprising. You need to work out how fast a response you wish and then have a low pass filter that has a cut-off frequency that equates to a slower time period than the time period you want as a reaction time. So if you want the circuit to react within a hundred milliseconds make sure your filter circuit has a cut-off frequency that is higher than 10 Hz. That will completely eliminate any spikes and mean that you have a reliable threshold.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 29, 2014, 10:02:11 am
content: And yes, filtering is a good idea. In general, you want to filter every signal in your circuit as much as possible. Only use the bandwidth you need!Tim

author: Christopher
author_rank: Frequent Contributor
timestamp: December 29, 2014, 11:50:13 am
content: I need to start a notebook of single sentence real world tips!

author: Simon
author_rank: Unknown
timestamp: December 29, 2014, 11:51:25 am
content: Tip number one, try to avoid working for a boss who is an idiotSorry couldn't help myself

author: Christopher
author_rank: Frequent Contributor
timestamp: December 29, 2014, 11:52:32 am
content: And be jobless?Everyone is an idiot in his own right. The trick to life is dealing with these people! !

author: Simon
author_rank: Unknown
timestamp: December 29, 2014, 11:54:32 am
content: Yes I understand the dilemma. Who is designing the circuit, why is he choosing how to build it. If you are tasked with building a circuit surely it's up to you how you do it. Perhaps if you explain an alternative reasoning he will see the benefit of a different solution.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 29, 2014, 09:10:25 pm
content: If you're dumb enough to follow instruction blindly, you'll get what you deserve. (Crap from the boss, stuck in a dead-end job, little or no financial advancement, etc.)If you're smart enough to see the problems, and choose not to act, you still get what you deserve.If you're smart enough to see the problems, and choose to speak up and act, you are doing the responsible thing. If that results in you losing your job, good! You can take that to ten other companies and, if they are as smart as you, they will see it, and reward you accordingly.Now, this is a very tiny example out of what I assume is a much larger project... but, if you're being micromanaged to the level of just some dumb comparator, I can only imagine it is indicative of things much more systemic and worse, as well!If things really aren't that bad on the whole, then, nevermind, call it general advice...Tim

author: Christopher
author_rank: Frequent Contributor
timestamp: December 30, 2014, 07:22:44 am
content: Hi Tim.Yeah my job is pretty shitty. Low wage for the work I do. Designing test fixtures for power supplies. This next year is the year I get noticed for advancing and getting a huge pay rise (yeah right)But as a young twenty something with three years digital/micro experience, I'm just getting onto the analog design ladder properly. I can see a brighter future.The boss tells me here's what I want, go do it, then rips it to shreads after you're done. So I'm trying to get as much general advice as possible about analog electronics, from my co workers and you guys so that hopefully one day I can knock this shit out in my sleep.Anyone can know KVL KCL and how to analyze a circuit. But it takes years of experience to lay out a decent board that just works.Like all along I knew to open my window a bit as that's all the hysteresis does. But I don't have much confidence in my analog knowledge yet.

author: Simon
author_rank: Unknown
timestamp: December 30, 2014, 09:12:10 am
content: Quote from: Christopher on December 30, 2014, 07:22:44 amSounds a little like my situation but then I am the only person with any electronics expertise as we are a mechanical company which is why I have held on for dear life. I'm now at the point where they will seek my advice rather than tell me how to do it wrong.If your boss tells you how to do something and then rips it to shreds it rather sounds like he's a complete idiot and possibly does not know anything himself. The inferiority complex of not knowing anything but being in management would probably drive him to try and tell you how to do your job. Does he just automatically rip things to shreds or is it when they go wrong because his ideas did not work but now that you have made it for him they have become your ideas? All you need is a resistor and capacitor to make this work can't you just slip them in?