loading

Made a simple robotic one finger piano plinker using two servos, Arduino Uno, some aluminum flashing and a fishing pole for the sliding rails. You get a gold star if you can identify the ditties it plays. You probably have to be an old person like me to know a couple of them.

Step 1: Fishing Pole Rails to Slide Finger On

Used a fishing pole and cut a couple of short sections to slide outside two longer pieces. Then epoxied them too some wood connectors. Connected the two outside sliding pieces with a wooden platform on which is mounted the aluminum holder of the finger servo.

Step 2: Built "finger" From Chopsticks

Made a single joint finger from chopsticks and mounted that to a servo.

So one servo for the finger and one standard size servo for the slider.

Step 3: Connect Servos to Arduino

Connect two servos directly to Arduino Uno 5vcc,gnd and signal pins 9 and 11.

Run Arduino sketch as follows:

#include servo.h
Servo servo1,servo3;

int ledPin = 13; // select the pin for the LED

void setup() {

Serial.begin(9600);

pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT

servo1.attach(9);

delay(10);

servo1.write(110); // put finger at starting position

servo3.attach(11);

delay(10);

servo3.write(71); // position slider at starting position

delay(5000); // wait 5 seconds before beginning

}

void playKey(int slidePos) {

servo3.write(slidePos); // move slider servo to key position

delay(300); // give slider time to get there

servo1.write(85); // move finger down and press key

delay(100); //give time to move finger down

servo1.write(110); //pick finger back up

delay(300); //give time to pick finger up before next slider move

}

void loop() {

digitalWrite(ledPin,HIGH);

/* playKey(165);//f delay(500); playKey(149);//g playKey(138);//a playKey(127);//b playKey(116);//c playKey(105);//d playKey(94);//e playKey(83);//f playKey(72);//g playKey(61);//a playKey(50);//b playKey(28);//c playKey(15);//d */

// cetk //

playKey(71); playKey(60); playKey(83); playKey(170); delay(400); playKey(116); delay(2000);

// avengers //

playKey(72); playKey(94); playKey(83); playKey(50); playKey(15); playKey(28); playKey(72); playKey(94); playKey(83); delay(2000); //amazing grace playKey(160); playKey(116); playKey(94); playKey(94); playKey(105); playKey(116); playKey(138); playKey(149); delay(2000);

//indiana jones

playKey(138); playKey(127); playKey(116); playKey(83); delay(500); playKey(149); playKey(138); playKey(127); delay(500); playKey(116);//c playKey(105);//d playKey(94);//e playKey(50);//c playKey(105);//d playKey(94);//e playKey(83);//f playKey(72);//g playKey(61);//a delay(2000);

//gilligan

playKey(138);//f playKey(105);//g playKey(61);//a playKey(61);//f playKey(61);//g playKey(72);//a playKey(94);//f playKey(116);//g delay(500); playKey(138);//f playKey(105);//g playKey(61);//a playKey(61);//f playKey(61);//g playKey(72);//a delay(500); playKey(138);//f playKey(105);//g playKey(61);//a playKey(61);//f playKey(61);//g playKey(72);//a playKey(28);//a delay(500); playKey(72);//a playKey(83);//a delay(500); playKey(94);//a playKey(116);//a playKey(105);//a delay(2000);

// somewhere over the rainbow

playKey(127); delay(300); playKey(50); delay(300); playKey(61);//f delay(300); playKey(83); playKey(72);//g playKey(61);//a playKey(50);//b delay(200); playKey(125);delay(300); playKey(72);delay(300); playKey(83); cli(); /*playKey(149);//g playKey(138);//a playKey(127);//b playKey(116);//c playKey(105);//d playKey(94);//e playKey(83);//f playKey(72);//g playKey(61);//a playKey(50);//b playKey(28);//c playKey(15);//d */

}

