Adding Voltages

Thread Starter

Arjuna1

Joined Dec 1, 2020
9
I am working on detecting fingers being placed on guitar frets. My idea is to run a small voltage through each of the strings, a different voltage for each string. The player touches the string and makes the string touch the fret. On the end of the fret I detect the voltage with a micro-controller. Since each string has a different voltage, I know which string is touching the fret. So far, so good. But when two strings touch the same fret, I don't get the addition of the two voltages. The voltage goes down.

I am using a 5V input and then using resistors as voltage dividers to get the different voltages for each string. See pictures attached.
 

Attachments

crutschow

Joined Mar 14, 2008
25,980
But when two strings touch the same fret, I don't get the addition of the two voltages. The voltage goes down.
Sorry but your wiring diagram is not clear about how everything is connected.
Please post a schematic of what you have (schematics are the language of electronics).
 

KeithWalker

Joined Jul 10, 2017
1,386
It would be easier to detect them digitally. Connect each string to +5V through a 10K resistor with each junction connected to a separate digital input. Ground the fret. That would give you a correct input regardless of how many strings contact the fret.
Regards,
Keith
 

eetech00

Joined Jun 8, 2013
2,162
It would be easier to detect them digitally. Connect each string to +5V through a 10K resistor with each junction connected to a separate digital input. Ground the fret. That would give you a correct input regardless of how many strings contact the fret.
Regards,
Keith
But may loose the analog quality of the sound. I think he might want to retain the analog signal to be able to reproduce sound from string bends, harmonics, etc..
 

KeithWalker

Joined Jul 10, 2017
1,386
But may loose the analog quality of the sound. I think he might want to retain the analog signal to be able to reproduce sound from string bends, harmonics, etc..
Why do you think that would change the quality of the sound? He is just trying to detect which strings touch the fret, not to record the sound with the microcontroller.
 

djsfantasi

Joined Apr 11, 2010
7,187
It would be easier to detect them digitally. Connect each string to +5V through a 10K resistor with each junction connected to a separate digital input. Ground the fret. That would give you a correct input regardless of how many strings contact the fret.
Regards,
Keith
The problem with the digital approach is that you could detect which strings are contacting a fret... but not which fret is being contacted.

I was considering an R2R DAC, but that suffers the same restriction.

Consider the case where two strings contact the nth fret and a third string contacts the (n+1)th fret... How would you detect that? Not an unusual use case, because it would occur when playing a chord.

The TS solution has a uP attached to every fret. Thus, the solution desired has an output on every fret. Not on every string, as the digital solution or R2R DAC results.

This is the challenge the TS has presented us.
 

BobTPH

Joined Jun 5, 2013
2,721
You need to scan this like a keypad or keyboard multiplexer. There are 6 strings. You scan the 6 strings by putting a voltage them one at a time for some period. In each period, you then read the voltage on each fret. The lowest fret that has the voltage is the one that has been fingered, if any. Each fret needs a pulldown to ground so that unfingered frets will read zero.

Look up keypad multiplexing to get an idea how this works.

Bob
 

Thread Starter

Arjuna1

Joined Dec 1, 2020
9
Thanks for all the comments. I made a new diagram (attached) to explain better what I am trying to do. I think the problem is that all the different voltages are connected to the same 5V power source. When a string touches the fret it gives the correct reading. But if two strings touch the same fret the voltage becomes the same (and close to the lowest one) across the whole circuit. I would need to somehow isolate the divided voltages as if they where individual power sources?

I should add that I am trying to detect which strings are touching the fret. So it is not enough to know that two strings are touching a fret, but also to know which strings. So my plan was to send voltages that in Arduino values would look be ideally 10 (for the first string), 20 (for the second string), 40, 80, 160 and 320. So if I got a reading of 30 I would know that it must be the 1st and 2nd string that are touching the fret.

I think @BobTPH gave a very nice digital solution using a multiplexer (second attachment). I'll probably go with that. (Although I'm still curious if the above approach is still somehow possible)
 

Attachments

Last edited:

Thread Starter

Arjuna1

Joined Dec 1, 2020
9
It would be easier to detect them digitally. Connect each string to +5V through a 10K resistor with each junction connected to a separate digital input. Ground the fret. That would give you a correct input regardless of how many strings contact the fret.
Regards,
Keith
I'm curious about your solution but being a complete electronics noob I am not able to follow. Do you mean that every string would be powered by the same 5V source and each having a 10K resistor between the power source and the string? I am lost when you say "junction connected to a separate digital input".

Would the input allow me to know which strings are touching the fret?
 

Marley

Joined Apr 4, 2016
384
The digital scanning system is the way to go. Especially as you are using a micro-controller already.

It might be better to scan the frets - as this can be done with an external shift register connected to as few as 2 micro-controller output pins (data & clock). A single bit clocks through the shift register. Then use open drain NMOS transistors on each s/r output to pull each fret down to 0V one at a time. When not selected, the fret will be floating (not connected). This can be done quite fast, say 50 scans per second.

You can get ICs that have a shift register and open drain transistors in the same device. Such as this. Or even better, this 32 output device.

Then connect each string to a controller input to read any voltage and at what time. Have pull-up resistors on each string to +5V. This can often be done inside the micro-controller (weak pull-up).

So with 6 strings you would only need 8 I/O.

Not being a guitarist, I don't know what happens when a number of strings are simultaneously touching many frets. Probably need a bit of thought.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
7,187
@Marley and @BobTPH have the approach that I believe will work and be the best for you. Your initial description mentioned one microprocessor (uP) per fret. His solution used just one uP.

Basically, using shift registers, you will scan each fret and with individual GPIOs, you will also scan each string. So, in effect you will scan each string/fret location many times each second. The locations where a string is pressed will return a different value than the other locations. Note that you don’t need different voltages. Your scanned location identified both string and fret. This will give you the data you need! And without a multiplexor or shift register, an Arduino Mega will have enough pins.
 
Last edited:

AnalogKid

Joined Aug 1, 2013
8,804
Connect each string to +5V through a 10K resistor
You are half way there. Connect each string to the +5 V through a different resistor.

Specifically, binary-weighted resistance values. For six strings, that would be something like 1K, 2K, 3.9K 8.2K, 16K, 33K. The current available at each fret will vary over a 64:1 range, with a unique value for every possible string combination. The guitar now is a D/A converter, with the digital bits being the player's fingers.

I used 5% resistor values above, but the closest 1% resistor values will work much better.

ak
 
Top