Friday, November 18, 2011

The ADK Paper Piano at the Google Developer Day 2011 in Berlin

Tomorrow is the Google Developer Day 2011 in Berlin. It's the biggest Google Developer event hosted on an international scale and this year Berlin was one of the eight stops for this event.

Some months ago Google hosted a challenge to promote the Android Accessory Development Kit (ADK) which was presented at its annual Google IO. The challenge was to create something cool with the ADK so that the popularity of the ADK gets a boost among the developer community.

This is the documentation of my project submission which was selected as one of the finalist entries for this years GDD. It's called "The ADK Paper Piano".

I had this idea to build a musical instrument to let the people engage with the project. The first thing I had to think about was how to recognize the pressing of a key on the piano. A while ago I read an Arduino tutorial which described how to build a DIY capacitive touch sensor. The approach was really simple and cheap. You would uitilize one output pin of the ADK board as an output port and connect it to a receiving input pin on the board. Now you periodically set the state of the output pin from LOW to HIGH. The receiving pin measures those state changes. To not damage the board permanently you would put a high valued resistor in series in between the pins to limit the current flow. To this closed circuit you now add a connection to a piece of aluminum foil. The foil is conductive and when you touch it you interfere with the receiving pins capacitance. Your body capacitance adds to that of the receiving pin and result is that the state change of the sending pin is recognized a bit later than usual at the receiving pin. So when a touch happens the state change is slower and you can recognize that it happened and react in your code. The Arduino CapSense library implemented that use case nicely. So naturally my first little prototype was based on that library. Here is a short video of the prototype:


Here you already can see how the piano keyboard is built. You have a base layer of normal paper for insulation. On top you have stripes of aluminum foil which overlap a bit. On top of that you have the layout of the piano keyboard also on a insulating layer of paper.



The only problem of that approach was that a normal piano has 88 keys and the ADK board "only" has 54 IO pins. The solution to that problem was to use shift registers for more inputs. A shift register is a small integrated circuit (IC) which can transmit the states of multiple of its pins by only using a few pins. So I decided to built two modules which host 8 input shift registers.


With those modules I could read 64 input pins by only using 20 pins of the ADK board. Since the whole building process took a long time I decided to scale the piano design down from 88 to 61 keys which is a normal keyboard layout from the note C2 to C7. With the learnings of the CapSense library and some bitshifting techniques I wrote my own implementation of a shiftin capacitive touch sensing library. The manual construction of the keyboard layout and building the connections took most of my time. The coding part was pretty straight forward.

The working principle goes as follows. Periodically all connections are measured by the ADK board. When a user touches a key the corresponding 8-bit shiftin register will report a changed bit. The whole 64 bit message is transmitted via 8 bytes. The Android device receives those 8 bytes determines which bit has changed and plays the corresponding note from a predefined sound array. To be able to play multiple sounds I used the SoundPool class of the Android system. As a visualization I also used the Visualizer class to display the sounds waveform while being played.
Some building steps and the finished ADK Paper Piano can be seen here:

video

The impressions and some pictures of the GDD event will follow as an update to this post. I hope you like the project and if you are at the GDD in Berlin come by and say hello.

Update: 


The Google Developer Day 2011 in Berlin was a total success. The Berlin ICC was a great location for the crowd of more than 2000 developers. The atmosphere was very relaxed and the GTUG and Google did an amazing job in the event planning. The conference was divided into differet tracks and sessions featuring Android, Chrome and HTML5, Cloud, Google+ and a special Berlin University track. Additionally there were several exhibitions featuring Google TV, a developer sandbox where different applications were showcased and the exhibition for the ADK challenge finalists. I showcased my ADK Paper Piano in the GTUG ADK challenge area. Here are some photos of the event and a video of the press visit where I explain how the piano works. Also, a local Berlin newspaper featured the piano in an article about the GDD.

video


No comments:

Post a Comment