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.

Window comparator - fixed window

Status
Not open for further replies.

Blueteeth

Well-Known Member
Hey,

Working on a little project measuring inductors I've pretty much got the design down, but there is one part which is bugging me, and would make the rest a lot easier.

Its a standard window comparator (albeit two independent high speed comparators) with a fixed window width, and variable window centre.

When I say fixed, I mean, say centred at 2v, with a window of 1v (1.5v to 2.5v). Or a window of 2-3V, centred at 2.5.... but with the centre voltage variable to say 4v (3.5V to 4.5V same 1v window width). The standard 3-resistor ladder found in many circuits (including the 555 timer) is out of course, because this produces thresholds as a fraction of the input/reference voltage.

I could use two DAC's to set the thresholds, but this takes time (>20us) as they will be controlled by a micro-controller) although I'll probably end up using a DAC to set the centre anyway.

I cannot think of a way to do with in analogue, but I'm sure it can be done! So far the only workable thing I have is using analogue multiplexers, such as the 74HC4052, to switch between precision resistors which form a divider, with a precision reference. This means, two of these can produce discrete voltage levels, but is quite limited. Which are based off the input reference... again a fraction of this, but clever use of resistor values means I have two sets of voltage levels, with 1V between them.

Ideally it would have a voltage in to set the 'centre' of the window, and resistors (or a pot) to set the width - precision of the width is more important. I know its a tall order, but just wondering if anyone has any design idea's or applications similar? Because the comparator will be working with an input ram signal of >100kHz and will vary this centre voltage on the fly, manually doing it is far too slow

Cheers!

Blueteeth
 
vary this centre voltage on the fly
How rapidly and in what steps?
 
What about something like this? R1-R2 set the upper/lower pot limits. R3-R4 sets the bias level in the diodes to get them to conduct.
 

Attachments

  • CMP.pdf
    7.9 KB · Views: 221
..... or like this? Ref1 and Ref2 are the reference voltages for the two comparators. R1 plus the 1mA source give a 1V difference between the refs. V2 sets the mid-point.
DualRefFixedOffset.gif
 
Hi,

Two analog pots.

I dont know how many steps you need either, or if you just need certain steps and widths or what.

Another idea is to use a multiplying DAC. That should be pretty fast.

Upper and lower can be set with the same reference if using op amps to generated the references.
But i would think using a separate upper and lower reference would provide the most variability.
 
Hey guys!
How rapidly and in what steps?

I'm charging an unknown inductor from 0 to a certain current, then discharging it down to another current, recharging etc.. using the comparators to measure how long this takes (effectively working out L), but changing the thresholds to slowly increase the currents starting point, until it saturates... soo.. with say a 10uH inductor, at 1V... probably around 10+30us = 40us.

Nike Odem, I had something similar but not as precise as that ( I had no biasing the diodes), I'll simulate that on LTspice though and breadboard... because the window will (probably) be fixed, that would be a neat solution! thanks

And Alec, thanks man, that looks like a sort of summing amplifier which is the idea I had just after I posted :/ Its typical, one spends 3 days thinking of a problem, finally posts... and then I think of a simple solution (with your guys help) whilst drinking tea...

I was far too busy thinking about the 'centre' voltage, which the window being 'window/2' either side of it. But, I could just set the lower threshold, then add a voltage to that with a summing amplifier (like your current source and resistor there!). ergo.. a classic opamp summing amp. Two input voltages: one sets the lower threshold (reference), the second is the window width (going for 1v, but of course this is adjustable as well).

Just in case this helps anyone, here's a quick schematic - note this is just a proof of concept, won't be using these components in the design, and in fact will use each output of the comparator separately. But the idea of having two voltages, fixed window (V1 in the schem, set by trimmer) and a variable reference (V2) suits me just fine. Sorry if I didn't explain it well at first :(
 

Attachments

  • window_centre1.jpg
    window_centre1.jpg
    230.6 KB · Views: 223
Mine would work in a pinch, but you'd have to suffer with the window the diodes gave you. Alec T's idea is very good... except he should explain his 1mA current source, maybe using the second op amp (dual package)?
 
Alec T's idea is very good... except he should explain his 1mA current source, maybe using the second op amp
That was just a concept. Bluetooth's summing amp solution is better and needs only one opamp to get both comparator references.
 
Hi again,

Another idea is to use a voltage reference diode or two. That would keep the window voltage accurate even with temperature variations.

A 1ma current source sounds interesting too though.
 
Hey guys!


I'm charging an unknown inductor from 0 to a certain current, then discharging it down to another current, recharging etc.. using the comparators to measure how long this takes (effectively working out L), but changing the thresholds to slowly increase the currents starting point, until it saturates... soo.. with say a 10uH inductor, at 1V... probably around 10+30us = 40us.

Nike Odem, I had something similar but not as precise as that ( I had no biasing the diodes), I'll simulate that on LTspice though and breadboard... because the window will (probably) be fixed, that would be a neat solution! thanks

And Alec, thanks man, that looks like a sort of summing amplifier which is the idea I had just after I posted :/ Its typical, one spends 3 days thinking of a problem, finally posts... and then I think of a simple solution (with your guys help) whilst drinking tea...

