Published: October 27, 2014, Edited by: Mads Hobye

Sensing touch with Arduino

Excerpt from Mads Høbye, Designing for homo Explorens

Since each type of touch-sensing technology possesses different kinds of aesthetic qualities and technical limitations, I find it relevant to present the different types of touch sensing used in the projects and their strengths and weaknesses.

Capacitive touch sensing

Capacitive touch sensing is a common way of sensing touch within tangible computing. It is based on an instrument invented by Léon Theremin. The instrument detects the capacitance between an antenna and the human body. The capacitance then affects the frequency of a sine wave. Since the distance between the human body and the antenna is relative to the capacitance, it creates violin-like sound qualities depending on the distance between them. It is not necessary to touch the antenna and, therefore, it serves as an efficient way of sensing the aura between the object and the body. Even though it traditionally consisted of an antenna, it could just as well be anything else that
is conductive. This includes, but is not limited to, plants, human bodies, water, metal objects, fruits, vegetables, etc.

As nifty as this principle is to create touch interaction, it comes with a set of technical limitations. For capacitance to appear between the two objects, it is necessary for both of them to be grounded. This means that the human touching should not be isolated from the ground and the designed artifact has to be connected to a main power supply or similar. Therefore, it is not an efficient technology when it comes to interfaces that should be able to move as a part of the interaction. Further, the system always detects the highest level of capacitance and is therefore unable to detect the presence of multiple people touching at the same time. The person who is closest to the sensor will be the one who determines the readout and response from the system. Finally, larger sensing areas or high amounts of aura add higher amounts of noise which requires more noise filtering.

The first version of the Singing Plant installation was based on this principle. Here, the plant served as the antenna for the capacitive sensing. We always had difficulty making sure the system was grounded and that the plant itself was isolated from the ground for it to work. Further, the amount of aura highly depended on the type of plant used: Large leaves create a nice sense of stroking the plant, whereas many small leaves created an aura-reactive interface where the participants did not even have to touch the plant to interact with it. If the aura became too sensitive, the participants would be confused as the plant would react based on the mere presence of people in the space and even before they began to touch it. This was solved by trimming the plant to a smaller size.

The most common library for capacitive sensing on the Arduino platform is the CapSense library by Paul Badger:

Arduino touche

Credit: Nikolaj Møbius did the conversion to Arduino.
Sato et al. (2012) presented a much more advanced iteration of the traditional Theremin capacitive touch sensing. It is based on a frequency sweep response. By alternating the internal frequency of the sensor, it is possible to get a capacitive response on multiple frequencies at the same time. This enables the system to detect minute variations of touch, e.g., whether one is holding a glass of water, one is dipping their finger in it or touching with two fingers.

"Touche proposes a novel Swept Frequency Capacitive Sensing technique that can not only detect a touch event, but also recognize complex configurations of the human hands and body. Such contextual information significantly enhances touch interaction in a broad range of applications, from conventional touchscreens to unique contexts and materials." (Sato et al., 2012, p. 1).

This is by far the most advanced way of sensing touch, and it opens up a whole new set of interactive possibilities wherein the system creates interactive nuances based on the interactions. Currently, the system is mainly limited to touch interaction and is not capable of sensing aura-like interaction when participants wave their hands in the air.

Disney Research have never made their code and schematics publicly available thereby limiting the possibility for others to use it. This is a clear example of my argument for this appendix. Without the code and the schematics, it is impossible to replicate their findings or build on op of them. Instead, it is limited to a novel concept only available as a conceptual paper one can reference. To circumvent this problem, Møbius (n.d.) and I set out to replicate their system on the Arduino. We succeeded to get a similar version up and running based on their principle. Our version of the Touche touch principle has been published with open source schematics and source code here:

If one would like to create a singing plant based on this touch interface, instructions for it can be found here:

Signal to noise ratio

Credit: Nikolaj Møbius designed the principle for Arduino.

Signal to noise ratio is by far the most stable system to use. It works in harsh conditions like a rainy day at the Roskilde Festival or a dusty playa at Burning Man; therefore, I consider this principle my all-time favorite way of sensing touch. It detects the amount of connection between two electrical points using two antennas as sender and receiver.The amount of artificial data coming from one antenna to the other correlates with the amount of contact between the two points. The code for this principle can be boiled down to the following:

 Reads a digital input on pin 2, prints the result to the serial monitor

 This example code is in the public domain.

// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 2;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  // make the pushbutton's pin an input:
  pinMode(5, OUTPUT);

float signal = 0;
int high = 0;
int low = 0;

// the loop routine runs over and over again forever:
void loop() {

  digitalWrite(5, HIGH);
  high = analogRead(0);
  digitalWrite(5, LOW);
  low = analogRead(0);
  signal = (high - low);

Updated code - works with analog pins in any direction and combination - you do not need the diagram - just connect two wires to analog pins and you are good to go:

void setup() {


void loop() {
 float value = touchRead(A0, A1);

int touchRead(int pin1, int pin2)
  int sum=0;
  for(int i=0; i < 10; i++)
    pinMode(pin1, OUTPUT);

    int high = analogRead(pin2);

    int low = analogRead(pin2);

    pinMode(pin1, INPUT);
    sum = sum +high-low;

  return (int)((float)sum/4.0f);


Set the signal for the first antenna high and read the signal from the other. Then set the signal low for the first antenna and read the signal from the other. The difference between the two equals the amount of signal that will come through. If the two antennas do not touch (or are not within near proximity), the result will be around zero. If the two touch, the signal will go up significantly. It is recommended to use the running average presented above to get a sum over time for the readout.

The Medusae Nilfisk installation was perfect for this system, since it was based on physically creating a connection between two points. With the Mediated Body and the Touchbox, this was achieved through electrical contacts in the headphones. This turned the two participants into two antennas: One antenna would be the sender and one would be the receiver. In the Electrolumen installation, this was extended to a four-point contact interface by alternating which contact was the receiver and sender, respectively. The code for the installations using this principle can be found here:

Medusae Nilfisk:
Mediated Body:

Sato, M., Poupyrev, I., & Harrison, C. (2012). Touché: enhancing touch interaction on humans, screens, liquids, and everyday objects. In Proceedings of the SIGCHI conference on human factors in computing systems, CHI ’12 (pp. 483–492). New York, NY, USA: ACM. Retrieved from