UniversalOpamp2 comparator in LTspice stuck at weird voltages

Thread Starter

TKK

Joined Dec 4, 2025
4
Hi everyone,
I'm building a circuit in LTspice using UniversalOpamp2 blocks as comparators. Each comparator reads a voltage divider (sensor / LDR), and the outputs go into an AND gate that should turn on an LED when both conditions are met.

The comparator outputs should rail to 0V or 5V so the AND gate can drive the LED.

  • Out_A stays around +0.5V
  • Out_B stays around –2.4V
  • LED current is basically 0 A

The outputs never reach the supply rails, so the LED never turns on.
Can anyone tell me where I went wrong?

2.png1.png
 

WBahn

Joined Mar 31, 2012
32,702
Why are you powering the positive supply pin of your comparators from a -5 V rail?

Why do you need six separate power supplies?

What do you expect to happen when you tie the inverting and non-inverting outputs of your AND gate together?

That aside, be very careful about using any of the idealized/universal parts. They are extremely simplified and behave in ways that don't mimic the real world very closely. They are intended for quick simulations to try out basic ideas and leave it entirely the designer's responsibility to ensure that they are not operated outside the spec'ed limits of the real-world counterparts they are filling in for.
 

crutschow

Joined Mar 14, 2008
38,316
Use one power supply and label its positive output (e.g. V+ or +5V).
Then put that label on all the plus supply nodes that use that voltage.
 

Thread Starter

TKK

Joined Dec 4, 2025
4

Attachments

WBahn

Joined Mar 31, 2012
32,702
1764864043269.png

This makes no sense. You have two 5 V supplies in series -- so it's effectively a 10 V supply. But you have the negative terminal at the top of one of your voltage dividers. You are thus powering your comparators with a 10 V supply that is in series with 22 kΩ. Your comparators need a clean, low-impedance supply.

What do you expect the output voltage of your logic gate to be when it is HI? If you say 5 V, why do you think it should be 5 V? It's a generic part. You need to set Vhigh, Vlow, and Vref. The simulator is not a mind reader.

Right-click on the part and enter the following in the SpiceLine field: Vhigh=5 Vlow=0 Ref=1.0
 

crutschow

Joined Mar 14, 2008
38,316
A little late, but below is the sim of the circuit with my modifications to use just one supply:
I varied the value of R1 and R3 versus time to show the operation of the AND gate turning on the LED.

Note that the nominal high output of the generic AND gate is just 1V so I set it to 5V.

1764871007679.png
 

Attachments

Last edited:
Top