Introduction: Creating a Touch Sensitive Piano With a BeagleBone Black and LabVIEW
Recently I got a chance to play around with a "Makey Makey", after a few hours of entertainment I was inspired to recreate its functionality with LabVIEW. Makey Makey is an invention kit for the 21st century. It allows you to turn everyday objects into touchpads and combine them with the internet. It's a simple Invention Kit for Beginners and Experts doing art, engineering, and everything in between. In my project, I use a BeagleBone Black and LabVIEW to create a touch sensitive piano. For more Instructables like this one check out my "DIY Makey Makey collection".
Step 1: Materials
(Everything except the WF32 is included in the LabVIEW Interactions Part Kit)
Step 2: BeagleBone Black Circuit Setup
First, connect the 1.8V pin(Pin 78) on the BeagleBone Black to the positive bus on one side of your breadboard and then connect the negative bus on the same side to the ground pin(Pin 80). Next use header pins to attach 7 gator clips to your breadboard on the opposite side of your breadboard.
Next, run 2 1MΩ resistors in series from each of the gator clip connections to the voltage bus. Then, connect each strip connected to a gator clip to an analog input on the BeagleBone Black. Finally, use a grounding strap to connect ground yourself by connecting it to the ground bus.
Finally, use a grounding strap to connect ground yourself by connecting it to the ground bus.
This circuit works as a voltage divider (simple drawing shown at the bottom of the picture above), with one of the resistors (R1) being the 2 1MΩ resistors in series and the second resistor(R2) is the resistance of your body. The switch shown above is closed when you complete the circuit. Let's say you hooked the gator clip to a banana when you touch the banana you are closing the switch and lowering the voltage read by the analog in of the BeagleBone Black (Vo). In the next step, I will show you how to use LabVIEW to detect this drop in Voltage.
Step 3: Piano Setup
I made two versions of this Piano, in the first version I used a pencil to draw in the keys. To do this draw seven evenly spaced keys and then fill them in so you have a thick layer of graphite. At the end make a square at the top where the gator clips can attach.
While this first method will work, it has a few drawbacks. Biggest drawbacks are that you will get graphite it all over your fingers when you use it, and you will have to constantly have to fill it in when it starts to fade. A better way to do it is using copper tape. You just have to cut out seven identical pieces of copper tape and place them on a pieces of cardboard.
Step 4: LabVIEW Code
First download the "Sound_DJ" file and unzip it, next download the "BBB_Piano_project" and add in the Vi's from the first download. Before you open the individual VI's you will need to change the IP address shown to the specific IP addresses of your BeagleBone Black. To do this right click on the Beaglebone Black and select "properties".
Change the IP address in the input that says "IP address/DNS name". Once the IP address is correct right click each and select connect, this will open a connection to each device.
Step 5: LabVIEW Code
First open "BBB_Piano" VI under the "My Computer" category. Before you can deploy you will need to change some things on the front panel. First, input your computers IP and then add the WAV files that you want to play.
Above you can see the Block Diagram for this VI; there are two while parts. The top part is a while loop that uses a UDP read to collect the data sent over from the BeagleBone; the bottom 6 while loops use that information to determine whether or not the sound that you set. To end this code, we press the stop button which will exit both the inner loops, then when it's out of the outer while loop we close the UDP socket.
Next, open the "BBB_Sound_control" VI under the BeagleBone Black category. Before you can deploy you will need to change some things on the front panel. First, input your computers IP and then you have the option to adjust the threshold to make it more or less sensitive.
Above is the block diagram for this VI, the first block is a LINX open. It is set to Local I/O because we are using a BeagleBone Black and the code that you write in LabVIEW actually gets deployed to the board. After LINX is opened it opens a UDP socket and then enter the while loop. A digital reads inside the loop get data about the status of the piano keys and then it is all bundled and UDP write sends it to your computer over Wi-Fi. Once the stop button is pressed we leave the loop and close the LINX reference as well as the UPD socket.
Step 6: The End
Thank you for reading my instructable, if you are interested in making this project yourself but don't have the right supplies you can purchase the LabVIEW computing kit for the BeagleBone Black. This kit includes a copy of LabVIEW 2014 home edition and everything you will need to run LINX 3.0 and start making projects. Please comment with any questions or comments you may have. For more Instructables like this one check out my "DIY Makey Makey collection".