FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 

comparing comparators
MUFF WIGGLER Forum Index -> Music Tech DIY  
Author comparing comparators
so, ive been thinking about comparators lately. and unlike opamps, there really isnt this grand variety of comparators at cheap price points that do almost everything you want. there are a fair bit of comparators, but most of them dont get really good until a relatively high price point (>1$ @qty 100*).

over the next week i will populate this post with a small table of the more notable comparators, and some reflections on the relative tradeoffs. if you have any favorites youd like to share, please post them!

here are the top 50 comparators under 1$!!! (buzzfeed headlines for EEs)

- prices are digikey prices, and they are probably cheaper elsewhere, but i figured it would give a rough enough ordering.

- let me know if you find any errors, and ill update the document. ive already found a few.

so basically, you have bipolar and FET based comparators. the bipolar ones tend to be faster, but have much, much higher bias current. at the low cost end, you have the LM339, LM393, and their variants. they are pretty slow at 500ns, making them only slightly better than using an opamp as a comparator. the next step up is the LM311, which is almost the same price as the low V_os LM211/111. so if you only need one comparator, the LM211 has better offset voltage and a 150ns delay time (vs the LM339). the LM319 pricing is all over the place, but can usually be had for the same price as the LM211, but its a dual, and has a delay of 50ns. there is the better V_os LM119/219, but its at least twice the price. so, for very low cost, high speed designs, the LM319 is the best bet. the next level up is the LM306, which has delays as low as 10ns, but costs 4x, is a single unit, and has 1000x the bias current. bonus on the LM306 and LM311 is that they have strobe inputs, making hard sync easier.

the FET based comparators seem to be geared towards low power (some in the sub-microamp power range), and as a result the speed suffers. many also have built in hysterisis, which seems like a detractor to me. but, they do come in rail-to-rail output, which i see as a plus. on the cheap side, the TC75S57/9 have pA level bias current, and 140ns delay times. this makes it very similar to the LM219, but with much lower bias current, and only being able to handle a 5V rail. the MCP6561/6 is similar in speed and cost to the LM319, but is only a single, and has pA bias current and 5V rails. the TLV3201/2 is also worth looking at for this range, although twice the price. the dual is the same price as the single, so a decent value if you need 2. to get better peformance youll have to go to the 0.96$ MAX9109 which has 25ns delay times, but 125nA bias current (probaby a bipolar input stage). it also has a latch enable, which i assume holds the current state regardless of input, which would be good for making sigma delta converters.

ill continue the discussion in posts, rather than here, unless it seems like a generically useful piece of information.

i would like to start off with a comparator that is not actually a comparator: the 74HC14 schmitt trigger inverter. the upsides to the HC14 are that its cheap (0.2$ and 6 per package), its fast (~30ns propogation delay), and its low bias current (<100pA typ at 25C). the downsides are that the comparison point and hysterisis are not settable, it draws a fair bit of current during transitions, has a lot of crosstalk, and varies a fair bit from part to part and with temperature. the crosstalk issues are particularly annoying, as it limits the effectiveness of using multiple parts in a package for oscillators, as they tend to sync if too close in frequency. careful attention to layout and bypass capacitors can help minimize these problems.

i ran some tests on an HC14, and it did so much better than expected that i thought id share. i was curious how bad the leakage current and hysterisis threshold drift were with temperature. so i built up an oscillator and hit it with a heat gun. the leakage current was around 40pA over the whole range; slightly lower at lower input voltages. this leakage current stayed pretty constant for moderate temperatures, and then moved up to 100pA for the 65C range, and then 200pA for 85C. the hysterisis didnt move much for the 65C range, and moved up 5mV at 85C. the total hysterisis was 1.2V, and the top threshold went up 10mV, and the bottom up by 5mV. its also important to note that the chip was painfully hot at this point. granted, this was just one inverter in a package that i tested, so who knows what the spread is like.

