This is an electric guitar. lol.
Let's establish a few facts first:
- Guitar strings are conductive (sorry nylon fans).
- Guitar frets are conductive.
- To reduce noise through the pickups, guitar strings are grounded through the bridge.
See where I'm going with this? Maybe a picture will help.
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.
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!
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.
Fretboard radius Something I found out during this project -- a guitar fretboard isn't flat, it's curved! I got the thinnest fretboard that didn't cause a gigantic jump in price but it still isn't thin enough that I'd be comfortable bending it to glue it to a guitar neck. The current board is 1mm, but 0.6 would probably work. I could also use a flex pcb.
Too many cutouts to file down There's a a few gaps on the pcb and hte goal was to file down frets between them. There are too many things to file down, this is a mistake. I found a 'fret tang nipper' that can clip the tang off of the edges of the PCB, this will make it much easier, but requires a redesign of hte PCB knowing I have this tool available. https://www.stewmac.com/luthier-tools-and-supplies/tools-by-job/tools-for-fretting/stewmac-fret-tang-nipper
cutouts too small The cutouts for the frets don't actually fit the frets! These should be a bit wider next time.
Wrong scale (oops!) This isn't a failure of the pcb/design, but I want the scale to match the one I already have on my guitar. Ooops.
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.
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.
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.
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.