Skip to content

TTP223 Touch Sensor

The TTP223 digital touch sensor is a small, inexpensive capacitive touch switch module commonly used in Arduino, Raspberry Pi, and other microcontroller projects as a modern alternative to mechanical push buttons. You can find it on eBay for under $1 USD.

Here’s a breakdown of its key features and how it works:

Overview

  • Core IC: TTP223 (from Tontek) — a capacitive touch sensing controller.
  • Form factor: Small PCB (\~24 mm × 24 mm) with a copper pad (sensor area), a TTP223 IC, and a few passive components.
  • Function: Detects when a finger (or other conductive object) is near the pad by measuring changes in capacitance, then outputs a digital HIGH or LOW signal.

Main Features

  1. Operating Voltage:

  2. Typically 2.0 V – 5.5 V, so it works directly with both 3.3 V and 5 V logic systems.

  3. Output Signal:

  4. Digital — HIGH (active) or LOW (inactive).

  5. By default, the output is LOW when untouched and HIGH when touched, but some versions allow reversing this.

  6. Touch Sensitivity:

  7. Triggered by direct finger contact or by touching through thin non-metallic materials (e.g., plastic, glass, acrylic).

  8. Typical sensing distance: \~5 mm (adjustable by changing PCB pad size or circuit values).

  9. Modes of Operation: (Controlled by solder jumper pads marked A and B on the PCB)

  10. Momentary (default): Output stays HIGH only while touching.

  11. Toggle: Output changes state each time you touch (touch-on, touch-off).
  12. Active High / Active Low: Selectable logic polarity.

  13. Low Power Consumption:

  14. Two modes: Low-power mode (\~1 µA standby) or Fast mode for faster response (\~3 mA standby).

  15. Response time typically \~60 ms in low-power mode, \~6 ms in fast mode.

  16. Durability & Reliability:

  17. No moving parts → longer lifespan than mechanical switches.

  18. Resistant to dust, moisture, and vibration.

Pinout

Pin Label Description
1 GND Ground
2 VCC Power supply (2–5.5 V)
3 OUT Digital output signal

Typical Uses

  • Replacing mechanical buttons in projects.
  • Hidden switches under a non-metallic surface.
  • Lamp touch controls.
  • Interactive exhibits or kiosks.
  • Wearable electronics.

Example MicroPython Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# MicroPython: TTP223 touch -> onboard LED
from machine import Pin
from time import sleep_ms

TOUCH_PIN = 2            # TTP223 OUT wired to GP2 (change if needed)
led = Pin("LED", Pin.OUT)  # Pico's onboard LED
touch = Pin(TOUCH_PIN, Pin.IN)  # TTP223 provides a digital HIGH on touch

while True:
    led.value(touch.value())   # LED ON when touched, OFF otherwise
    sleep_ms(5)                # tiny delay to reduce CPU use

Any MicroPython board with an external LED

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# MicroPython: TTP223 touch -> external LED
from machine import Pin
from time import sleep_ms

TOUCH_PIN = 2   # TTP223 OUT
LED_PIN   = 15  # Your LED’s GPIO (through a resistor to GND)

touch = Pin(TOUCH_PIN, Pin.IN)      # TTP223 OUT is push-pull; no pull needed
led   = Pin(LED_PIN,   Pin.OUT)

while True:
    led.value(touch.value())
    sleep_ms(5)

Notes

TTP223 output is typically HIGH when touched (default board config). If your board is configured “active-low,” just invert: led.value(1 - touch.value()).

No debouncing is necessary—TTP223 already conditions the signal. If you need extra smoothing, increase the delay or add a simple moving average.

How It Works

The TTP223 chip periodically charges and discharges the touch pad and measures the time constant. When a finger is nearby, the capacitance increases slightly, slowing the charge/discharge cycle. The chip detects this change and drives the OUT pin accordingly.

References