My friend @rpschultz and I have been building an open source guitar tuner and are getting close on a final hardware enclosure design and have switched to a different flavor of ESP32-S3 that has an attached 2.8" screen. We made a lot of progress in this other thread getting the control circuit for the DPDT relay and that part is all working.
We've been using a simple op amp circuit and passing in an amplified guitar signal into the ESP32 for pitch detection, but in some simple tests using a hex inverter IC I noticed that tuning stability might be even better if I could send in square waves into the ADC of the ESP32. The algorithm I'm using for pitch detection is extremely fast because it's a zero-crossing algorithm. The pitch detection seems to get a lot smoother when I pass in square waves rather than the raw audio (which we were intentionally making clip anyway). However, when the input level dropped lower (especially true on the high strings of the guitar), the pitch information has been tailing off too quickly.
Here's a possible alternative circuit that uses 3x 2N3904 basic transistors as a simple preamp and Schmitt Trigger for generating the square wave output and then it's clamped at 3.3V with a 1N4728A Zener Diode. This seems to "work" well in LTspice all the way down to 20mA and also handles much higher inputs.
One thing I would have to add is to read the incoming voltage using another ADC GPIO (GPIO15_CTL on the schematic) so that I could use it as a noise gate for when the signal level gets low enough. I think, without that, the tuner would pick up noise and try interpreting it as frequency. Maybe ideally it'd be possible to have the output of the schmitt trigger not send anything if the incoming signal dropped below 30mA?
Does this look sane?
Here's a screenshot of the schematic and also the simulation at 20mV, 100mV (typical output of my tele), 300mV (typical output of one of my humbucker guitars), and 1000mV (crazy high, but it still seems to work).





We've been using a simple op amp circuit and passing in an amplified guitar signal into the ESP32 for pitch detection, but in some simple tests using a hex inverter IC I noticed that tuning stability might be even better if I could send in square waves into the ADC of the ESP32. The algorithm I'm using for pitch detection is extremely fast because it's a zero-crossing algorithm. The pitch detection seems to get a lot smoother when I pass in square waves rather than the raw audio (which we were intentionally making clip anyway). However, when the input level dropped lower (especially true on the high strings of the guitar), the pitch information has been tailing off too quickly.
Here's a possible alternative circuit that uses 3x 2N3904 basic transistors as a simple preamp and Schmitt Trigger for generating the square wave output and then it's clamped at 3.3V with a 1N4728A Zener Diode. This seems to "work" well in LTspice all the way down to 20mA and also handles much higher inputs.
One thing I would have to add is to read the incoming voltage using another ADC GPIO (GPIO15_CTL on the schematic) so that I could use it as a noise gate for when the signal level gets low enough. I think, without that, the tuner would pick up noise and try interpreting it as frequency. Maybe ideally it'd be possible to have the output of the schmitt trigger not send anything if the incoming signal dropped below 30mA?
Does this look sane?
Here's a screenshot of the schematic and also the simulation at 20mV, 100mV (typical output of my tele), 300mV (typical output of one of my humbucker guitars), and 1000mV (crazy high, but it still seems to work).





Last edited:






