This is a tough one.
_____________________Dec 20, 2017, update:_____________________
I lost some original footages and pictures of this project, but I hope you can remember this tiny mandolin, which was working beautifully in the class. I even played a Knocking On Heaven’s Door at class.
Initially, I made a drum machine, which can play four sound of drums, including bass drum, snare, hi-hat, and crash.
However, I find it boring, so I tear it down and try to build a —-
My plan was simple and perfect: a neck made of cardboard, six strings made of staples, and frets made of toothpicks. When our finger touches the staple, a circuit closed, and Arduino can play a sound.
Then the challenge surprised me:
1. I plan to make a guitar can play real cord in the first fretting hand position. However, even first-hand position have 30 different notes.
1. Firstly I tried to use 74SN595 to expand the io of Arduino. Needless to say, I failed. I can’t finish it by what I learn now.
2. And then I come up with an idea that using four resistors in serial, and 0 resisters represent 0 frets, one resistor represents 1fret, etc. This makes it available that by analogRead, I can know how many resistors are working, so I can play the corresponding sound!
1. I tested it on one string, it works!
2. The I expand it to 2 strings, a problem emerges! I can not play 2 note at the same time by the function “tone().”
1. I checked the community, in which they assure me that “tone()” function is not capable of playing two notes at once.
2. But I find a third party library, which can play multiple sounds at once! Problem solved! Now I can play chords!
3. And then, when I expand it to 6 strings, another problem occurs. The change of the voltage of a string would affect the analog read of an adjacent string! I don’t know why, but it makes my logic unavailable.
1. No solution, I have to give up this way.
This is how it ends up like:
I was so close! I cannot just give up!
I have to use the digital input, but I don’t have so many pins, what can I do?
Then I got this.:
Yes, I can use two pins to represent four status, three pins to represent nine states!
If I make six strings and each of them has five frets, I will need six pins for speakers and 18 pins for frets and one pin for the pick. It’s 25 pins, Arduino still can not make it.
And I remember that when the third party tone library plays six notes at once, the Arduino gets dead quickly. I think it’s limited by the hardware performance of Arduino.
So I’d better just make a ukulele, which only needs four strings.
And I’d better only make three frets for it so that I can save a pin. Using three pins to represent five status is overkill.
Let’s do it!
Firstly, using push buttons instead of staples, I built a prototype.
When I finished the prototype of the 4th string, I find that this library can only play three notes at once, so I have to eliminate one string again. Now, what’s this, a banjo?
Forget about it, the most important thing is, finally, now I can play chords on it!