Software apps and online services
Hand tools and fabrication machines
Many years ago, Yamaha introduced automated piano. Young and innocent me saw that piano playing music behind glass window of an instrument shop.
Enough of small talks, there really isn't big reason why I started this project besides I just wanted to.Overview:
A single board of Arduino Mega costs about $40 and two will be required to control 88 solenoids. That's quite expensive. Instead, get a cheap Arduino Uno and 11 of shift-register. Shift Register is a method to control many outputs (usually LEDs) with small number of output pins. Essentially, it's one Arduino with 11 shift registers and control 88 Solenoids.
Since we're using Shift registers, a PC will send a set of bits to Arduino instead of MIDI com. MIDI file will be translated into set of bits before hand.Hardware:
When I got the solenoids straight from China, I found out that these solenoids are not strong enough to push piano keys. Of course pushing piano keys from inner most spot takes more force but I thought it was the best method that doesn't wreck a piano. Eventually I pushed 24V through 12V solenoids to get enough power.
88 Solenoids consume a lot of power and because I can't go and buy an expensive PSU, I decided go with my dad's car battery. (Guess he won't be going anywhere now!)
With that out of the way, each one of shift registers and MOSFETs will go on a controller board.
595 on the right with a socket in case I burn it. (Which I did once.) Circuit Diagram is exactly same as example 2 from here. Replace LEDs with MOSFET gate. As you can see, there's no pull down resistor because extra resistors will bring the cost up and soldering them on that board will melt my fingers. On a bit more serious side, these MOSFETs will open at 5V and close under 4V or so. Confirmed it through countless hours of testing. (Not theoretically correct. Do not listen to me.)
Lastly, get a peice of plastic plate to glue solenoids on to. Using hot glue and plastic plate is a bad idea considering that it will get hot, but it's the best I can afford.
And then run one side of solenoid wires to the positive side of the battery.
The very first step is to get a midi file.
The second step is to get the midi into the text form. This can be done on this handy website: http://flashmusicgames.com/midi/mid2txt.php.
For the sake of simplicity, ignore time signature, tempo, and par. Tempo can be multiplied to the time later. Essentially you want a file like this:
Now, use this to create 11 sets of 8 bit data with time by running it through the Python code (attached).
They are ready to be sent to Arduino through processing COM.
See the attachment to figure out how processing sends these data and how Arduino handles them.
*Note: My coding habits are bad and it might be difficult to read these. Processing sends data from the right to left because Arduino pushes data to right on the physical piano.This thing working:Troubleshooting:
If a professional engineer were to see this post, he will think that this entire system will have many problems. And there are many problems.
Since the solenoids were hot glued to the plate, solenoids overheating and melting the hot glue was a big problem. The solution was to simply remove them and replace it with a double sided tape that can withstand up to 150C.