I was far too busy thinking about the 'centre' voltage, which the window being 'window/2' either side of it. But, I could just set the lower threshold, then add a voltage to that with a summing amplifier (like your current source and resistor there!). ergo.. a classic opamp summing amp. Two input voltages: one sets the lower threshold (reference), the second is the window width (going for 1v, but of course this is adjustable as well).

Just in case this helps anyone, here's a quick schematic - note this is just a proof of concept, won't be using these components in the design, and in fact will use each output of the comparator separately. But the idea of having two voltages, fixed window (V1 in the schem, set by trimmer) and a variable reference (V2) suits me just fine. Sorry if I didn't explain it well at first :(

There was an Intersil application note (attached) several years ago that used an opamp and a rail-rail input comparator that gave a window comparator in which the window width could be set independently of the trip point. The components described in the note are now obsolete, but replacements should be easy to find. I don't know about the speed of the circuit, whether it would be fast enough for your needs... judicial parts selection should make it work.

Cheers,
Dave
 

Attachments

  • Window Comparator With Independent Adjustments.pdf
    39 KB · Views: 207
Old techie,

Good find! Looks ideal, as even though I can of course use two comparators, a single one makes life easier if I was to use one built into a PIC - then there is only one output to tie-into a timer-gate for measuring pulse with. Would make life a LOT easier rather than having to use logic for the two comparators externally for a single gate signal (OR, AND etc..). Or using the newer PIC's 'configurable logic' for it.

I just did a quick demo in LTspice, first using the voltages and values in the circuit - works well! Speed probably won't be an issue with a high speed comparator and a half decent opamp (GBW > 6MHz). I realized the potentiometers could probably be replaced by voltage sources (a DAC) but I'm having trouble calculating what these voltages would translate to in terms of threshold and window width. As my input will not be negative at all, would be nice if I could get this as a single supply, although a negative supply always helps with opamp designs, regardless of rail-to rail IO, It seems that the threshold input is inverted, as in, for a threshold of +v, this potentiometer should be set to provide -V as a function of the power supply - I assume this means the negative power supply must be in some way regulated to keep this threshold constant?

So far I can't work out the exact relationship between a voltage replacing the pots (negative and positive) and the threshold, as wlel as the window. They are proportional, but not absolute. As I'll be using DAC's to set the voltage, I could just use a look up table in a micro providing I know what the relationship is. I'll fiddle around with it, thanks again!
 
Old techie,

Good find! Looks ideal, as even though I can of course use two comparators, a single one makes life easier if I was to use one built into a PIC - then there is only one output to tie-into a timer-gate for measuring pulse with. Would make life a LOT easier rather than having to use logic for the two comparators externally for a single gate signal (OR, AND etc..). Or using the newer PIC's 'configurable logic' for it.

I just did a quick demo in LTspice, first using the voltages and values in the circuit - works well! Speed probably won't be an issue with a high speed comparator and a half decent opamp (GBW > 6MHz). I realized the potentiometers could probably be replaced by voltage sources (a DAC) but I'm having trouble calculating what these voltages would translate to in terms of threshold and window width. As my input will not be negative at all, would be nice if I could get this as a single supply, although a negative supply always helps with opamp designs, regardless of rail-to rail IO, It seems that the threshold input is inverted, as in, for a threshold of +v, this potentiometer should be set to provide -V as a function of the power supply - I assume this means the negative power supply must be in some way regulated to keep this threshold constant?

So far I can't work out the exact relationship between a voltage replacing the pots (negative and positive) and the threshold, as wlel as the window. They are proportional, but not absolute. As I'll be using DAC's to set the voltage, I could just use a look up table in a micro providing I know what the relationship is. I'll fiddle around with it, thanks again!


You're quite welcome... I've had that app note around since it first appeared in EDN (I think) magazine, thinking I would probably need it some day. It still looks interesting, though I've never tried to build it.
You should be able to find the transfer characteristics by replacing the two pots in the circuit with voltage sources, and then sweeping them in LTSpice. Sweep the voltage from Rt first to get the graph for the set point voltage, then set that to a fixed voltage by either setting a voltage source or by way of a resistive divider. Then you can sweep the window pot Rw the same way to find the voltages that correspond to your desired window widths.
Hope I explained that well enough for you to get the idea... if not, maybe I can do better next time. {:>)
Cheers,
Dave M
 
Hi again,

Another idea is to use a voltage reference diode or two. That would keep the window voltage accurate even with temperature variations.

A 1ma current source sounds interesting too though.

The voltage drop across a diode decreases 2mv for every 1 degree increase in temp.
 
The voltage drop across a diode decreases 2mv for every 1 degree increase in temp.

Thanks for the reply Mike and yeah that's about right, and your point is?

2mv per degree means 20mv every 10 degrees C. If the window is 2 volts that's only 1 percent, but if the window is 0.2 volts then that's 10 percent, and 10 degrees is a reasonable minimum target range.

I like your quote :)
 
Hi again,

I've gone with the summing amp and reference idea, mainly because it is more accurate (providing the reference is accurate...) and opamp offset won't contribute much as there is little in the way of gain. I may end up using two DACs to set the voltages, meaning, that I'll just use software to add in the window width but its still a nice idea, and this way, if the window is a fixed width, just means only one DAC needed!

Just hit another snag on the linear power supply for this project, but I have another post on that.... delving into compensation loops/networks for constant current and/or constant voltage regulation... its starting to get hairy with an inductive load. ...
 
Status
Not open for further replies.

Latest threads

Back
Top