Thoughts on approach to sensing frets and strings pressed together on a guitar?

I have a project in mind that would require me to sense when a specific guitar string was pressed onto a specific fret. I've played around with a few ideas, but I'm unsure about whether or not they are feasible.

One thought I had was to treat each string and fret as one half of a switch, whereby pressing a string to a fret would close the circuit. However, I'm concerned about the safety of touching what I think would be live wires. Is it possible to run a small enough current through the strings that would be safe to touch in this way?

Another area I explored was capacitive sensing. It's my understanding that making capacitive sensors out of each string should be able to detect when a string was touched. I supposed that the same could also be done with the frets, but a person's fingers don't always directly touch the frets themselves when fingering things on a guitar.

I'm waiting on a bunch of 1M and 10M resistors in the mail. In the meantime I'm without the proper components to test the capacitive method myself.

Given that a guitar fretboard is basically a matrix of conductors, I'm sure there has to be a good way to approach sensing the connections between the two layers of strings and frets.

Are either of the two methods I described feasible for this task? Or is there a better way I could go about trying to accomplish this?

I'm fairly new to working with electronics, so please forgive me if any of what I said screams ignorance.

The strings and frets would effectively be a keypad matrix of rows and columns

How many strings are there and how many frets need to be detected ?

UKHeliBob:
How many strings are there and how many frets need to be detected ?

