loading
Goal of this project:
Convert a cheap toy piano to work as a midi device and use it with Synthesia (http://www.synthesiagame.com/)
Other programs that use midi inputs can also be used.

Approach:
The pushbuttons of the piano are used to make a simple pull-down circuit for the arduino mega. The arduino interprets the keystrokes and sends serial midi data to the pc. Then this data is send to a virtual midi port with "serial-midi converter". This midi port is connected to Synthesia via "MIDI Yoke". MIDI Yoke is a driver that creates virtual ports. Each port has an input and an output which are connected. With MIDI Yoke you can couple different midi programs without any physical hardware.


Step 1: Parts and tools

List of the parts needed for this project:

- Toy piano
- Arduino mega (This project van also be done with an arduino uno but you should use an line decoder to expand your arduinos inputs.)
- Flat ribbon cable (from old pc)
- Connectors (1 for piano and 1 for arduino)

List of tools needed: 

- Soldering iron
- Desoldering pump or wick
- Ohmmeter
- Hot glue or any other strong glue
<p>Awesome project! I'm still new at using the Arduino but, Digital pins '22 - 56' are used for each key and give you a total of 34 keys correct? Can you play full chords at once? If I was to use multiplexers or shift registers, would the code have to be changed a lot? (Still learning on how to code). Any help would be appreciated. Thanks</p>
<p>Yes, for each key there is a corresponding IO-pin on the arduino. This method is very simple but uses a lot of pins. A better way would be to use a key matrix (see picture). For a 4x4 matrix (16 keys) only 8 pins are needed with this method in stead of 16. using shiftregisters or multiplexers is also possible but these require additional hardware. </p><p>It is possible to play full chords. The arduino checks the keys one by one if they are pressed. This means that technically it is not possible to play to notes at the exact same time. However in parctise this delay between detecting the 2 keypresses is so short (less than 1 ms) that you won't be able to hear this difference.</p>
<p>Unfortunatly i won't be able to make a video of this project. But if you have any other questions or want a more detailed explanation of the key matrix, Feel free to ask. :)</p>
<p>Also if you could make a video of the setup and testing it out, that would be great. (Up to you, but thought it would be cool)</p>
<p>Any way to run MIDI Yoke on Windows 8+ ?</p>
<p>I still use windows 7 and i hadn't any problems. On the midi OX forums they suggest to install midi yoke with &quot;Windows User Account Control&quot; turned off.</p><p><a href="http://www.midiox.com/cgi-bin/yabb/YaBB.pl?board=MYInstall;action=display;num=1374889053" rel="nofollow">http://www.midiox.com/cgi-bin/yabb/YaBB.pl?board=MYInstall;action=display;num=1374889053</a></p><p>P.S. Don't forget to turn &quot;Windows User Account Control&quot; back on after the installation has completed.</p><p>The forum contains a lot of other helpful information concerning Midi yoke installation. <a href="http://www.midiox.com/cgi-bin/yabb/YaBB.pl?board=MYInstall" rel="nofollow">http://www.midiox.com/cgi-bin/yabb/YaBB.pl?board=MYInstall</a></p><p>I hope this is useful.</p>
<p>I havent seen your reply :D but i ran it with troubleshoot compatibility, used Test program, and installed it smoothly.. Tnx. <br>But i still have some trouble. I use Arduino Uno, (0-13 + GND) and an piano keyboard with 47 keys, and 15 pins input/output. I did every step, but SM's TX and RX flashes just once red, and nothing happens even when i press keys.. Maybe i should change the code in arduino? any hints? :D</p>
<p>My arduino code is used on an arduino mega so it won't work on arduino uno. But the general structure is there. You should make a for loop over all digital input pins, read every pin and compare it to its previous state (stored in prevPinState). if there is a change: send a midi command. You also have to choose another &quot;offset&quot;. this is used to convert the pin index to the corresponding midi key note number. (see <a href="http://newt.phys.unsw.edu.au/jw/notes.html" rel="nofollow">http://newt.phys.unsw.edu.au/jw/notes.html</a>)</p><p>Also make sure the indexes of &quot;prevPinState&quot; are correct.</p>
<p>CAN U POST MORE PICS FOR THE CONNECTIONS OF THE CONNECTORS</p>
So,as I understand,i can use this not only for toy piano,but for whatever buttons I want,right?The red wire whitch isn't connected to the flat ribbon cable is the +9V Lead? <br>Thank You.
You can use this for whatever buttons you want. I've seen a simular project where they used pieze sensors to monitor the strokes on a xylophone and convert these to midi. <br>The red wire is connected to ground. This is because i used the internal pull up resistors of the arduino. If you press a button, you will pull the voltage to ground. (Inverse logic: button pressed is LOW, button released is HIGH).
Nice. <br>You can do this also with a Standard Arduino (UNO, Diecimila, etc) and a bunch of shift registers.
It should be possible. You will have to use extra hardware because these standard arduinos don't have a lot of I/O ports. The most obvious thing to do, would be to use a IO port expander (<a href="http://www.maximintegrated.com/products/interface/io_expanders.cfm" rel="nofollow">http://www.maximintegrated.com/products/interface/io_expanders.cfm</a>). There also exist keypad encoders like the EDE 1188 (<a href="http://singlechips.com/pdf/ede1188.pdf" rel="nofollow">http://singlechips.com/pdf/ede1188.pdf</a>)&nbsp;but I am not &nbsp;sure you could use them for this application.

About This Instructable

21,009 views

126 favorites

License:

More by Luke7412: Convert a toy piano to work as a midi device and use it with Synthesia
Add instructable to: