Author Topic: Voltage comparator  (Read 5880 times)

0 Members and 1 Guest are viewing this topic.

Offline soldar

  • Super Contributor
  • ***
  • Posts: 3524
  • Country: es
Re: Voltage comparator
« Reply #25 on: April 30, 2019, 07:03:04 pm »
One of the first instruments I designed and built myself around 1975 was a frequency counter and I still have it and it still works. I used TTL SN7490 decade counters, SN7475 latches, SN7447 bcd to 7 segment decoders and 7 segment displays.

Crystals were extremely expensive so I used one that I got for 5230 KHz and used a lot of digital circuitry to divide by 5230 and obtain a 1 KHZ signal used as timebase.

The signal input amplifier/conditioner was really, really badly designed but I was just starting and that's all I could do. It had two parts. The low frequency part went up to about 1 MHz and a separate amplifier was switched when counting higher frequency. I have sometimes thought I could improve the instrument by replacing this part and leaving the rest as it is.

Conditioning the signal is not as obvious or straightforward as it might seem at first. How many cycles or pulses do you want to count in the attached graphic? 
« Last Edit: April 30, 2019, 07:20:45 pm by soldar »
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Voltage comparator
« Reply #26 on: April 30, 2019, 07:21:59 pm »
One of the first instruments I designed and built myself around 1975 was a frequency counter and I still have it and it still works. I used SN7490 decade counters, sn7475 latches, SN7447 bcd to 7 segment decoders and 7 segment displays.

Crystals were extremely expensive so I used one that I got for 5230 KHz and used a lot of digital circuitry to divide by 5230 and obtain a 1 KHZ signal used as timebase.

The signal input amplifier/conditioner was really, really badly designed but I was just starting and that's all I could do. It had two parts. The low frequency part went up to about 1 MHz and a separate amplifier was switched when counting higher frequency.

Conditioning the signal is not as obvious or straightforward as it might seem at first. How many cycles or pulses do you want to count in the attached graphic?

ideally 4 (actual value) but there are spikes all over the shop and my hysteresis would be close to ground, so it would be counting 5  :-// (spike on the 3rd wave causing a false count)
 

Offline soldar

  • Super Contributor
  • ***
  • Posts: 3524
  • Country: es
Re: Voltage comparator
« Reply #27 on: April 30, 2019, 08:19:46 pm »
These things can get very tricky. Do you count only zero crossings in one direction? with how much hysteresis? Too much and you can miss some in low amplitude waveforms. Too little and you can get false triggering in higher amplitude waveforms. Ideally you would first normalize the signal.

What about when you have something like a high frequency signal summed with a lower frequency signal? Do you want to count one or the other?
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1927
  • Country: us
Re: Voltage comparator
« Reply #28 on: April 30, 2019, 09:16:08 pm »
The two waveform examples suggest filtering is important too. I did a search and this post is the first in this thread with the word "filter" in it.

I acknowledge that if the frequency counter is measuring something that another circuit will depend upon, that other circuit may also be fooled by unexpected frequency components. But that doesn't mean they can be ignored! If your counter can be fooled, so too may your actual circuit be fooled.

It looks (pun intended) like observing the signal with a scope or SA might be really good insurance before relying on the accuracy of the frequency counter. The latter may be fooled by spurious frequency content, but the scope should be able to image it (presuming sufficient bandwidth). Lacking that, perhaps we should include a discussion of front end filters while talking about frequency counters....

EDIT: I suppose one could design a pulse discrimination circuit that would only count the transitions that occur on a periodic basis, but I think I'd rather use standard filters.
« Last Edit: April 30, 2019, 09:25:25 pm by IDEngineer »
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Voltage comparator
« Reply #29 on: April 30, 2019, 09:19:32 pm »
I'm not trying any fancy waveforms like you mentioned (two summed up or etc) no frequency counter that I know of can handle those (except with adding filter for frequency range, etc which I don't want to do!) and it will be close to zero (only rising edges) so it's fine. signals aren't as noisy as you made them seem.

my main question about the input still remains however:
1) what's the jfet used for?
2) Is it a good idea to include a common emitter amplifier on the input?

