Catalex TTP223B Arduino Capacitive Touch Sensor Tutorial

A Low Cost Reliable Input Device

Capacitive Touch SensorThis device uses your body as part of the circuit.  When you touch the sensor pad, the capacitance of the circuit is changed and is detected.  That detected change in capacitance results in the output changing states.

When I first got this,  I expected a glitchy device,  that while functional,  would occasionally have unpredictable output results.

I may have been wrong.   After playing for a few hours, I can’t seem to get it to do anything other than what I expected it to do.  If you’re looking for robust user input,  this might do the trick.

Where to Find One

The TTP223B Touch Sensor is readily available on the following sites.




Bang Good

Catalex Capacitive Touch Sensor Pin Outs

Like  a lot of the sensors out there, this is three pin sensor.  You provide, power, ground and monitor the output.

Catalex Capacitive Touch Sensor Pin Outs

Catalex Capacitive Touch Sensor Arduino Tutorial

Connect the Touch Sensor to Your Arduino

This is a real simple set up.  You will know that you have power properly applied when the green LED is on.

Arduino Capacitive Touch Sensor TutorialCopy, Paste and Upload the Arduino Sketch

The sketch below provides an output to your serial monitor indicating whether or not the sensor is pressed.

// Henry's Bench
// Capacitive Touch Sensor Tutorial
// When Sig Output is high, touch sensor is being pressed
#define ctsPin 2 // Pin for capactitive touch sensor
int ledPin = 13; // pin for the LED
void setup() {
  pinMode(ledPin, OUTPUT);  
  pinMode(ctsPin, INPUT);
void loop() {
  int ctsValue = digitalRead(ctsPin);
  if (ctsValue == HIGH){
    digitalWrite(ledPin, HIGH);
    Serial.println("not touched");

Test Your Arduino Sketch

Once you’ve uploaded the sketch, open your serial monitor.   Touch the sensor pad while looking at the monitor.   You should see an output that looks something like the picture below.

Arduino Capacitive Touch Sensor Tutorial Output