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.


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?

  • \$\begingroup\$ Just curious, what kind of scope is that? Also, I would suggest outputting the schematic in black and white, that looks better in my opinion, give it a try! \$\endgroup\$ Commented Jun 17, 2012 at 17:30
  • \$\begingroup\$ It's Soundcard Scope. \$\endgroup\$ Commented Jun 17, 2012 at 21:07

1 Answer 1


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.

  • \$\begingroup\$ In the simulation I used a generic 1458, as the MC1458 didn't have a simulation model. What opamp would you recommend for the kind of voltages involved here? In the end I want to power the whole thing from a single 9V battery, if possible. \$\endgroup\$ Commented Jun 17, 2012 at 21:14
  • \$\begingroup\$ By the way, the biasing of the input worked (i get a recognizable square wave at the opamp output now). Of course you were also right about the output level being too low. I biased in another 3.3 volts after the output and the pic reacts to plucked strings now. Also, my pitch detection algorithm seems to work! Of course, all those voltage dividers take up too much space, so I'll still have to look into better suited op amps. But for now a very big THANKS for helping me to my first little success with this circuit. \$\endgroup\$ Commented Jun 17, 2012 at 22:20
  • \$\begingroup\$ @WolfgangGroiss - Digikey has an excellent selection tool for finding the right opamp, but I was wondering why you wouldn't use a comparator. Opamps are much slower, especially when you don't limit the gain via negative feedback. \$\endgroup\$
    – stevenvh
    Commented Jun 18, 2012 at 12:26
  • \$\begingroup\$ Thanks for the link, and also thanks for the question. I simply didn't consider using a comparator but that does indeed seem to be exactly what i'm looking for. \$\endgroup\$ Commented Jun 18, 2012 at 13:38
  • \$\begingroup\$ @WolfgangGroiss - A few more things about comparators: 1) comparators often have hysteresis built-in, but that may be too little for your application. 2) many comparators have open collector output. If you need extra hysteresis, don't forget that the pull-up resistor at the output is part of the hysteresis feedback network! \$\endgroup\$
    – stevenvh
    Commented Jun 19, 2012 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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