Digital Capacitive Touch Sensor arduino Interface

We need Switch to control electronics or electrical appliances or some thing, Some time electrical switches will give a shock when we use electrical switches with wet hand and then touch to control electrical or electronic load is much interactive than ordinary switches, may be some projects needs touch switch. Here the Digital Capacitive touch sensor arduino interface is made as an experiment.

TTP223B IC based digital capacitive sensors are very affordable and gives good response when we touch it, this sensor breakout can be easily interfaced with any kind of microcontrollers, and contains only three terminals for external interface.


TTP223 is 1 Key Touch pad detector IC, and it is suitable to detect capacitive element variations. It consumes very low power and the operating voltage is only between 2.0V~5.5V. The response time max about 60mS at fast mode, 220mS at low power mode @VDD=3V. Sensitivity can adjust by the capacitance(0~50pF) outside. Refer datasheet for more details.


  • Water proofed electric products
  • Button key replacement
  • Consumer products

Arduino Digital Capacitive Touch sensor Interface

Connect Vcc pin of Sensor breakout board to Arduino’s +5V pin and Gnd to Gnd. Connect Signal (SIG) pin to Arduino Digital pin D1 and Upload the following code to get response when you touch the Capacitive sensor.

Arduino Code for on board LED and Serial monitor observation.


//Digital Capacitive Touch Sensor Arduino Interfacing
#define sensorPin 1 // capactitive touch sensor - Arduino Digital pin D1
int ledPin = 13; // Output display LED (on board LED) - Arduino Digital pin D13
void setup() {
  pinMode(ledPin, OUTPUT);  
  pinMode(sensorPin, INPUT);
void loop() {
  int senseValue = digitalRead(sensorPin);
  if (senseValue == HIGH){
    digitalWrite(ledPin, HIGH);
    Serial.println("not touched");

Capacitive Touch Sensor Switch Arduino

This arduino hookup is Controlling the Load (AC Bulb) connected with 5V DC relay and the Signal pin for Relay is taken from Arduino Digital pin D13, other wirings for Capacitive touch sensor is same as for the observation hookup.

Upload the following Arduino Code to control (ON / OFF) the Load device.


//Digital Capacitive Touch Sensor Switch Arduino Interfacing
#define sensorPin 1 // capactitive touch sensor - Arduino Digital pin D1
int relayPin = 13; // Output RelayPin - Arduino Digital pin D13
boolean currentState = LOW;
boolean lastState = LOW;
boolean RelayState = LOW;
void setup() {
  pinMode(relayPin, OUTPUT);  
  pinMode(sensorPin, INPUT);
void loop() {
  currentState = digitalRead(sensorPin);
    if (currentState == HIGH && lastState == LOW){
    if (RelayState == HIGH){
      digitalWrite(relayPin, LOW);
      RelayState = LOW;
    } else {
      digitalWrite(relayPin, HIGH);
      RelayState = HIGH;
  lastState = currentState;

2 thoughts on “Digital Capacitive Touch Sensor arduino Interface

  1. Hi I want to interface the touch-sensor modules using Arduino UNO for Home automation to controlling relay but the garbage value are present in it i think it was switch bouncing and i used capacitor 0.1uf to deboubce the switch but was not stabled how to avoid this garbage values give some suggestions

  2. Hi i try to interface TT223 (touch Sensor )module to node mcu for home automation based project it was working but the sensitivity of the touch was very fast how to increase avoid this can i try with debouncing method ????

Leave a Reply

Your email address will not be published. Required fields are marked *