Standard 6 strings, with 22 frets total (on the one I'm using anyway)

My main concern is running current though the strings. I'm unsure whether or not it would be safe to touch, or even play. And if it is, my next concern would be the amount of current that would be safe to run through it.

Some difficulties with this idea. I'm no musician, but the connections between strings and frets could be very brief, I suspect, so scanning the matrix would need to be very fast to avoid missing any connections. This would take some skillful coding, maybe "direct port access" for example, so beyond beginner coding skills. But worse to come. "Ghosting" is a significant problem with matrices, unless diodes are wired in series with every switch. That won't be possible on a guitar.

But there is also good news. Your concerns about strings being "live" are completely unfounded. The voltages and currents necessary to detect the connections wouldn't be enough to make a gnat's nadgers warm.

To implement a matrix approach would require a separate wire to every fret and to every string. The strings would have to be conductive, so plain nylon or gut strings are out.

That would require a minimum of 28 connections to 28 pins, which would in turn require an Arduino Mega or external electronic circuitry to scan.

If you keep the voltage low (5 volts is all you are allowed on an Arduino input) there should be no concern about possible shocks or current flow through your strings/fingers/body.

PaulRB:
. The voltages and currents necessary to detect the connections wouldn't be enough to make a gnat's nadgers warm.

Damn. Have to scrap the gnat's nadgers warmer project.

I am also not a guitarist however I understand that guitar design varies a lot. You should specify exactly the type of guitar that you wish to use.

It has been suggested that the contact between string and fret may be so brief that it will be hard to detect. I am not sure about that. The proof of something like this is in the pudding. Don't start with a guitar, just mock up a single string and some frets and see if you can detect what you want. The string will need to be conductive.

As already noted the voltages needed will be safe. However if the guitar is an electric one then maybe (just a thought) the currents/voltages may affect the pickups?

An alternative approach could be to set up the frets as a resistor ladder and detect contact between the metal strings and the frets using analogRead(), but differentiating 26 different values would be challenging. Maybe use an Arduino with more than 10 bit resolution on the analogue inputs

Actually, looking at the original requirement

I have a project in mind that would require me to sense when a specific guitar string was pressed onto a specific fret.

is there in fact a need to detect contact between every string and every fret ?

Damn. Have to scrap the gnat’s nadgers warmer project

Twice ?

UKHeliBob:
Twice ?

Contact bounce

Try this - set a bunch inputs on your Arduino to INPUT_PULLUP. (the frets)
Touch the pins with a bare wire connected to Gnd (the string).
Does the (5V/30000 ohm internal pullup resistor) current bother you? (0.167mA). I don't think so.
Now, say you managed to touch 10 frets without any strings, for a total 1.67mA. Will that bother you? Probably not either. Probably also hard to without touching a string.

How will you connect wires to the frets? Solder them to the nutside of the fret, and run down the neck on the palmside of your hand (vs thumb side)? Or maybe less impact to string action if on the front side.
Get a roll of 30AWG wire and try it out.
Maybe thumb side would be better, less likely to wrap thumb over the E-string as you go up the fretboard (towards the guitar body) where there would be more wires.

Now the tricky part - how will you know which grounded string is touching a specific fret?

Wow! Ambitious project!

Is it possible to run a small enough current through the strings that would be safe to touch in this way?

5V is safe. Anything under 50V is considered safe by most regulatory agencies. But, if you were to get near 50V you might feel something under some conditions.

i.e. You can touch the contacts on a 9V battery with your fingers and you won't without feeling anything. You will feel or "taste" something if you touch it to your tongue! :smiley:

You'll probably be permanently altering the guitar so I recommending starting with a cheap-disposable guitar. :wink:

Each fret can have multiple strings in contact.

As for the pickups
If you power from the neck you would have less chance of current in the strings

UKHeliBob:
Twice ?

I was a fret that was gonna happen
Hope it didn't cause any dis-chord with the harmony of the group

I tried with an Ohm meter and a steel string acoustic, and it does show continuity when the string contacts the fret.

At first glance, scanning across the strings and detecting on the frets or vice versa seems feasible if one is playing open chords without a capo. If using a capo or playing a barre cord, all the strings would be shorted together at the capo fret and so you'd detect a contact on a particular fret on all strings even when only one is fretted. In switch matrices there are circuit arrangements to deal with multiple switch closures, but the usual approach of a diode per switch doesn't work for this case.

I'm curious what is the conceptual application for this.

dave-in-nj:
I was a fret that was gonna happen
Hope it didn't cause any dis-chord with the harmony of the group

Noted

Wow! Thanks for all the helpful replies so far.

I appreciate the answers quelling of my unfounded concern about running current through the wires haha.

To clarify some things:

ardly:
You should specify exactly the type of guitar that you wish to use.

An electric guitar with standard steel strings. I have an old Fender Squire Stratocaster that I can use for reference and perhaps some testing. The exact model doesn't necessarily matter, however, because my plan would be to build/assemble a guitar with a working sensor system integrated into it.

UKHeliBob:
An alternative approach could be to set up the frets as a resistor ladder and detect contact between the metal strings and the frets using analogRead(), but differentiating 26 different values would be challenging.

Interesting. I'll have to look into that.

UKHeliBob:
Actually, looking at the original requirementis there in fact a need to detect contact between every string and every fret ?

Essentially, yes. The goal would be to be able to read each possible contact point, where each possible contact point is at the intersection of a string and a fret. However, a maximum of six contact points would have to be read simultaneously (one per string).

CrossRoads:
How will you connect wires to the frets?

I'd probably just construct a rig that resembles the relevant parts on a guitar in order to test the proof of concept so I don't worry about ruining my only electric guitar haha. After figuring out a working system, I intend to build/assemble a guitar with the system integrated into it. For any fret connections, I'm thinking I can wire them inside the neck of the guitar itself.

MrMark:
I'm curious what is the conceptual application for this.

My intention is to prototype an interactive guitar that can aid in learning how to play. I have a background in music, and I just built my first MIDI controller from scratch this year. I've been drafting conceptual ideas for this guitar prototype for about a year now, but I am struggling to figure out how to implement the necessary touch sensing.

UKHeliBob:
An alternative approach could be to set up the frets as a resistor ladder and detect contact between the metal strings and the frets using analogRead(), but differentiating 26 different values would be challenging. Maybe use an Arduino with more than 10 bit resolution on the analogue inputs

Actually, looking at the original requirementis there in fact a need to detect contact between every string and every fret ?

Could you not split the frets between two or more ladders reducing the resolution required?

dave-in-nj:
Each fret can have multiple strings in contact.

As for the pickups
If you power from the neck you would have less chance of current in the strings

Are you saying that having current in the strings might affect pickups, particularly passive ones?

Also don't guitarists, including electric guitarists, use metal capos which would short out all the strings which would be a big design consideration.

In fact what about vibrato arms, does the Fender Squire Stratocaster have one and would it also short the strings?

Could you not split the frets between two or more ladders reducing the resolution required?

I wondered about that but wanted to keep the number analogRead()s to a minimum. They are relatively slow and need to be done twice for each string in order to make sure that the ADC value has settled as most Arduino have only one and switch it between inputs when required