Help with comparator in LTspice? Ensuring 0V output? - Page 1
Forum section: electronics / beginners

author: bluebreak
author_rank: Newbie
timestamp: October 09, 2018, 11:58:21 pm
content: Trying to build a simple comparator based on the LT1011 in LTspice that will output an arbitrary voltage (in this case, 0.5V) when the input signal is under an arbitrary voltage (also 0.5V here).The comparator seems to pull up the voltage fine, but when the input is above the threshold it appears to output about 150mv in the simulation. Is there a simple way of pulling this down as close to 0V as possible?

author: Ian.M
author_rank: Super Contributor
timestamp: October 10, 2018, 02:04:48 am
content: What do you expect from a comparator with a BJT open collector output? Its ability to pull low is limited by its Vce_sat. If you wanted it to go to 0V, you'd need to find a MOSFET output one and a LTspice model for it

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 10, 2018, 02:07:10 am
content: What are you actually doing?For example, if this is a reference voltage for another circuit, consider using analog switches (don't forget to include their resistance!) with a reference voltage divider and/or voltage buffer.Tim

author: floobydust
author_rank: Super Contributor
timestamp: October 10, 2018, 02:38:56 am
content: Your -V source seems backwards in the schematic/sim

author: bluebreak
author_rank: Newbie
timestamp: October 10, 2018, 02:39:34 am
content: I'm trying to simulate a gate/trigger for an analog synth, providing a control voltage out if input is below a threshold.So analog switch (mosfet) driven from the comparator is a better way to go?

author: bluebreak
author_rank: Newbie
timestamp: October 10, 2018, 02:48:12 am
content: Quote from: floobydust on October 10, 2018, 02:38:56 amIs this with regard to the -/+ ins for the input signal and the ref? I kept it this way because I wanted it to trigger if the input signal is below the threshold. If I flip the -/+ it triggers when the input signal is above. Is that an ok practice for a comparator?

author: Zero999
author_rank: Super Contributor
timestamp: October 10, 2018, 10:03:02 am
content: Quote from: bluebreak on October 10, 2018, 02:39:34 amYes that would work. Pull the output up to 15V and add a 2N7000 to the output. The functions of the + and - inputs would be reversed as the MOSFET would perform an inverting function.Another option would be a comparator with a MOSFET output, although those typically won't work with a +/-15V supply. The maximum power supply voltage of a CMOS comparator is normally 16V.

author: bluebreak
author_rank: Newbie
timestamp: October 10, 2018, 06:45:40 pm
content: Quote from: Hero999 on October 10, 2018, 10:03:02 amThe reason for pulling up to 15 is because of the current required by the 2N7000 right? (the gate voltage threshold for 2N7000 is much lower)Would 12 also work in that case?BTW, if I wanted to build a few of these on one board, what would be cheaper/better? A bunch of 2N7000s or a quad analog switch like a CD4066? Are there newer alternatives?

author: floobydust
author_rank: Super Contributor
timestamp: October 10, 2018, 08:30:58 pm
content: I draw negative voltage sources flipped, but see your approach is to spec voltage source V2 at -15V with (+) going to -15V. So that's fine.I think you will need to add hysteresis to the circuit. Any slow moving waveform can make the comparator output chatter. Simulations don't show this, so when you build the circuit you may find it oscillates near the 5.000V trip point.More info here:TI Comparator with Hysteresis Reference Design

author: hugo
author_rank: Regular Contributor
timestamp: October 11, 2018, 12:59:02 am
content: Take a look at this circuit ...

author: bluebreak
author_rank: Newbie
timestamp: October 11, 2018, 03:27:56 am
content: Very nice HugoAre those transient peaks I see from lack of a hysterisis loop in the circuit or could those just be smoothed out with a filter cap? Otherwise it looks excellent for my usage

author: Zero999
author_rank: Super Contributor
timestamp: October 11, 2018, 08:24:05 am
content: Quote from: bluebreak on October 10, 2018, 06:45:40 pmThe 2N7000 only draws a current to charge up its gate capacitance. Once it's on, the gate takes no current at all. I only suggested 15V, because it's the power supply voltage. There's no reason why a lower voltage can't be used. Normally it's desirable to use a much higher voltage than the threshold voltage to ensure a low on resistance, but in this case the drain current is so tiny, it won't matter.QuoteThe 2N7000 will be better than the CD4066, because it has a lower on resistance, therefore will be able to pull the voltage down more. I don't know about cost. Look at the prices wherever you buy components from.Another possibility is a CMOS gate with an open drain output, such as the 74HC07 or 74LVC07, but they have a maximum supply voltage of around 5V.https://biakom.com/pdf/TC74HC07AP_Toshiba.pdfhttps://assets.nexperia.com/documents/data-sheet/74LVC07A.pdfI was going to suggest the 74C604, which will work up to 18V but it seems to be obsolete.http://www.mouser.com/ds/2/149/MM74C906-356201.pdf

author: Ian.M
author_rank: Super Contributor
timestamp: October 11, 2018, 10:57:58 am
content: Get rid of the pullup to the control voltage (CV) level and use a SPDT analog switch to select between the desired CV level and Gnd. e.g.CD4053 triple SPDT analog switch.It will work with your existing +15V supply, if powered between +15V and Gnd. You will still need the pullup to +15V on the comparator output.