Arduino Library for Tact capacitive touch sensor
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Tact Arduino

Tact is a capacitive touch (or rather: "nearness") sensor for Arduino. It adds sensing ability to any object that has conductive properties.

Working with Tact

Connect the sensor wire to a conductive object. If you plan to sense distance to this object, large surfaces (like a copper plate) or big volumes (like a bowl of water) work best.
The sensor output is a graph that changes as you approach or touch the object. Here's a little demo:


The Tact Graph

The most interesting parts about the Tact graph are its maxima: Peak and Bias.
Bias is best at sensing distance to an object, while peak mostly senses differences in touches.



Download the latest release and follow the instructions on the Arduino website: Installing Additional Arduino Libraries.

Should you choose to download the repository directly from GitHub, please copy only the Tact folder into your Arduino libraries folder.


The library comes with various example sketches that should help you getting started. Additionally, here's a documentation of all available commands:


// Create new Tact instance
// Use TACT_MULTI for a multiplexer sensor and TACT_SINGLE for a single sensor.
void setup() {
  // Start Tact 

Adding sensors

Tact sensors have to be configured in setup.

void setup() {
  // Add a single sensor
  Tact.addSensor(48, 32, 2);      

  // Add multiple sensors:
  // (only possible if you use the multiplexer circuit)
  Tact.addSensor(1, 40, 48 , 1);
  Tact.addSensor(6, 18, 32, 6);
  Tact.addSensor(7, 88, 22, 1);

But what's that?! While the sensor spectrum is theoretically infinite in size, we usually only need a portion of it. That's why we have to define:

  • start at position 48 of the spectrum
  • perform 32 sensor readings
  • in increments of 2

This becomes Tact.addSensor(48, 32, 2);.

Your individual configuration depends mostly on the object you're using. And of course on what you're trying to measure and how detailed your spectrum has to be in order to measure that. Here's an illustrated explanation:


Read spectrum

// Read 32 values from sensor 0 and store them in array `spectrum`:
int spectrum[32];
Tact.readSpectrum(0, spectrum);

Read peak

// read current peak for sensor 0
int peak = Tact.readPeak();

// read current peak for sensor 3
int peak = Tact.readPeak(3);

Read bias

// read current peak for sensor 0
int bias = Tact.readBias();

// read current peak for sensor 3
int bias = Tact.readBias(3);

Working with Serial

You can also control your Tact sensor from Processing on your PC via serial communiation. It works like this:

#include <Tact.h>
Tact Tact(TACT_MULTI);

void setup() {
  // Start Tact toolkit with Serial
  // default baud rate: 115200

  // you can define a custom baud rate like this:
  // Tact.beginSerial(9600);

void loop() {
  / used to receive tasks and send data via Serial
  // make sure to call this in every loop

  // do other stuff here


Any questions or feedback? Contact me on Twitter. For bug reports, please use the issue tracker.

Who made this?

This library has been developed by Philipp Schmitt at Studio NAND. It’s based on many smart ideas – so cheers to everyone who contributed her/his time to investigate capacitive technology! Special thanks to the team around Ivan Poupyrev for all the research within this field and Mads Hobye for his Arduino tutorial about advanced touch sensing. All of that has been a big help and inspiration.


Copyright (c) 2014 Philipp Schmitt. Licensed under the GNU Lesser General Public License. See license.txt for further details.

Any example code is released into the public domain.