Documentation

TTP223B Capacitive Touch Switch Sensor Module | ShillehTek Product Manual
Documentation / TTP223B Capacitive Touch Switch Sensor Module | ShillehTek Product Manual

TTP223B Capacitive Touch Switch Sensor Module | ShillehTek Product Manual

CapacitiveDigital Sensordigital-sensor-ttp223b-module-capacitive-touch-switchESP32manualPicoshillehtekTouch SensorTTP223B

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

Operating Voltage
2.0V - 5.5V
Output Type
Digital (matches VIN)
Default Mode
Momentary, Active HIGH
Response Time
~60 ms (fast mode)
Pin Count
3 pins
Pins
VIN, GND, SIG

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

TTP223B capacitive touch sensor pinout showing GND, VIN (VCC), and SIG signal output pins

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
Tip: The two solder jumpers on the back of the board (labeled A and B) let you change behavior. Bridging pad A switches output from momentary to toggle (self-locking) mode — tap once to turn on, tap again to turn off. Bridging pad B inverts the output, so SIG reads LOW when touched and HIGH when idle.

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
Warning: Do NOT power the TTP223B from 5V (VIN/USB rail) when connecting SIG directly to an ESP32 GPIO — SIG would then output 5V and could damage the 3.3V ESP32 pin. Always power from the ESP32's 3.3V rail.

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
Tip: The TTP223B's SIG line is push-pull, not open-drain. You don't need to enable a pull-up or pull-down resistor on the Pi side — the module drives the line both HIGH and LOW.

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
Tip: If you mount the Pico and TTP223B inside a plastic enclosure, the touch pad can sense fingers through the lid — up to about 2 mm of plastic. Great for sealed buttonless project boxes.

Code Examples

Arduino

ttp223b_arduino.ino
// 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_esp32.py
# 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)

ttp223b_rpi.py
#!/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_pico.py
# 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)

Frequently Asked Questions

How do I wire the TTP223B to my microcontroller?
Connect VIN to your board's 3.3V (or 5V for Arduino), GND to ground, and SIG to any digital input pin. The default behavior is active-HIGH momentary: SIG goes HIGH while you touch the pad and LOW when you let go. No pull-up or pull-down resistor is needed.
What do the two solder jumpers on the back (A and B) do?
Jumper A changes the output mode. Open (default) = momentary; bridged = toggle / self-locking, so each touch flips the SIG state and it stays there until the next touch. Jumper B changes the active level. Open (default) = active HIGH (SIG goes HIGH on touch); bridged = active LOW (SIG goes LOW on touch).
Can the TTP223B sense touch through plastic or other materials?
Yes. The TTP223B detects changes in capacitance, so it works through non-conductive materials like plastic, paper, fabric, or thin acrylic up to about 2 mm thick. This is great for hidden buttons under an enclosure lid or sealed weatherproof projects. It will NOT work through metal panels, because the metal blocks the capacitive field.
Does it work with 3.3V boards like ESP32, Raspberry Pi, and Pico?
Yes — and no voltage divider is needed. The TTP223B's SIG output is always at the same logic level as VIN. Power it from your 3.3V rail and it outputs 3.3V, which is safe for ESP32, Pi, and Pico GPIO. Just don't power it from 5V if you plan to connect SIG directly to a 3.3V-only pin.
My TTP223B keeps triggering by itself / false-triggering. What's wrong?
Capacitive sensors can be sensitive to nearby noisy wires, long unshielded SIG lines, or unstable power. Make sure the module has solid GND, keep the SIG wire short, and add a small ceramic cap (100 nF) across VIN and GND if you see noise. Also avoid placing the touch pad directly next to high-current AC wiring or motors.
Do I need any library to use the TTP223B?
No. The SIG output is just a digital HIGH/LOW signal, so you read it like a regular pushbutton. On Arduino, use digitalRead(); on Pi, use RPi.GPIO or gpiozero's Button class; on Pico/ESP32 MicroPython, use machine.Pin in input mode. No special driver is required.
What's the difference between momentary and toggle mode?
In momentary mode (default), SIG is HIGH only while you touch the pad — let go and it returns to LOW. In toggle (self-locking) mode, each touch flips SIG between HIGH and LOW and it stays in that state until the next touch — just like a wall light switch. Bridge solder pad A to switch into toggle mode.