Electronic – Op-Amp based schmitt trigger working in simulation but not in reality

debuggingoperational-amplifier

I'm trying to build a simple schmitt-trigger to convert an audio input signal to an approximate square wave of the same frequency. The output of that will then be fed to a microcontroller to detect the pitch of the input signal.

The schematic of the schmitt-trigger part can be seen here.

Schematic

It works nicely in a SPICE simulation.

However, when built on a breadboard, the circuit doesn't work as expected. The scope shows the input signal in green, op-amp output in red.

enter image description here

I built it with the resistor and capacitor values as shown, around a MC1458P Op-Amp. Supply voltage is 5V (power supply is a wall-wart, not a lab supply; however a PIC18F452 and LCD character display run without glitches on it). Actual input is from a rather hot guitar pick-up, so actual AC voltage on input should be similar to the simulation.

I'm a bit stumped, as I don't quite see what could be the problem. I've tried both amps of the same IC, no difference. What would be the best way to tackle this problem?

Best Answer

Did you use the model of the MC1458 in your simulation, or a generic (ideal) opamp? In the latter case that may explain why it doesn't work. The MC1458 is not a rail-to-rail opamp, and can't work near the rails both for input and output. Especially with a low supply voltage the operating range of the opamp is very limited, and is situated around Vcc/2. The Schmitt-trigger thresholds and your input signal are way below that.

Still, the output signal looks rather strange. What's the scope's vertical resolution? Anyway, I'd try a rail-to-rail opamp first, that's something which has to be fixed anyway, and see what results that gives. BTW, you could also bias the inverting input to Vcc/2 via a resistor divider and couple the signal in via a capacitor, but you'll still have a problem with the output levels. If you use the divider, don't forget to recalculate the Schmitt-trigger resistors.