Playing a banana piano with Arduino, Clojure and Overtone

Maker creates a capacitive touch piano out of bananas, using an Arduino and Clojure with Overtone.

If you’ve ever attended a Maker Faire in the past, then you’re well aware that the banana piano is a pretty basic hack. Think Makey Makey, where an array of ordinary fruit is transformed into a magical touch sensor, emitting songs like “Chopsticks,” as onlookers are left in awe.


However, Maker Stian Eikeland decided to take a new approach to the classic banana piano by connecting it to Clojure and Overtone. Clojure is a dialect of the Lisp programming language that runs on the Java Virtual Machine, Common Language Runtime and JavaScript engines, and features an audio environment called Overtone. This library includes a range of sampled piano sounds, which made it a clear choice for the DIY instrument.

“There’s a couple of ways we can make bananas act as tangents, one of them is to use the bananas as capacitive touch sensors. Using a nice little hack it’s possible to do this using regular digital pins on a microcontroller,” Eikeland writes.


“The number of cycles needed before the pin goes high will depend on the capacitance of whatever connected to the pin. A banana might require 8 cycles before the pin goes high, while a touched banana might require 15.”

As the Maker explains, he was able to connect a number of bananas to an Arduino Nano (ATmega328), iterate over the pieces of fruit, read their cycle count before banana-pin went high, and then transmit a message via a serial connection to indicate the pin number if the cycle count was above a given threshold.

Meanwhile, Overtone serves as a client to the SuperCollider synthesis server. This language interpreter runs in a cross-platform IDE and communicates via Open Sound Control with one or more synthesis servers. In essence, as Hackaday’s Eric Evenchick puts it, “Overtone simply tells Supercollider what to do, letting you easily program sounds in Clojure.”

Whenever the Maker taps the banana, the ATmega328 based board sends a character from 0 to 7, which is relayed to Clojure using a serial-port library. The program then maps the banana to a musical note and triggers that note on Overtone’s built-in piano sampler. And presto! Music is played.

Head over to the Maker’s official project page here, while also watching it in action below!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s