Introduction: Piano TouchSense Glove

About: Electrical engineering student

This is a pretty simple way to create a wearable piano using capacitor sensing as touch sensors; each finger is a different key that can be played individually or combined. I wanted to make a very simple wearable sensing glove that didn't involve obtaining more sensors, so I opted to use aluminium tape and the ADCTouch library which takes away the necessity of large resistors, and instead uses the internal wiring of the arduino UNO and some very clever manipulations.


  • Arduino UNO (+USB Cable)
  • 1 Glove
  • 5 Small Squares of Aluminium Tape (for each finger)
  • 7 Wires/Jumper Cables
  • 1 Piezo Element


Step 1: Step 1: External Setup

As you can see from the circuit diagram, the setup is simple. Cut out five small squares of aluminium tape (or foil, but I found the tape worked nicely since it didn't require any other form of adhesive to attach to the glove), small enough for each finger and attach them to the pads of each digit.

Now you have to attach one end of the five jumper cables/wires to the aluminium pads, I did this by using another, smaller piece of aluminium tape attached to each cable onto the pads. And then plug the wires into the respective analog outputs: thumb (A0), index (A1), middle (A2), ring (A3), pinky (A4).

For the piezo element, you just need to connect the Arduino pin and ground to its respective ends (I used pin 9 in the code for the speaker).

And that's it!

Step 2: Step 2: Arduino Code

Attached is the code, there is also a version of it below. Things to note: I only used notes C through G, these can be changed. The ADCTouch library needs to be downloaded ( ), it's simple to use, you just need to include the reference values for each analog pin, as well as the offset correction, as seen in my code below. It's important that you test the sensitivity of your capacitor sensors, it can be a bit wonky sometimes due to the crudeness of the sensor. You may need to change the values I used for the touch threshold (I had 50/60+ meaning that it has been touched), I found that depending on how I used the glove, and which finger I used, the threshold needed to be altered (an unfortunate side effect to the lack of stability of this sensor).

The following code is what I used for the Arduino:

#include <ADCTouch.h>

#define NOTE_C 262 #define NOTE_D 294 #define NOTE_E 330 #define NOTE_F 349 #define NOTE_G 392 int ref0, ref1, ref2, ref3, ref4; //reference values to remove offset int speakerPin = 9; //Depends on which pin is used for the speaker void setup() { // No pins to setup, pins can still be used regularly, although it will affect readings Serial.begin(9600); ref0 =, 500); //create reference values ref1 =, 500); ref2 =, 500); ref3 =, 500); ref4 =, 500); pinMode(speakerPin, OUTPUT); } void loop() { int thumb =; int index =; int middle =; int ring =; int pinky =; thumb -= ref0; //remove offset index -= ref1; middle -= ref2; ring -= ref3; pinky -= ref4; if (thumb > 50) { if (index > 60) { Serial.print("A"); //TI (thumb and index) tone(9, NOTE_C + NOTE_D); } else if (middle > 60) { Serial.print("B"); //TM (thumb and middle) tone(9, NOTE_C + NOTE_E); } else if (ring > 60) { Serial.print("C"); //TR (thumb and ring) tone(9, NOTE_C + NOTE_F); } else if (pinky > 50) { Serial.print("D"); //TP (thumb and pinky) tone(9, NOTE_C + NOTE_G); } else { Serial.print("T"); tone(9, NOTE_C); } } else if (index > 60){ if (middle > 60) { Serial.print("E"); //IM (index and middle) tone(9, NOTE_D + NOTE_E); } else if (ring > 60) { Serial.print ("F"); //IR (index and ring) tone(9, NOTE_D + NOTE_F); } else if (pinky > 50) { Serial.print("G"); //IP (index and pinky) tone(9, NOTE_D + NOTE_G); } else { Serial.print("I"); tone(9, NOTE_D); } }

else if (middle > 60){ if (ring > 60) { Serial.print("H"); //MR (middle and ring) tone(9, NOTE_E + NOTE_F); } else if (pinky > 50) { Serial.print("J"); //MP (middle and pinky) tone(9, NOTE_E + NOTE_G); } else { Serial.print("M"); tone(9, NOTE_E); } } else if (ring > 60){ if (pinky > 50) { Serial.print("K"); //RP (ring and pinky) tone(9, NOTE_F + NOTE_G); } else { Serial.print("R"); tone(9, NOTE_F); } }

else if (pinky > 50) { Serial.print("P"); tone(9, NOTE_G); } else { Serial.print("N"); noTone(9); } delay(10);


Step 3: Step 3: Processing Code

If you haven't used processing before, it can act as a visual to Arduino using the serial monitor output. You don't need the processing code to use the TouchSense Glove, it simply adds the visual piano element. If you don't already have processing, it can be downloaded here. The following is the processing code used for the simple piano seen in the image above:

import processing.serial.*;
Serial myPort; char key= 'N'; //default = no key

void setup(){ size(500, 300); //hardcoded port selection. Check which is your Arduino Serial println("ports: "); println(Serial.list()); myPort = new Serial(this, Serial.list()[0], 9600); // The [0] may need to be change if your port is different


void draw(){ fill(255); //five keys for piano keys C-G rect(0,0,100,300); //thumb = C rect(100,0,100,300); //index = D rect(200,0,100,300); //middle = E rect(300,0,100,300); //ring = F rect(400,0,100,300); //pinky = G fill(0); rect(70,0,60,200); rect(170,0,60,200); rect(270,0,60,200); rect(370,0,60,200); if(myPort.available() > 0){ key = myPort.readChar(); println(key); } fill(0); switch(key) { //if one of the keys : black circle case 'T': rect(0,0,100,300); break; case 'I': rect(100,0,100,300); break; case 'M': rect(200,0,100,300); break; case 'R': rect(300,0,100,300); break; case 'P': rect(400,0,100,300); break; case 'A': //TI rect(0,0,100,300); rect(100,0,100,300); break; case 'B': //TM rect(0,0,100,300); rect(200,0,100,300); break; case 'C': //TR rect(0,0,100,300); rect(300,0,100,300); break; case 'D': //TP rect(0,0,100,300); rect(400,0,100,300); break; case 'E': //IM rect(100,0,100,300); rect(200,0,100,300); break; case 'F': //IR rect(100,0,100,300); rect(300,0,100,300); break; case 'G': //IP rect(100,0,100,300); rect(400,0,100,300); break; case 'H': //MR rect(200,0,100,300); rect(300,0,100,300); break; case 'J': //MP rect(200,0,100,300); rect(400,0,100,300); break; case 'K': //RP rect(300,0,100,300); rect(400,0,100,300); break; //if N: do nothing case 'N': break; }


Step 4: Finished!

That's it! A very simple way to create wearable technology.

Now, you may be wondering "what can I do with a five keyed piano?" Besides the fact that it's pretty cool for something so simple, I see this project as a stepping stone.

What's next?

  • Get better touch sensors, buy some bend sensors and an accelerometer, maybe some Bluetooth, and make a smarter glove. Use this glove to control a game, maybe even through your Android.
  • Try making this 3D capacitor sensing cube with aluminium foil, try using the ADCTouch library instead for simplicity (the simpler, the better!) and perhaps making a game with it.
  • Skip the glove, use the aluminium foil as a close proximity distance sensor, use it in applications that involve varying distance (maybe to zoom in and out of a game or model), taking advantage of those analog values.
  • Move onto cooler, more sophisticated, and smarter wearable technology like interactive LED fashion, 3D printed wearable devices, or a Raspberry Pi wearable computer (home-made Google Glasses anyone?).