Guitar

What

This is an electric guitar. lol.

Let's establish a few facts first:

See where I'm going with this? Maybe a picture will help.

guitar_and_pcb

More hints: That is a breakout board for an FPGA and software-defined effects pedal.

This makes the whole guitar a big grid of switches, like a long keyboard! Sort of. All of the strings being grounded means this is currently just a 1D array, and we can only differentiate between frets not strings. I have some possible solutions for that in How/Strings.

How

Fret Detection

Circuit

Dead simple. I weakly pull the frets up to logic-HIGH (in my case 3v3), and when you press a string to a fret you ground the fret and pull it LOW. Ta-Da you have a switch!

circuit

Detection Board

The frets are currently soldered directly to some tiny wires and sent to the FPGA breakout board. This works well enough for a PoC.

On top of the fretboard is the first attempt at making a fretboard from a PCB. There are a number of problems with this revision and if I'm going to try to make this it requires a bunch of changes.

PCB Fretboard

PCB Sidesaddle

It's significantly smaller and this cuts cost (for such a long PCB) a lot. This is also able to be retrofitted to existing guitars. I've added an extra switch to the guitar that requires a definitive activation and not just passively from touching the frets. If the frets are extended, castellated edges on the board can be soldered directly to them.

Below is the first-draft of the layout. There are jumpers to activate LEDs, in addition to sending a signal back to the (mcu/fpga) to be processed.

pcb_wip

Strings

Frequency Analysis

Pros: Easy. Can be outsourced to the computer/pedal. Will reliably work when restringing guitar. Nylon strings will work. Cons: Can be outsourced to a computer. Only works when it's being played. New tunings will require remapping. May have to filter noise from e.g. scratching/buzzing strings. There may be 'rollover' issues where certain notes/chords are ambiguous. Non-western tunings will not work. Bends/whammy may cause problems. Methods: FFT, biquod filter

This can be accomplished with an FFT. Not sure how fast those are on a modern MCU. The esp32 has a dsp module that does FFT, and I've seen them implemented in verilog. There's also (iirc, offline right now) fastFFT and approxFFT algorithms that both return a recuded-accuracy FFT but much faster. Both are optimized for low-power microcontrollers.

Someone at supercon suggested looking into biquod filters. These are, sort of, precalculated FFTs that only look in a certain range or bucket. The advantage of this is that it's really quick. Like two multiplies and a divide quick.

I will probably implement this as an accessory feature, but do not like it as the primary control method for several reasons. First and foremost is I have this beautiful fully-analog switchboard. Why would I want to screw that up by putting a computer inline if I don't have to?

There is also going to be a delay as the computer does frequency analysis. I'm sure it could be quick enough to be unnoticeable but again -- if this can be bypassed completely why not?

Lastly this only works when playing. But on the plus side, it would work with nylon strings.

Inductance

Pros: Long, thin strings should make measuring inductance easier? Works without playing. Independent of tuning. Bends/whammy shouldn't affect it. No Computer? Cons: Vibrating over pickups may mess with this? More complicated than other methods. Different kinds of strings may require tuning/adjustment of inductance values. Disambiguating sevral strings may be difficult. Methods: Direct Measurement. Time domain reflectometry.

More complex than resistance-based methods. Should be doable without a computer.

Resistance

Pros: Wide gaps in resistance between strings. Simple. Should work regardless of tuning. Analog, No computer. Cons: Different strings may require tuning/adjustment of resistance values. Methods: Direct Measurement. R-2R ladder or similar into ADC. Timed capacitor drain.

High-E has three times teh resistance of Low-E. This is exploitable. Simple! May work better with many strings pressed than measuring inductance. This is my favorite method.