* for those wondering why i picked qty 100, it has to do with the fact that i always keep an eye towards production. i feel like price doesnt matter a whole lot for one offs i make for myself. a 3$ comparator isnt going to break the bank, but the difference between 0.2$ and 0.7$ can really add up fast when producing at moderate volumes. sale prices are usually 4x cost, so an extra 0.5$ of BOM cost is an extra 2$ for the conusmer.
Did you ever used single schmitt-triggers-inverters? LIKE THIS
unlike opamps

I thought opamps were comparators woah
posting "comparing comparators" in Muffs DIY section means we are mainly talking about comparators in VCOs, right ?
I ask, because I think it would be interesting to measure propagation delay depending on input slew rate (saw/tri freq.)
I've done this for the CMOS version of the 555, because I wanted to know why all VCOs with 7555 core go so flat in the higher octaves.
Indeed the CMOS 555 is much worse than the bipolar version in terms of slew rate dependent switching delay:
VDD=12..15V :
Fin 2.5kHz 5k 10k 20k
Tdly 2.5us 2.2us 1.3us 0.8us
(bip. NE555: 250ns @ 5..20kHz Fin and VCC=15V)

Maybe you could measure propagation delay with your HC14 RC oscillator setup. Measuring switching delay time directly by watching the triangle overshoot while triggering close to the threshold with a scope was possible with the CMOS-555. BTW: put both 555 versions on your list :-)

Back to 74xx and 4xxx Schmitt Trigger : the only one with datasheet specified good temperature behavior was the (obsolete) 74LS13, which was used in the Elektor Formant VCO for this reason.
And ST datasheets show less useful temperature specs the younger they are ( maybe that is a general problem with datasheets...): some manufacturers of HC14 have at least some crude information,
but new generation single gate ST datasheets, like 74AHC1G14, are useless for analog designers.
EDIT: just see Grumble already suggested this
At least 74AHC1G14 are cheap and with good power supply filtering you don't have the frequency locking problem of the 74HC14 in multi oscillators.
74HC2G04GV would be an option for making your own ST with adjustable (resistor ratio) hysteresis. In case that the temperature dependency of the thresholds is reproduceable, on could even think
about supplying them with a temp. dependent VDD from NTC/R network buffered by a single opamp.

Another interesting single gate ST is to use a '3157 analog SPDT switch as a noninverting ST:

These analog switches are really cheap, below 10c @100, and are made by at least 6 manufacturers nowadays.
And they have impressive specs: (here SN74LVC1G3157) 6Ohm Ron, ~1ns Tpd
I'm just prototyping some high speed VCOs using these switches; looks promising, will post results soon.

I also like modern R2R CMOS comparators with push pull outputs. Although the are limited to 5..6V max. supply voltage and most of them come in ugly SOT-23-5 or SC-70-5 SMT cases, the show impressive low offset drifts.
searching for "cmos comparators push pull" @ mouser leads to >200 results...
I have used the 74LS13 for my VCO Core one a clone of the Elekor Formant VCO with some features added. I know that the 7413 / 74LS13 is obsolete now, but I think it is worth a closer look for comparison. The temperature behavior is interesting here.
I've used the TL331 in an oscillator - not the cheapest, but it's a single comparator in a sot23-5 package.
this thread just got way more interesting than i thought it was going to be.

Grumble: thanks for the tip on the single units, thats a great solution to the crosstalk issue.

degeneratedsines: yes, opamps can be used as comparators, the main downside is that they are slow, but that isnt always critical.

elektrouwe: yes, im mostly approaching this from an oscillator perspective, but hoping it will be generally useful. ive been doing some tests measuring propogation delay at essentially 0mV overdrive (tri core), and its really bad. the HC14 still works well here, though. ill take a look at some of your suggestions, but the analog switch is great. the main limitation in the HF VCO i made recently was the switching time of the LM13700 (~100ns), and i was thinking that maybe analog switches could swith a current faster, in particular if i kept the collector shorted to ground when not charging the cap, that way the transistor doesnt have to come out of saturation, and charge isnt transferred to the miller capacitance during the switch.

