0
\$\begingroup\$

I am trying to generate a square wave using a comparator and I am trying to simulate the whole circuit using the software Simetrix/SIMPLIS. This is the circuit I am using:

enter image description here

The first part uses a resistor and a capacitor to get an exponential from the square wave source, as we can see in this simulation result:

enter image description here

Now, with voltage divider on the inverting input of the comparator, it should take that exponential voltage, and generate a square wave that goes to 5V when the exponential is higher than 2.5V, and that goes to 0V when it is less than 2.5V.

However, the simulation does not show this on the output of the comparator. Some big spikes in the order of kilovolts arise, as we can see here:

enter image description here

I thought that something was wrong with the simulation itself, so I tried to fix it placing a resistor at the output, just like this:

enter image description here

And it looked like it worked because now the spikes disappear. However, the output never saturates to 5V as it should do, although it has the squared shape I was looking for but it is too tiny:

enter image description here

Does anyone know why is this happening? Is it something related to the components or the simulation/schematic itself?

\$\endgroup\$
0
\$\begingroup\$

The LP339 is a comparator with an open-collector output. You need a pull up resistor, not a pull down. Try using 30k\$\Omega\$ from the output to +5V.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.