Here is a homemade piano (or electric keyboard) made from the BX-24 microcontroller, a few scrap aluminum strips, some nuts & bolts, some old Cat-V networking cable, and a Radio Shack audio amplifier. (The keys are colored with electrical tape.) The BX-24 is manufactured by NetMedia and is programmed using their BasicX language. I am using Robodyssey Systems' RAMB II motherboard to interface with the BX-24. I am the author of the world's only BasicX textbook; if you are interested in learning how to program your own robot (or keyboard), see my website at www.basicxandrobotics.com.
Here are brief instructions on how to make your own piano:
The keys are aluminum strips that my students cut them from a very thin aluminum plate using an old paper cutter. I used metal bolts to secure the keys to a piece of Plexiglas. (You can readily see these in the video.) Before tightening the screws down, I wrapped a wire around one of the posts. The other end was connected to the BX-24's signal pin. (This is very easy to do if you use Robodyssey's RAMB II motherboard.)
Next, I put another bolt directly under the key, but not touching the key. (If you look closely, you can see these bolts under the keys.) To this bolt I secured another wire, which lead to the ground pin on the RAMB II motherboard. Then, when the key is depressed and makes contact with the bolt underneath it, the circuit will be completed and the signal pin on the BX-24 will be grounded. Make sure that your colorful electrical tape does not prevent the key from making contact with the bolt underneath!
All that's left to do is monitor the state of the pin. When it goes low, output the appropriate sound. Again, this is easy to do with an audio transducer and the BX-24.
The notes are programmed as eighth-notes. Here are my declaration constants for the various frequencies from my BasicX code:
Const G3 as Integer = 196 ' 196.00 Hz
Const A3 as Integer = 220 ' 220.00 Hz
Const B3 as Integer = 247 ' 246.94 Hz
Const C4 as Integer = 262 ' 261.63 Hz
Const D4 as Integer = 294 ' 293.66 Hz
Const E4 as Integer = 333 ' 329.63 Hz
Const F4 as Integer = 350 ' 349.23 Hz
Const G4 as Integer = 392 ' 392.00 Hz
Hi SorSeanS. I've expanded this video's description to hopefully answer your question. If this doen't help, I can make a quick video of how I put it together. Let me know. Hope this helps.
odomc 4 years ago