Guitar Note Detection With Shift Register

Thread Starter

Arjuna1

Joined Dec 1, 2020
11
I am working on a guitar note detection project with Arduino.

It works by sending output HIGH to the frets one fret at a time and then for each fret that is HIGH, loop through the 6 string inputs and check if it is HIGH.

It works fine as long as only one fret is touching one string. But if an input-string touches two outputs (two guitar frets), it reads LOW always (it is touching two outputs, but actually only one of them is high at a time). Is the voltage somehow being lost when this happens, or what is happening? If I figure that out maybe I can think of a workaround.

Thanks!
 

Attachments

djsfantasi

Joined Apr 11, 2010
9,156
Since one string is low and the other string is high, you’re shorting the two together which results in a low. You may have to add a diode (Schottky preferred) in each output, with the cathode pointing toward the strings.
 

LesJones

Joined Jan 8, 2017
4,174
An alternative would be to have the bit in the data direction register set (As output.) for the bit you are outputting at the time. All the other bits in the DDR that are not driving the the high signal to the fret would be set to 0 (As an input) so they could not pull that bit low.

Les.
 

djsfantasi

Joined Apr 11, 2010
9,156
An alternative would be to have the bit in the data direction register set (As output.) for the bit you are outputting at the time. All the other bits in the DDR that are not driving the the high signal to the fret would be set to 0 (As an input) so they could not pull that bit low.
Or in the Arduino IDE, set the pin corresponding to the string you want to read as an OUTPUT and all other strings as an INPUT using pinmode(). That way the unused pins are high impedance and won’t affect the pin being sensed. This is the same thing Les was saying, but his it’s done with an Arduino.
 

Thread Starter

Arjuna1

Joined Dec 1, 2020
11
Or in the Arduino IDE, set the pin corresponding to the string you want to read as an OUTPUT and all other strings as an INPUT using pinmode(). That way the unused pins are high impedance and won’t affect the pin being sensed. This is the same thing Les was saying, but his it’s done with an Arduino.
Ah! I think you guys cracked it with the setting as input solution! I'll give it a try!


Since one string is low and the other string is high, you’re shorting the two together which results in a low. You may have to add a diode (Schottky preferred) in each output, with the cathode pointing toward the strings.
I also want to look into how this works just for learning purposes.

Thanks!
 
Top