Working Principle
The TTP223 is a single-channel capacitive touch detector IC. It uses a charge-transfer method: a sensing electrode (copper pad on the PCB) forms one plate of a capacitor with the environment. When a conductive finger approaches, the total capacitance increases by 5–20 pF. The TTP223’s internal oscillator detects this frequency shift and asserts the digital output.
Electrical Characteristics
TTP223 Key Specifications
| Parameter | Value |
|---|---|
| Supply Voltage | 2.0–5.5 V DC |
| Output Type | CMOS push-pull (active HIGH or LOW, configurable) |
| Response Time | ~60 ms (fast) / ~220 ms (low power) |
| Supply Current | ~2.5 µA (standby), ~8 µA (active) |
| Modes | Momentary (default) or Toggle (solder jumper A) |
| Sensitivity | Adjustable via external capacitor (0–50 pF on pad) |
Interfacing with an MCU
The TTP223 module has 3 pins: VCC, GND, and SIG (digital output). No pull-up needed — the output is push-pull. Connect SIG directly to any GPIO pin. For toggle mode, bridge solder jumper A on the module. For reduced sensitivity (to sense through thicker enclosures), add a 0–50 pF capacitor to the sensitivity pad.
Calibration
The TTP223 auto-calibrates on power-up (takes ~0.5 s). Do not touch the sensor during boot. The IC re-calibrates periodically to handle slow environmental drift (humidity, temperature). For fixed installations, adjust sensitivity with the external capacitor pad.
Code Example
// TTP223 capacitive touch with debounce — Arduino
#include <Arduino.h>
#define TOUCH_PIN 2
#define LED_PIN 13
#define DEBOUNCE 50 // ms
bool led_state = false;
bool last_touch = false;
unsigned long last_change = 0;
void setup() {
Serial.begin(115200);
pinMode(TOUCH_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
Serial.println("TTP223 Touch Sensor — Touch to toggle LED");
}
void loop() {
bool touched = digitalRead(TOUCH_PIN);
// Detect rising edge with debounce
if (touched && !last_touch && (millis() - last_change > DEBOUNCE)) {
led_state = !led_state;
digitalWrite(LED_PIN, led_state);
Serial.print("Touch! LED=");
Serial.println(led_state ? "ON" : "OFF");
last_change = millis();
}
last_touch = touched;
delay(10);
}
Real-World Applications
Smart Bedside Lamp
Touch-activated lamps use capacitive sensors behind glass or wood surfaces, enabling elegant interfaces with no moving parts. The TTP223 in toggle mode pairs with a MOSFET or relay to switch a lamp on/off with a single tap — no mechanical button to wear out or collect dust.
Limitations
- Moisture sensitivity: Water droplets on the sensor can trigger false positives. Use conformal coating in humid environments.
- Glove detection: Thick gloves (> 3 mm) reduce coupling; may require increased sensitivity or larger electrode.
- No pressure sensing: The TTP223 is binary (touch/no-touch) — cannot measure force. Use FSR or strain gauges for pressure-proportional inputs.
- Auto-calibration gotcha: If something rests on the sensor at power-up, it calibrates that as “no touch”, making subsequent detection unreliable.