Heralds:Werk and trip: thanks for the suggestions, ill check them out.
Grumble wrote:
Did you ever used single schmitt-triggers-inverters? LIKE THIS

I use a single Schmitt-Trigger Inverter like that, but mainly as a single inverter for logic. (when I don't want a multi-gate package) It's from Toshiba. I'll see if I can find the part number. It's very similar though.

I think it was some version of this one: ug7Bjdm9giskhjuD2QrJeSMOKL34CGRn9I%3d

As far as comparator ICs go, I've only used them in lower speed (audio VCO) applications, so the switching speed isn't absolutely critical. I haven't done much in the way of analysis at all. They were mainly picked for features or ease of use for the application.

I've used:

LM393 (dual)
TLC339 (quad)

The LM393 is the slowest of these, but is in one of my best performing VCOs hihi I think it has a 300ns (average) switching time. I haven't thoroughly checked the graphs in the datasheet.
so i did some looking at the 74LS13, and assuredly it has a really flat temperature response on the positive threshold, but the negative isnt so great, which maybe doesnt matter depending upon how its used (eg sawtooth versus triangle core). i also found that the 74LS132 is still in production, and has the same temperature response, although its a NAND.
I like the LM111, and use the Linear Technology version the LT1011 in my Triangle VCO cores.

That period of National Semiconductor really did yield a lot of classic ICs!

I've seen opamps used as comparators before. You would need to use a decompensated one, and you'd need to think about what happens when the opamp hits the rails, which they are not designed to do really.

Comparators generally have asymmetric rise and fall times, opamps, though slower, are more likely to have symmetric ones which might be good for VCOs, although they won't have outputs designed to drive switches/JFETs , etc.
degeneratedsines: There's a very good appnote by I think TI on pitfalls and solutions when using Op Amps as comparators. Wong computer right now to give exact name number. A search on using opamps as comparators will likely turn it up.

guest: Would like to see Thomas Henry's preferred discrete comparator for his VCOs included in this discussion.
I will look into that, thanks KSS & slow_riot. I knew that opamps can be setup as schmitt triggers, but it would be interresting for me to understand the pitfalls indeed.
KSS wrote:
Would like to see Thomas Henry's preferred discrete comparator for his VCOs included in this discussion.

i had a quick look at the one he used in VCO-1, which is of a very similar topology to whats used inside of the 74LS14. it looks like it would have similar performance, but will build one up and test. one thing to note, is that it has high input bias current, and this current is dependent upon output state. when the output is high, it has very little bias current, and when it is low the current varies with the input amplitude.
i reran my HC14 tests, and was a little more thorough this time around.

as you can see, there is actually a fair bit of drift on the positive threshold, and next to none on the negative. this performance is very similar to the LS14, but with the thresholds reversed. its around 155uV/C, which is pretty bad compared to the 18uV/C of the TL072 (i cant find these specs for the LM311 or LM393). the total hysteriss is 1.2V, so for a 30C rise (which is pretty extreme) you have 5mV change, or 0.4%, or 7cents on a VCO. and, this is an offset drift, not a scale drift, so it can be adjusted with the tune pot.
ok, so i updated the first post. the general upshot is:

high bias current (>10nA), high voltage rail (>5V):
LM339, LM393 - Q/D - 0.20$ - 550ns (OC)
LM211, LM311, LM111 - S - 0.26$ - 150ns (OC, has strobe pin)
LM319, LM219, LM119 - D - 0.36/0.75$ - 50ns (OC)
LM306 - S - 1.32$ - 20ns or less (RR, has strobe pins)

high bias current, low voltage rail (=5V)
MAX9109 - S - 0.96$ - 25ns (RR, has latch pin, and super low V_os)

low bias current (1pA), low voltage rail
TC75S57/9 - S - 0.29$ - 140ns (RR or OC out)
MCP6561/6 - S - 0.40$ - 60ns (RR or OC out)
TLV3201/2 - D/S - 1.00$ - 45ns (RR)

i still have to look at the 555 as comparator, as elektrouwe suggested.

in regards to open collector versus rail to rail outputs, you need a pretty small pullup resistor on an OC output to get fast transition times. this causes a lot of current draw on the powersupply, which can cause glitches. for this reason, i prefer RR outputs. but, it seems most RR outputs have hysterisis associated with them (except the bipolar ones). that makes the comparator less useful in some applications, and gives another variable for drift. i dont know exactly how bad this is in practice. RR also tends to have more symmetric HL/LH delay times, and is faster on LH transition.
i did some more tests on the HC14, and i think some of my results will be relevant to standard comparators as well, so ill discuss them here. for use in a VCO, the main concern is the frequency drift, either due to the addition of the propogation delay, or from thershold level changes. i tested the HC14 for propogation delay at various frequencies and integration capacitors. what i found, was that the propogation delay is much larger for lower frequencies. it could be as bad as 1.5us down in the kHz range, but since this is 0.1% error, its not really noticed. it drops down to 10ns up in the MHz range, which is now 1% error.

as the frequency increases, so does the dV/dt on the integration capacitor. this means that the level of overdrive increases for a given time after crossing the threshold. this increase in overdrive then reduces the propogation delay. at 1kHZ, the overdrive is just 2mV for a 1Vpp signal and 1us delay. but, up at 1MHz, a 10ns delay gives 20mV overdrive.

one other effect i was seeing, was the output coupling back to the input for smaller integration capacitors. down at 10pF, the capacitance on my breadboard between in and out pins is no longer negligible, and the integrataion capacitor would spike up and down by a fairly large amount.
so, i tested out the comparator thomas henry used in the VCO-1:

it didnt have very good speed performance, so i didnt bother to check the temperature performance. it was around 600ns delay time at a 20mV overdrive (the level used for the other comparators above). i made some modifications to the circuit and got this down to 150ns or so.

i had an idea about using a UJT or SCR as a comparator, as it feeds back on itself and very quickly latches to a new state. so i built this up:

and it performs pretty well. the SCR at the output has really good rise times (75ns), but not as good fall times (250ns). i think i could add some parts to fix this (like reduce output impedance), but at that point it really isnt serving much purpose as the cost will get higher than an IC. one thing i like about it, is that it should (theoretically) be very well temperature compensated. the trip point for both thresholds is the level at which the current is balanced in the diffpair. since the current is balanced, there shouldnt be any temperature dependent offset voltage.

i doubt im going to come up with a discrete design that can beat the LM319 (0.36$ for 50ns).
guest wrote:

here are the top 50 comparators under 1$!!! (buzzfeed headlines for EEs)

Very nice chart!

Just some (fairly obvious) thoughts:

1. I suppose for VCOs the offset voltage is not important, only the offset voltage drift matters. Unfortunately from your chart it looks like it is rarely specified. The winner of "cheapest fast comparator with specified offset drift" would be MCP6561/6566 at 60ns.

2. In many VCOs the comparator will (or could) be preceded by an opamp buffer, so high bias current is not such a big deal either. For the same reason offset current has little effect in those designs.
yes, those are good points. the FET based comparators tended to have offset drif specified more often than the bipolar ones. and a lot of them had charts of drift, but not a number, so i just eyeballed the chart.

for parts with built in hysterisis, its a bit more difficult to determine drift, as they sometimes give the hysterisis drift (but not always), and its unclear weather this is equal in both directions, or just one.
Indeed, I had a look at the MCP656x datasheet, and first of all the "typical" drift of 2uV/deg C is quite optimistic compared to the histogram data shown later on. Further it seems the hysteresis drift is much bigger still. I assume the hysteresis drift refers to the difference between the upper and lower threshold, so at least a triangle VCO is directly sensitive to that.
MUFF WIGGLER Forum Index -> Music Tech DIY  
Page 1 of 1
Powered by phpBB © phpBB Group