Motion
Interfacing TTP223 Motion with Espressif ESP32
What is the TTP223?
TTP223 practical reference
A capacitive touch-sensing breakout that swaps a physical button for a solid-state touch pad, common in enclosure-friendly builds. Built around the TTP223 capacitive touch IC, it detects the small capacitance change caused by a finger touching (or even approaching through a thin non-metal panel) its copper pad, outputting a simple digital HIGH/LOW signal — a clean way to add a button-like input to a project without any moving parts or a hole cut in the enclosure.
Key specifications
- Sensor type: TTP223 capacitive touch sensor IC
- Operating voltage: 2.0V–5.5V DC
- Operating current: ~1.5-3 µA in standby, low active current
- Output modes: Toggle mode or momentary (direct) mode, selectable via a solder jumper on most breakout boards
- Output logic: Active HIGH by default on most modules (some variants can be configured active LOW)
- Touch-through thickness: Can sense through a few millimeters of non-conductive material (plastic, glass, acrylic), useful for sealed enclosures
- Response time: ~60ms typical
- Interface: Single digital output pin, read directly as a HIGH/LOW input
Pinout and connection notes
A small solder jumper pad on the back of most TTP223 breakout boards selects between momentary mode (output HIGH only while actively touched) and toggle mode (output flips between HIGH and LOW with each separate touch) — check which mode your board is configured for before wiring up your project logic, since it changes how you should read the pin in code.
- VCC: Power, 2.0–5.5V DC
- GND: Ground
- SIG (OUT): Digital output — goes HIGH when touched (in direct/momentary mode), or toggles state on each touch (in toggle mode)
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up TTP223 with Espressif ESP32
Wiring
| Component pin | Espressif ESP32 pin | Note |
|---|---|---|
| VCC | 3V3 or 5V (VIN) | Works across its full 2.0-5.5V range, so either rail is fine |
| GND | GND | |
| SIG (OUT) | GPIO4 | Output logic level matches VCC — if you power it from 5V, its HIGH output is also ~5V into a 3.3V GPIO |
Swipe sideways to see every column →
- Power this from 3V3 rather than 5V on an ESP32 project — since the module's output swings to VCC level, powering it from 3V3 keeps the touch signal safely within GPIO limits without needing a divider.
- Same direct-mode-vs-toggle-mode caveat as the Arduino Uno — check your board's solder jumper if the behavior seems inverted from what you expect.
- ESP32's native touch pins (touchRead()) are a completely different, capacitive-sensing feature built into the chip itself — this component is a separate, simpler alternative that doesn't need any of that.
Related Components
Related Guides & Projects
MicroPython vs Arduino on ESP32: Which Should You Learn First?
An honest comparison for beginners: where MicroPython is easier, where Arduino C++ is faster, how libraries and memory differ, and how to choose based on your project instead of hype.
MicroPython ESP32 Web Server: Control an LED or Relay from Your Browser
Create a working web server with the socket module, parse requests, serve a responsive control page for an LED or a relay, keep the displayed state truthful, choose a safe relay startup state and make the server survive bad or repeated requests.
MicroPython on ESP32 and Raspberry Pi Pico W: The Complete Guide
A structured MicroPython learning path for ESP32 and Pico W. Set up your tools, control GPIO, read sensors, connect to WiFi, build web servers, publish MQTT data and make projects reliable. Start here, then follow the links by level.
boot.py vs main.py in MicroPython: What Runs, When and Why
Understand the difference between boot.py and main.py in MicroPython, startup order, Wi-Fi setup, project structure, and recovery from boot errors.