Phase 0: Idea Formation
For our final Object project, my partner Allison Roten and I decided to create an electric piano. We planned for the piano to have 8 keys (able to play one full scale from C to C) and a potentiometer to change the octave. We scratched this potentiometer idea pretty early on, realizing we had way too much work already on our plate without this addition. We planned there would be Neopixels inside the box that light up a certain color when you play a certain note, under the corresponding key. The top of the piano would be laser cut frosted acrylic keys so you could see the lights change from white (so you know the piano is on) to a certain color under the key you are playing, so the user knows they pressed the key. There would be a speaker hole laser cut in the front of our wooden, laser cut box. Our keys would trigger the Neopixels to change and the sound to play by copper tape connected to a wire on the box and on the bottom of the key. The keys would be hanging about an inch from the edge of the side of the box, and when you press the key down, the circuit is completed. We stayed true to our original plan and created exactly what we intended to, though it was much more challenging that we anticipated.
Phase 1: Prototyping
To start the task of building an electric piano, my partner and I started by prototyping. We first built our circuit with one light connected to one button and wrote code to make this circuit work as we wanted, by having the light be white and change to a color when the button was pressed. We then connected the same circuit to our Adafruit Audio Shield v1.1 and wrote code to get the one button to play one sound. We chose this Audio shield because it would play a certain sound we saved onto an SD card, triggered by a button press. We felt we could get the best sounding piano notes using this shield since the sounds were saved on an SD card. We ran into a lot of issues trying to get the sound to turn on, and went to our teacher, Arielle, for help. She pointed out that we didn't have the shield plugged into the Ardunio right, and once we plugged it in correctly, everything worked as it should, first crisis averted!
Phase 2: Getting the Lights to Work
Our next step was to get the lights to work by themselves. We thought the best way to go about using the Neopixels would be to use 16 Neopixels on each side of the box. Our plan was that there would be 2 Neopixels on each side of the box per key (so four Neopixels per key total) so the box would be lit up form both sides and diffuse the light under the frosted acrylic in an aesthetic way. We first thought the best way to go about this was to solder each Neopixel separately, meaning we would solder 32 individual Neopixels, which then means we would solder 96 individual wires (3 wires per Neopixel). And this is exactly what we did. We then went to Arielle again because we realized we did not have enough pins in the Arduino for all of these Neopixels and we were looking for advice on how to move forward. She asked why we didn't just use two strands of 16 Neopixels (one strand for each side of the box) and we looked at each other and had no idea why we didn't do that in the first place. So from there we scratched the 32 individually solder Neopixels (all those hours of work for nothing) and soldered two strands of 17 Neopixels (one extra pixel in case we made a mistake). We connected 8 pre-made buttons to these two strands of Neopixels. After a lot of writing and rewriting code and with the help of Jack Marty, we finally got the strands of Neopixels to respond simultaneously to each button press; the Neopixels light up white when plugged in and when one button is pressed, two Neopixels light up on each strand, in ROYGBIV order from left to right.
Phase 3: Getting the Sound to Work
The next step was getting the 8 buttons to trigger the sound to play. We had a lot of difficulty in this step of the process. After a lot of failed tests, we realized our Audio Shield was taking up too much power and too many pins on one Arduino, so to get the speaker to play sound, we had to use two Arduinos and serial communicate between them. Once we got the two Arduinos to serial communicate (after some difficulty which we were helped through by Jack Marty), we finally got the buttons to trigger a sound to play through the speaker. We were able to get the sound to play by itself but problems arose when we tried to connect the buttons to the sound and the lights. Although the sound did play, it now didn't know when to stop playing. We ran through a lot of debugging for the code and ran into a lot of other issues along the way with the sound either not playing or not able to stop playing correctly. This part of the process was the hardest part of the whole project by far and took up the most time and needed the most outside help. We went to Jack Marty, who helped a lot. We went to Caleb, the Object TA and Mary West, the interim professor in place of Arielle and they weren't able to debug our code. The people who helped us get the lights and the sound to respond correctly to the buttons were the two graduate students who had been helping out in the classroom after Arielle went on maternity leave. I unfortunately forget their names, but they were amazing and life savers. We wouldn't have been able to finish this project without their debugging support and explanations on what was going on with our code. Although we did debug the code, the sound didn't respond perfectly to a button press; there was a bit of a delay in the sound playing and if you held the button down for too long, the sound would play again. This made the piano not have the best response rate, but it was playable now which we were really excited about and so thankful we finally figured out the problem after 40+ hours put into working on this project up to this point in time (we pretty much lived in the BTU for the weeks we were working on this project).
Phase 4: Creating the enclosure
Creating the enclosure was a nice break from debugging code, which is what the project had mostly consisted of up until this point in time. We had to re-cut the acrylic keys a few times over at different lengths to get the perfect amount of sturdiness yet bendability in the keys. We glued our box together with wood glue and cut out a shelf and supporting legs to put inside the box to hide the Arduino, speaker and breadboard etc, from being seen through the acrylic. We also made sure to include two holes in the back of the box so wires could be fed into the box to power the Arduinos and the speaker.
Phase 5: Putting it all together
We ran into some trouble again when we put the hardware into the box and started making our own keys. We first prototyped the buttons we made out of copper tape to make sure they worked. We got all of the pre-made buttons replaced with our own wires and tested to make sure each circuit worked. When completed, we put it into the box and tested it and it still worked. We're not sure what exactly changed to trigger the circuit to freak out, but it did. Each button worked except one button, which being triggered when our hands were close to the circuit but not when our hands were far away. It was very strange. We took our circuit out of the box, replaced each wire button with the pre-made button, tested all the wires and replaced them (to see if it was a faulty wire), but the problem was still occurring. We tried everything we could think of with no luck. I brought the circuit back to the two grad students who had helped us the first time and together we figured out it was a simple power issue...the power from the computer was being plugged into the wrong Arduino, though we didn't know beforehand there could be a wrong Arduino to plug the power into! Once we fixed this problem, we put everything back into the box, and re-replaced each pre-made button with the wires. This was really hard as there were a lot of wires jammed in really close to each other, enclosed in a box so it was hard to see and put each wire in the correct spot to connect them as buttons. What helped most was keeping things really organized and labeling our wires. We also ran into trouble when connecting the wires to the copper tape on the wood and on the keys. The copper tape didn't want to stick to the wood, but I discovered after trial and error that if I cut the tape in really small strips, just big enough to stick to the surface of the wood and not bend over the side, it would stick much better. The wires didn't want to stay in place on the keys either, they kept falling out of the copper tape. So after some trail and error, we figured out the best way to get them to stick was to put a piece of copper tape on the key , all cut the same size and placed the same on each key so they were aesthetically pleasing to the user. Then we took another piece of copper tape, wrapped it around the wire, and sandwiched it between the copper tape on the key and another piece of copper tape and secured it by hot gluing around the wire, making sure to not get the glue on the wire because then the wire would be insulated and the connection wouldn't be able to be completed. After we got all of these wires cut the correct length and connected on the box and to the keys, we put the top on and plugged in each key wire into the breadboard, which was difficult with so many wires already connected to the breadboard so close together. We finally got it, though we had to re-plug in a few wires a few times because they kept falling out. We then tested to make sure everything worked and then put the top on, put the shelf in and taped the Neopixels to each side of the box. We plugged everything in and tested again and had to make some adjustments, but everything worked! We decided the best way to secure the top onto the box was to tape the two back sides of the top down on top the box, so we could easily take the top off and adjust the inside circuitry/speaker if need be.
Phase 6: Documentation
We finally finished this piano, after 60+ hours working on it. Even though it didn't work perfectly and we would still work on debugging the sound response if we had more time, it worked to a point we were happy with, especially after being told we wouldn't be able to get it working at all many times. I am really proud of us for sticking with this project and completing it to the point where it works and looks (relatively) beautiful. It feels great to have a final product that works and I am happy and proud to show off!
Welcome to my progress blog for my Object course at the University of Colorado, Boulder. Enjoy watching my process as my ideas become a reality.