Author Topic: Help with comparator in LTspice? Ensuring 0V output?  (Read 5534 times)

0 Members and 1 Guest are viewing this topic.

Offline bluebreakTopic starter

  • Newbie
  • Posts: 5
  • Country: 00
Help with comparator in LTspice? Ensuring 0V output?
« on: October 09, 2018, 11:58:21 pm »
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?
« Last Edit: October 10, 2018, 12:20:05 am by bluebreak »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #1 on: October 10, 2018, 02:04:48 am »
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
 
The following users thanked this post: bluebreak

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #2 on: October 10, 2018, 02:07:10 am »
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
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: bluebreak

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 6995
  • Country: ca
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #3 on: October 10, 2018, 02:38:56 am »
Your -V source seems backwards in the schematic/sim
 

Offline bluebreakTopic starter

  • Newbie
  • Posts: 5
  • Country: 00
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #4 on: October 10, 2018, 02:39:34 am »
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?
 

Offline bluebreakTopic starter

  • Newbie
  • Posts: 5
  • Country: 00
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #5 on: October 10, 2018, 02:48:12 am »
Your -V source seems backwards in the schematic/sim

Is 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?
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #6 on: October 10, 2018, 10:03:02 am »
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?
Yes 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.
 
The following users thanked this post: bluebreak

Offline bluebreakTopic starter

  • Newbie
  • Posts: 5
  • Country: 00
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #7 on: October 10, 2018, 06:45:40 pm »
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?
Yes 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.

The 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?
« Last Edit: October 10, 2018, 08:25:33 pm by bluebreak »
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 6995
  • Country: ca
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #8 on: October 10, 2018, 08:30:58 pm »
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
 

Online hugo

  • Regular Contributor
  • *
  • Posts: 165
  • Country: ca
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #9 on: October 11, 2018, 12:59:02 am »
Take a look at this circuit ...  ;)
« Last Edit: October 11, 2018, 01:04:49 am by hugo »
 
The following users thanked this post: bluebreak

Offline bluebreakTopic starter

  • Newbie
  • Posts: 5
  • Country: 00
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #10 on: October 11, 2018, 03:27:56 am »
Very nice Hugo :)

Are 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  :-+
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #11 on: October 11, 2018, 08:24:05 am »
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?
Yes 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.

The 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?
The 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.

Quote
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?
The 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.pdf
https://assets.nexperia.com/documents/data-sheet/74LVC07A.pdf

I 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
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Help with comparator in LTspice? Ensuring 0V output?
« Reply #12 on: October 11, 2018, 10:57:58 am »
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. 
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf