Overview
The TTP223B Capacitive Touch Switch is a tiny 3-pin sensor module that replaces a mechanical pushbutton with a solid-state touch pad. It uses the TTP223B touch-detection IC to sense changes in capacitance on the metal pad, so when you (or any conductive object) touch the pad, the SIG output pin changes state. There are no moving parts, no debouncing required, and the response feels instant.
One of the most useful features of this module is that it can sense touch through non-conductive materials — plastic, paper, fabric, or thin acrylic up to about 2 mm thick. That makes it perfect for hidden buttons under enclosure lids, sealed weatherproof projects, escape-room puzzles, capacitive backplates, and touch-lamp DIY builds.
The TTP223B works with virtually any microcontroller because the SIG output is always at the same logic level as VIN. Power it from 3.3V and it outputs 3.3V; power it from 5V and it outputs 5V. That means it drops straight into Arduino, ESP32, Raspberry Pi, and Pico projects with no level shifting required. Two solder jumpers on the back let you flip the output mode (momentary vs. toggle/self-locking) and the active level (HIGH or LOW on touch).
At a Glance
Specifications
| Parameter | Value |
| IC | TTP223B |
| Operating Voltage | 2.0V - 5.5V DC |
| Operating Current | ~1.5 uA (low-power mode), ~3 uA (fast mode) |
| Output Logic Level | Matches VIN (3.3V in = 3.3V out, 5V in = 5V out) |
| Default Output | Active HIGH, Momentary |
| Output Modes | Momentary (default) or Toggle / Self-Lock (via jumper A) |
| Active Level | HIGH (default) or LOW (via jumper B) |
| Response Time | ~60 ms (fast mode), ~220 ms (low-power mode) |
| Sensing Distance | Through up to ~2 mm of plastic, paper, or thin acrylic |
| Pin Count | 3 (VIN, GND, SIG) |
| Module Dimensions | 15 x 11 mm (approx.) |
| Operating Temperature | -40°C to +85°C |
Pinout Diagram
Wiring Guide
Arduino Wiring
The TTP223B is one of the easiest sensors to wire to an Arduino: three pins, no resistors, no level shifting. Power the module from Arduino's 5V rail and read SIG with any digital input pin.
| TTP223B Pin | Arduino Pin |
|---|---|
| VIN | 5V |
| GND | GND |
| SIG | Digital Pin 2 |
ESP32 Wiring
The ESP32 uses 3.3V GPIO. Because the TTP223B's output level always matches its supply voltage, powering it from 3.3V means SIG also outputs 3.3V — no voltage divider needed.
| TTP223B Pin | ESP32 Pin | Details |
|---|---|---|
| VIN | 3.3V | Power from 3.3V so SIG outputs 3.3V |
| GND | GND | |
| SIG | GPIO 4 | Any digital input pin |
Raspberry Pi Wiring
Raspberry Pi GPIO operates at 3.3V. Power the TTP223B from the Pi's 3.3V rail so the SIG output matches GPIO logic levels.
| TTP223B Pin | Raspberry Pi Pin | Details |
|---|---|---|
| VIN | Pin 1 (3.3V) | |
| GND | Pin 6 (GND) | |
| SIG | Pin 11 (GPIO 17) | Any GPIO input pin |
Raspberry Pi Pico Wiring
The Pico runs on 3.3V GPIO. Power the TTP223B from the Pico's 3V3(OUT) pin so output levels match.
| TTP223B Pin | Pico Pin | Details |
|---|---|---|
| VIN | 3V3(OUT) (Pin 36) | |
| GND | GND | |
| SIG | GP15 | Any digital input pin |
Code Examples
Arduino
// TTP223B Capacitive Touch Switch - Arduino Example
// Touch the pad to toggle the onboard LED.
// SIG: Digital Pin 2
const int touchPin = 2;
const int ledPin = LED_BUILTIN;
bool ledState = false;
bool lastTouch = false;
void setup() {
Serial.begin(9600);
pinMode(touchPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.println("TTP223B ready. Touch the pad...");
}
void loop() {
bool touched = digitalRead(touchPin) == HIGH;
// Rising-edge detection: only toggle on the moment of touch
if (touched && !lastTouch) {
ledState = !ledState;
digitalWrite(ledPin, ledState ? HIGH : LOW);
Serial.println(ledState ? "LED ON" : "LED OFF");
}
lastTouch = touched;
delay(20); // small debounce-style delay
}
ESP32
# TTP223B Capacitive Touch Switch - ESP32 MicroPython Example
# Prints "Touched" while the pad is being touched.
# SIG: GPIO 4
from machine import Pin
import time
touch = Pin(4, Pin.IN)
print("TTP223B ready. Touch the pad...")
last = 0
while True:
val = touch.value()
if val != last:
if val == 1:
print("Touched")
else:
print("Released")
last = val
time.sleep_ms(20)
Raspberry Pi (Python)
#!/usr/bin/env python3
# TTP223B Capacitive Touch Switch - Raspberry Pi Example
# Uses gpiozero's Button class for clean event handling.
# SIG: GPIO 17 (physical pin 11)
from gpiozero import Button
from signal import pause
touch = Button(17, pull_up=False)
def on_touch():
print("Touched")
def on_release():
print("Released")
touch.when_pressed = on_touch
touch.when_released = on_release
print("TTP223B ready. Touch the pad...")
pause()
Raspberry Pi Pico (MicroPython)
# TTP223B Capacitive Touch Switch - Pico MicroPython Example
# Toggles the onboard LED each time the pad is touched.
# SIG: GP15
from machine import Pin
import time
touch = Pin(15, Pin.IN)
led = Pin("LED", Pin.OUT)
led_state = False
last = 0
print("TTP223B ready. Touch the pad...")
while True:
val = touch.value()
# Rising-edge detection
if val == 1 and last == 0:
led_state = not led_state
led.value(1 if led_state else 0)
print("LED ON" if led_state else "LED OFF")
last = val
time.sleep_ms(20)