Introduction: How to Make a Polyphonic Music Installation Triggered by Capacitive Touch Points Using an Arduino

During a project at KISD we made an interactive music installation which was playable at a public transit place. The look of it was inspired by the colourful metro plans that separate each train line with a different color. For the lines we used colourful tape, which also covered the cables.

You were able to make music using one, multiple or all of the ten touch points that we placed on the walls. One major part we wanted to achieve was polyphonic playback. Which means that you are able to play more than only one sound file at a time. That’s the reason we used a Wav Trigger which tackles this specific requirement. If you don’t need polyphonic support you can use a more simpler and cheaper sound trigger. But let’s focus on how you can build your working prototype.

What are we going to build exactly?

In this tutorial we are going to do a simple prototype that will allow you to play music using capacitive sensors. In addition to that it will be polyphonic, so that you will be able to play multiple sounds at the same time.

Step 1: To Get Going You Need the Following Things

  • 1 x Arduino
  • 1 x Sparkfun Wav Trigger (+ Micro SD Card)
  • Wav Trigger Init File Maker Utility (You can find it here)
  • Cables
  • 1M Resistors (one per touch point)
  • Headphones or Speakers
(Based on how many touch points you want you may need an Arduino Mega)


  • Aluminum Foil

Step 2: The Arduino Part

First of all we are going to set up the Arduino so we can use capacitive sensors to trigger something. The whole process is pretty easy but you need to install the capacitive library first.

Download Capacitive Sensing Library

After you successfully installed the library we can start setting up the code. For every capacitive sensor we need two pins of the Arduino which are bridged by a 1M resistor. (Depending on the length of the later connected cable you may need to change the resistor.) The cable of the touch point is connected to one of the pins (the sensor pin which we define in the code) after the resistor.

For the touch points we used aluminium foil, which was wrapped around circles made out of cardboard. But you don’t need to make something out of aluminium foil to test it. You can simply touch the end of the sensor cable.

Let’s have a look at the code:

#include // Capacitve LibraryCapacitiveSensor 

sensor1 = CapacitiveSensor(7,6); 
// 1M resistor between pins 7 and 6 (6 is sensor pin)

int sensorTrip = 100; // Change sensor sensitivity here 
int touched = 0;

void setup(){ 
	pinMode(2, OUTPUT); 

void loop(){ 
	long lastReading;

	if (lastReading < millis() + 10){ 
	// limits frequency of sensor value checking 
		long start = millis(); 
		long total1 = sensor1.capacitiveSensor(30); 

		// SENSOR 1 
		if (total1 > sensorTrip){ 
			Serial.println("Sensor 1 ON"); 
			digitalWrite(2, HIGH); //Activate Wav Trigger
		else { 
			digitalWrite(2, LOW); 
	lastReading = millis(); 

Step 3: Wav Trigger

To set up the Wav Trigger please have look at the following guide to get you started.

WAV Trigger Hookup Guide

Or if you want to have some more information have a look at the WAV Trigger Online User Guide.

Actually use the Wav Trigger is pretty easy. All we are doing is putting power one the specific part of the board. (To play the first sound (Filename: 001 and so on), we will set the power to HIGH on port 1 of the Wav Trigger.)

In order to make the Wav Trigger recognise what we are doing you have to create an .ini file with the tool I mentioned previously and change the hardware interface from "Contact Closure" to "Active (3.3V / 5V)". So every time (or as long as) the specific port gets a HIGH it will play the sound. If the Arduino is sending a LOW signal, the sound will stop.

Step 4: Now Take It a Step Further

I kept this example simple so it is easier to understand. Of course one sound is not the promised goal.

To extend the example, simply add more sounds to the Micro SD card (002, 003, ...) and also add them in the .ini file. In the code for the Arduino you simply need to define more sensors on other ports (sensor2, sensor3, ...)

For example:

pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
long total2 =  sensor2.capacitiveSensor(30);
long total3 =  sensor3.capacitiveSensor(30);
CapacitiveSensor sensor2 = CapacitiveSensor(9,8);
CapacitiveSensor sensor3 = CapacitiveSensor(11,10);

Then just repeat the If Else statements for the newly created sensors.

// SENSOR 2   if (total1 > sensorTrip){
     Serial.println("Sensor 1 ON");
     digitalWrite(3, HIGH);
   else {
     digitalWrite(3, LOW);

// SENSOR 3...

I hope this helps and have fun creating! :)