Self adjusting comparator tricks, anybody know any?

Currently I have a circuit that amplifies the signal from an inductive loop pickup, band pass filters it using more op-amp stages, feeds it thru one last op-amp stage to raise the slew rate of the signal, and then finally passes it to a comparator that has its inverting input biased to approx 2V. The output of the final op-amp is biased at 1/2Vcc (2.5V) and fed to the comparators non-inverting input. This means the comparator's output idles high and pulls low when the detected signal drives the op-amp output below 2V. This is all well and good, but I need to measure the time between detected impulses with high resolution (1uS) using the capture/compare module in a PIC. This is easy enough, but the problem is that the impulse being detected flips polarity each time. This causes a phase error on the detection because the comparator won't be triggered until the op-amp drives low again 1/2 cycle later. This creates an unacceptable amount of jitter in the measurements. I can live with the phase error caused by having to wait for the op-amp output to drive low enough to trip the comparator as long as it is fairly consistent since each impulse is quite consistent. The answer seems to be to include another comparator wired in parallel, that has it's non-inverting input biased at 3V and the op-amp output fed to the inverting input, so that it pulls low when the op-amp's output rises above 3V. I don't mind doing this, but it seems a bit messy in that I will have to really fuss with the comparator's biasing voltages to get it balanced well.

Now my question: Is there an easier way that won't involve fussy adjustments? I like "self-working" tricks. ;-) The output from the coil is very weak (millivolts) so diode rectification at that point doesn't seem very likely.

Reply to
Anthony Fremont
Loading thread data ...

Seems like you are already relying on the pulses to be symmetrical, and you have them amplified up to a reasonable level. I'd be inclined at that point to use the two comparators, and bias their compare-points with a circuit that monitors the long-term average of the driving stage, which should be very near indeed to the idling level. You can do that with an R-C lowpass filter, buffered by an op amp. Then you can use op amps to generate plus and minus offsets from that value. It's obvious how to do it with three op amps: one buffer, and one each for plus and minus offsets. If you are tricky, you may be able to do it with just two op amps, or even one (see below). You could also do it with perhaps enough accuracy just using a diode drop above, and a diode drop below, the buffer output, if you bias the diodes with very nearly equal currents. There are also some tricks you could play with transistors, but the overall circuit complexity probably wouldn't be much better than using op amps, which for the biasing don't have to be fast. You can even do it with just one more op amp and the second comparator from what you have now: filter the signal through the LPF (say 100k ohms series and 0.1uF shunt to ground), and connect that to the op amp + input. Connect a 10k feedback from op amp out to op amp - input. Connect a reasonably well matched 10k from op amp - input to the existing comparator reference terminal. Then the new op amp output will be symmetrically on the other side of the signal from the existing comparison point. Use an appropriately long time constant in the LPF, and an op amp with low input bias current. If the op amp has much lower input offset current than input bias current, some advantage can be gained by using feedback and input resisors about two times the value of the R used in the LPF.

Cheers, Tom

Reply to
Tom Bruhns

In article , Anthony Fremont wrote: [....]

Does it look like this:

*** ********* ********** ************* etc ***

If so, it sounds like you want a full wave rectifier. You can do one with a few diodes and resistors and an op-amp.

The other options are:

(1) Use two comparitors.

(2) Shift the bias point of the comparitor after each pulse.

A simple version of the (2) is to put positive feedback around the comparitor so that it rests high, then low and then high again between pulses.

--
--
kensmith@rahul.net   forging knowledge
Reply to
Ken Smith

Anthony Fremont wrote: ...

A common way to deal with this in magnetic tape read amplifiers is to differentiate the signal and then use a zero crossing comparator - this results in transition at the peak of the input signal and is independent of the amplitude of the signal.

It is however sensitive to high-frequency noise and can be difficult to deal with if the pulses are separated too far as the differentiated signal will fall close to zero between pulses.

kevin

Reply to
Kevin White

This works better with some hysteresis in the zero crossing detector. Even if the signal sags near zero, you still have some noise margin.

Luhan

Reply to
Luhan

You could choose a PIC with builtin comparator(s). With a single comparator you could program it to use the internal voltage reference and between edges you could reprogram the comparator to change polarity and/or reference voltage (you get something like 24 voltage choices ranging from about 0*VCC to .75*VCC using and odd formula).

--
Ben Jackson

http://www.ben.com/
Reply to
Ben Jackson

jack wrote: [...]

Sometimes :)

Many years ago whilst still bright eyed and bushy tailed, I was suckered into building what was described as a 'precision phase meter'. Found to my cost it was only 'precision' when measuring waveforms with

0.000% even harmonic distortion and these were (are) as rare as hen's teeth. Intersil seem to have fallen into the same trap. john
Reply to
john

there is a very neat precision full-wave rectifier circuit using a pair of rail to rail opamps at

formatting link

if you look at the front end of the Intersil Simple Phase Meter --

formatting link
you will note that they use CFB opamps to drive 200R resistor as a diode clamper -- i have built this circuit (using the HFA3102, but TI opamps as I had these on hand.) The HFA3102 a long-tail pair transistor array with a GBP of 10gHz -- you can substitute discrete surface mount devices but this will limit the period to measure. The device which Intersil described in their application note will measure phase very acurately.

Reply to
jack

...Run it through a schmidt trigger and frequency divider? Not accurate enough?

Tim

--
Deep Fryer: a very philosophical monk.
Website: http://webpages.charter.net/dawill/tmoranwms
Reply to
Tim Williams

Be OK. Fine with clean wave shapes (ie balanced/symmetrical). Problems come with the unbalanced lopsided stuff. Where does each cycle actually start?. Some kind of additional circuitry is then needed on both phase channels to (try) and actively servo the signals to a balanced midpoint, before the phase timing edges can be generated. john john

Reply to
john

FWIW -- the HP 3575A Gain-Phase Meter uses the same approach -- if you are looking for loop stability in a power supply regulator the HFA3102 comparator will be just fine

Reply to
jack

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.