Codey OnlineArduino & ESP32 component library › Touch sensor TTP223B
Touch sensor TTP223B
Sensors

Touch sensor TTP223B

The TTP223B is a single-channel capacitive touch sensor IC used as a touch-button replacement. It provides a digital touch-detect output for direct connection to a microcontroller input and is commonly used in simple touch interfaces.

Width: 27.1 mm

Pinout — Touch sensor TTP223B

Pin Signal Description
SIG digital Digital touch-detect output from TTP223B — connect to a microcontroller input
VCC power Positive supply input for the touch sensor module, typically 2.0–5.5V
GND ground Ground reference for the touch sensor module and output signal

Example wiring diagram — Touch sensor TTP223B

From To Wire
board:5V x1:VCC red
board:GND x1:GND black
board:D2 x1:SIG green

Example Arduino code — Touch sensor TTP223B

This example was written and compile-checked for the arduino-uno. Codey Online adapts it to any other supported board for you.

const int touchPin = 2;
const int ledPin = 13;

void setup() {
  pinMode(touchPin, INPUT);
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
  Serial.println("TTP223B touch sensor example");
}

void loop() {
  int touchState = digitalRead(touchPin);

  digitalWrite(ledPin, touchState);

  Serial.print("Touch state: ");
  if (touchState == HIGH) {
    Serial.println("TOUCHED");
  } else {
    Serial.println("not touched");
  }

  delay(50);
}

Related components

18650 Battery Shield with USB-C Charger and 5V Boost Converter

18650 Battery Shield with USB-C Charger and 5V Boost Converter

2.4 inch OLED Display I2C 3.3V

2.4 inch OLED Display I2C 3.3V

3.5 inch TFT LCD Shield

3.5 inch TFT LCD Shield

50kg Load Cell Weight Sensor

50kg Load Cell Weight Sensor

Build your Arduino or ESP32 project with AI

Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.

Start for free