<p>what a wonderful project..applaud..This can be base for a much bigger one with humanoid sitting and playing piano.</p>
Thank you! Yes, that would be cool but beyond my ability.<br>
<p>Hello,</p><p>First, I apologize for my English is not good :)))</p><p>this is a beautiful tool.</p><p>I'm looking for a mechanical tool just like this for use in the sampling of the real piano.</p><p>Basically I need a mechanic roobot I play all the notes of the piano, one by one, with different levels of intensity.</p><p>This work is very tedious and time consuming to be done by one person, but a tool like this can help a lot.</p><p>Please, you can have more information? perhaps there is a tool like this on the market.</p><p>My e.mail: antonioserio64@alice.it</p><p>Thanks!<br>Sincerely <br>Antonio</p>
Hi Antonio. Unfortunately I don't have this or any other project anymore as I built them in China and have now come home to US.<br>I have see a piano player built of legos that slowly progresses back and forth to play a tune. Anything more complicated than that would probably be quite complex. Do not know of any commercial product to play the piano and you are right it would be very time consuming to build. As you may notice, my projects are very simple - then when I get them working I make a video and forget about them pretty much.<br>Good luck in your endeavors.
<p>Hi, I have made some changes to my player and found how to put videos in the comments section. So I am adding a video to show how this player works. This has been a fun project and have learned a lot from it. Thanks for all the help.</p>
<p>Thank you, for taking the time to clean up the code. I now have a working machine. I need to get the finger alined with the keys on my keyboard but once I have that sorted out I think it will be playing many tunes. Will send video soon as I find out how.</p>
<p>Thanks for the feed back. </p><p>This one thing has me stuck. Can you tell me where you control the finger up and down timing. When the slider moves on my player the finger does not always clear the keys. Seems the slider moves before the finger has finished its stroke. I would think the finger should hit the key move up then the slider should move to the next key then the finger hit the key and so on.</p><p>Sorry your job is not working out you seem to have a lot of talent.</p>
Ok, code is cleaned up and commented.
But to reply to your question now: do finger down, then delay (to play key), then finger up, thendelay(to give time for finger up, then slide to next key, then delay(to give time to slide to next key),.
<p>I have a couple of questions,</p><p>What does the line randomSeed(analogRead(0); do?</p><p>How do you make the servo3 stay up long enough for servo1 to move to the next note? Seems to to have a problem with servo 1 staying on the key too long. I think the answer is in the void myServo but can't find it.</p><p>How long are the rods from servo1 and servo 3 to the first bolt? I guessed servo1 to be 6.75&quot; and servo 3 to be 3&quot;</p><p>I found the numbers in playKey that you have are different than mine.</p><p>I almost have it working I think this is a fun project. I would send a video but don't know how to get it on youtube.</p>
<p>you dont need randomseed function in this program. code was carried over from my robotic newton's cradle. sorry.</p>
Question 1: see http://www.arduino.cc/en/Reference/RandomSeed<br>description for randomseed &quot;seeding&quot;<br>Question 2: Servo 3 is the slider and servo 1 is the finger up and down.<br>Question 3: Long rod 7&quot;. Short rod from servo to long rod: 3&quot;<br>Finger from servo to 2nd finger joint: 2 1/4&quot;<br>Numbers are arbitrary depending on which note you start on. Also my keyboard has the black notes mixed in with the white ones so your keyboard is correct.<br>Glad you built one. Rock on!<br>I am winding down on projects. Probably have one more then I hve to move on and get a real job, not the flakey one I have now, Will miss all this putzing around.
<p>I have a problem with code....can you help me ?</p><p>sketch_may13a:1: error: #include expects &quot;FILENAME&quot; or &lt;FILENAME&gt;</p><p>sketch_may13a:2: error: 'Servo' does not name a type</p><p>sketch_may13a.ino: In function 'void myServo(int, int, int, int, int)':</p><p>sketch_may13a:6: error: 'servo1' was not declared in this scope</p><p>sketch_may13a:6: error: 'servo2' was not declared in this scope</p><p>sketch_may13a:6: error: 'servo3' was not declared in this scope</p><p>sketch_may13a:6: error: 'servo1' was not declared in this scope</p><p>sketch_may13a:6: error: 'servo2' was not declared in this scope</p><p>sketch_may13a:6: error: 'servo3' was not declared in this scope</p><p>sketch_may13a.ino: In function 'void setup()':</p><p>sketch_may13a:8: error: 'ledPin' was not declared in this scope</p><p>sketch_may13a:10: error: 'servo3' was not declared in this scope</p><p>sketch_may13a.ino: In function 'void playKey(int)':</p><p>sketch_may13a:10: error: 'servo3' was not declared in this scope</p><p>sketch_may13a:10: error: 'servo1' was not declared in this scope</p><p>sketch_may13a.ino: In function 'void loop()':</p><p>sketch_may13a:12: error: expected '}' at end of input</p><p>#include expects &quot;FILENAME&quot; or &lt;FILENAME&gt;</p>
<p>#include &lt;servo.h&gt;</p>
<p>I was so impressed with your player that I made one of my own. I was very impressed with the way it works and how well it plays. It looked like it would be easy to make but it did not turn out that way. Have much more to do on mine.</p>
Looks great! Would like to see video of yours. I plan to use printer carriage parts in a future project.
<p>This is great! You should enter it into the 'Move It' contest! </p>
<p>Thank you. Will do.</p>
Great idea. Simple and sofisticated
<p>Thank you. That's what I'm aiming for besides quixotic. </p>
<p>This is very cool!</p>
<p>Thank you. It was fun and easy to make.</p>

About This Instructable

5,201views

71favorites

License:

Bio: I am an American teaching English at Shangluo University, Shaanxi. I like making machines that do interesting but fairly useless things - I call them Quixotic ... More »
More by JimRD:Arduino Controlled Morse Code Key and Transmitter Magnetic Levitating Globe Tear-apart and Fix Morse Code Key (and Sounder) Made From Steak-knife and Multi-tester 
Add instructable to: