Too Automatic

A project log for Accesible Guitar Tuner

A guitar tuner with audio feedback for bind guitarists

pepijn-de-vosPepijn de Vos 09/21/2017 at 17:160 Comments

Over the last few days I've been debugging the input stage. This stage consists of a high-impedance buffer and an automatic gain control stage.

First up, the input buffer. Because piezo elements act like a really tiny capacitance, any input resistance forms an RC filter with the piezo. So in order to have a good frequency response for low notes, an input impedance of many megaohms is needed. A good way to achieve this is to bootstrap the input from the output, so that effectively, no voltage drops over the bias resistor.

However, this means you apply positive feedback, with brings the risk of oscillation. While it seemed to work while I tested the whole circuit, when I tried to measure this particular part, it oscillated all over the place. For now I simply removed the bootstrap circuit so that the impedance is lower, but it's more stable for now.

But now I get to the most complicated circuit on the board: the automatic gain control circuit. At this point, nothing makes sense and everything either works perfectly or oscillates all over the place depending how you look at it and how you hold the probes.

I programmed the AVR to go to sleep, which seemed the reduce the amount of batshit crazy signals I was seeing. This suggests to me that the isolation between the analogue and digital circuit is not good enough. But this does not explain all of it, as I'm still seeing some things I can't explain.

My original plan was to make an XY plot of the amplitude of the input versus the output, so I could see how the gain was being controlled.

The resulting plot made no sense, so I did some more debugging. When I finally zoomed out far enough to notice, I was quite startled.

What you see here is that the peak detection capacitor discharges slowly, increasing the gain until it hits the turn-on point on the JFET, causing it to peak, completely charge the capacitor, and slowly discharge again.

Maybe I should tweak the turn-on point, maybe I should tweak the gain on the JFET, maybe I should add a charging resistor so the peak detector increases more gradually, maybe I should not use feedback but only feedforward to avoid any stability concerns, or maybe I should ditch the entire AGC stage and come up with something better.

It suffices to say that making a guitar tuner is not that hard, making a usable product is a monumental challenge.