edit: inputs are well behaved, I don't want to discuss edge cases / where the input signal is not known / not well behaved
« Last Edit: April 30, 2019, 09:22:19 pm by OM222O »
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1927
  • Country: us
Re: Voltage comparator
« Reply #30 on: April 30, 2019, 09:28:45 pm »
These things can get very tricky. Do you count only zero crossings in one direction? with how much hysteresis? Too much and you can miss some in low amplitude waveforms. Too little and you can get false triggering in higher amplitude waveforms. Ideally you would first normalize the signal. What about when you have something like a high frequency signal summed with a lower frequency signal? Do you want to count one or the other?
This makes me wonder: Has anyone designed a DSP-based frequency counter? A lot of these potential problems could be easily addressed if you had some processing power. Seems like one of the T&M shops would have created such a beast by now.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Voltage comparator
« Reply #31 on: April 30, 2019, 09:50:43 pm »
you could but it would be practically useless ... at that point you just use an scope  :-DD no please stay on topic!
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16969
  • Country: us
  • DavidH
Re: Voltage comparator
« Reply #32 on: May 01, 2019, 02:10:59 am »
David noted something about the AM687 comparator.  I remember a story about one of AMD's fast comparators, maybe the AM686 - the one with TTL outputs.  In the mid 80's I had just been hired at a startup and a contractor was battling with one of these comparators for a different project.  AMD was not kidding when they talked about sensitivity to layout and choice of bypass caps.  My contribution was to suggest adding a shield over the pin side of the PCB which helped.  I believe the ultimate solution was to go surface mount when the part became available in that form.   The DIP package leadframe just had too much mutual inductance.

Comparators faster than the LM311 often have stability problems making them difficult to use in practical circuits.  One solution to this problem is to include (and use) a latch enable input on the comparator; some parts are simply never stable in their active region unlike the LT1016 and similar later parts which are much easier to use.

pretty much every circuit that has been referred to seems to use a JFET input buffer. is this just to create a high impedance input or are there any other reasons? I'm not sure about the input impedance of comparators but op amps have better than good enough input impedance on their own so I'm not sure why the JFET buffer is used.

As I mentioned, if you need a high impedance input and lower bandwidth is acceptable, then you can get away with using a JFET or CMOS input operational amplifier in a voltage follower configuration instead of a discrete JFET or MOSFET.  In the past, fast JFET and CMOS input operational amplifier simply were not available.

Quote
Also I wonder if there is a better way of creating the hysteresis where it doesn't need adjusting the gain based on the input ???
the schematics that have been provided so far don't seem to have that but they're a bit too complex for me to see how they have gotten around the trigger point problem. maybe the hysteresis points are chosen close together at something like 50mv and 100mv? rcbuck mentioned that even the professional ones that include sensitivity adjustment don't seem to do much anyways ...

The HP 5314/15/16 simply relies on the built in hysteresis in the AM687 comparator that it uses for normal operation and adjusts it in a rather dastardly way in the alternative mode of operation and it definitely has an effect.

The first example I gave above has fixed positive feedback around the last differential amplifier stage.  The second discrete example has fixed DC positive feedback around the first differential amplifier stage and AC positive feedback around the last differential amplifier stage which is only there to increase switching speed. 

Usually, hysteresis is fixed in the design and there is no need to adjust it.  If you use an integrated comparator like an LT1016, it has no hysteresis built in but you can add it easy enough with a resistor from one of its outputs to one of its inputs.  Making the hysteresis adjustable would be tricky unless you can pull off what HP did with the HP 5314/15/16; offhand I do not know what modern parts are suitable for that kind of implementation.

But I think the above is largely irrelevant because you can get great performance up to 25 or even 50 MHz with just two parts.  Pick your favorite fast JFET or CMOS operational amplifier for use as a voltage follower to buffer the high impedance inputs, maybe an AD8065, and use it to drive an LT1016 or similar with an external positive feedback resistor to add fixed hysteresis; it should only require millivolts to 10s of millivolts for good operation.

You will probably want a compensated divider before the buffer to increase the input voltage range and to protect the input from over-voltage conditions.  A high impedance input also allows the use of a x10 oscilloscope probe for added protection and input voltage range.

The LT1016 or similar will be easier to use than the TI part I mentioned because it has complementary outputs; use one to drive the logic and the other to provide hysteresis.  TI has some similar parts I think.

If a 50 ohm input is acceptable, then you can drive the input to the comparator directly without a high impedance buffer.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Voltage comparator
« Reply #33 on: May 01, 2019, 11:22:11 am »
I decided to use the LT1016 for now.
For the input stage the jfet input amps are just too slow (45MHz GBWP was the best mouser had!) but CMOS ones are better.
The cheapest I could find for 100MHz was this one:
http://www.ti.com/lit/ds/symlink/tlv3541.pdf

but on the other hand I'm inclined to use a and a common collector amplifier (unity gain, just converts impedances) instead of an OP amp and common emitter amplifier for the gain stage as they have higher bandwidth compared to op amps. is that a viable option or am I going down the wrong rabbit hole and just using a cmos op amp for input and a high speed op amp for gain is the better solution?  :-/O
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Voltage comparator
« Reply #34 on: May 01, 2019, 04:43:38 pm »
update:
I ran some simulations using LTSpice and the LT1116 seems to be totally useless at 20Meg (lower frequencies are ok)


So I tried the LT1016 which seems pretty bad too  :palm:


is there something wrong with my circuit? or are these comparator just not fast enough?
 

Offline duak

  • Super Contributor
  • ***
  • Posts: 1046
  • Country: ca
Re: Voltage comparator
« Reply #35 on: May 01, 2019, 06:45:36 pm »
You've got rather a lot of hysteresis there OM.  Try varying the value of R1 between 100R and 1K0.

The rise and fall times of the outputs are about what the datasheet shows.

I used the hp 5315B counter a number of times and found its triggering to be quite useable.  The LED indicator was very handy for setting the threshold.  I looked at the hp 5316B manual and see that it has some test point connections to observe trigger level.  If I were to rebuild my counter, I would add an LED indicator as well as a test point or connector to allow a scope to show the comparator output and actually see the trigger, sort of like the trigger view on some scopes.  I would also consider adding a multirange low pass filter tied to the frequency range selector to attenuate noise above the expected range.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Voltage comparator
« Reply #36 on: May 01, 2019, 09:08:22 pm »
you are absolutely right  :-DD
I added a third resistor to add a DC offset to the hysteresis and it works very well now with input voltages as low as 0.2v.
I also added a common collector amplifier which increases input impedance by beta x Remitter which should be at least 100x10k which is 1Meg, plenty good enough for now.



Again I'm debating if I should add a common emitter amplifier for the gain, or just use a high speed op amp ... fiddling with CE amplifier and biasing point etc has proven to be a nightmare  :-DD :-// |O
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16969
  • Country: us
  • DavidH
Re: Voltage comparator
« Reply #37 on: May 02, 2019, 02:51:28 am »
is there something wrong with my circuit? or are these comparator just not fast enough?

The impedance at the non-inverting input is too high.

Also, add a little bit of AC hysteresis at high frequencies with a small capacitor in parallel with R2.  Just 10s of picofarads is sufficient.

I forgot to mention it but there are some comparators with adjustable hysteresis via an external input.  I perused a few but none of them struck me as particularly suitable.

If I was going to add variable hysteresis, I would use the comparator's output to drive a diode bridge biased by adjustable currents which then drives the appropriate input.  Old fast function generators work this way.  If the hysteresis only goes in one direction, then the bridge can be replaced with just two diodes or transistors and one current source.  Despite having used this feature on the HP counters I mentioned, I am dubious that it is worth putting that much effort into but it a place in automated test gear.

Another intriguing possibility is to drive one of the offset null pins for hysteresis but most comparators lack them.

Quote
I ran some simulations using LTSpice and the LT1116 seems to be totally useless at 20Meg (lower frequencies are ok)

So I tried the LT1016 which seems pretty bad too

The LT1016 is good up to about 50 MHz.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf