Author Topic: Window Comparator Hysteresis  (Read 11546 times)

0 Members and 1 Guest are viewing this topic.

Offline ChristopherTopic starter

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Window Comparator Hysteresis
« on: December 27, 2014, 07:56:31 pm »
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?


 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Window Comparator Hysteresis
« Reply #1 on: December 27, 2014, 08:48:25 pm »
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.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: Window Comparator Hysteresis
« Reply #2 on: December 27, 2014, 09:13:55 pm »
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.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Window Comparator Hysteresis
« Reply #3 on: December 28, 2014, 12:34:31 am »
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
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline IconicPCB

  • Super Contributor
  • ***
  • Posts: 1535
  • Country: au
Re: Window Comparator Hysteresis
« Reply #4 on: December 28, 2014, 03:56:29 am »
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..
 

Offline ChristopherTopic starter

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Re: Window Comparator Hysteresis
« Reply #5 on: December 28, 2014, 04:41:09 pm »
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.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Window Comparator Hysteresis
« Reply #6 on: December 28, 2014, 05:43:26 pm »
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.
 

Offline ChristopherTopic starter

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Re: Window Comparator Hysteresis
« Reply #7 on: December 28, 2014, 06:29:22 pm »
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 website http://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!)
« Last Edit: December 28, 2014, 06:32:03 pm by Christopher »
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Window Comparator Hysteresis
« Reply #8 on: December 28, 2014, 06:35:37 pm »
Well if the boss is always right then good luck. What I would do is lowpass filter your input.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Window Comparator Hysteresis
« Reply #9 on: December 28, 2014, 09:50:05 pm »
Adding hysteresis is literally the same as widening the threshold.  Tell your boss he's an idiot (in no uncertain terms!).

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Window Comparator Hysteresis
« Reply #10 on: December 29, 2014, 09:40:14 am »
Adding hysteresis is literally the same as widening the threshold.  Tell your boss he's an idiot (in no uncertain terms!).

Tim

Quite 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.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Window Comparator Hysteresis
« Reply #11 on: December 29, 2014, 10:02:11 am »
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
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline ChristopherTopic starter

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Re: Window Comparator Hysteresis
« Reply #12 on: December 29, 2014, 11:50:13 am »
I need to start a notebook of single sentence real world tips!
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Window Comparator Hysteresis
« Reply #13 on: December 29, 2014, 11:51:25 am »
Tip number one, try to avoid working for a boss who is an idiot :-DD

Sorry couldn't help myself ;D
 

Offline ChristopherTopic starter

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Re: Window Comparator Hysteresis
« Reply #14 on: December 29, 2014, 11:52:32 am »
And be jobless?

Everyone is an idiot in his own right. The trick to life is dealing with these people! !
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Window Comparator Hysteresis
« Reply #15 on: December 29, 2014, 11:54:32 am »
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.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Window Comparator Hysteresis
« Reply #16 on: December 29, 2014, 09:10:25 pm »
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
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline ChristopherTopic starter

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Re: Window Comparator Hysteresis
« Reply #17 on: December 30, 2014, 07:22:44 am »
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.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Window Comparator Hysteresis
« Reply #18 on: December 30, 2014, 09:12:10 am »
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.

Sounds 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?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf