Touch sensor, TTP223
A finger on the pad drives SIG high within 60 ms. No pull-up, no bounce.
- 3 pins
- 2 settings
- In 1 project
- In 1 lesson
The Touch sensor, TTP223 in brief
What it is, and every setting the properties panel gives it.
The TTP223 module is the small red square with a round pad printed on it, a capacitive touch sensor: a finger adds a few picofarads to the pad, and the chip drives SIG in response. It has three pins, SIG, VCC and GND, and runs from 2.0 to 5.5 volts, so it powers from an Arduino Uno’s 5 volts or straight from an ESP32’s 3.3 volts, keeping SIG safe for its pins. SIG is a push-pull output, so it needs no pull-up and does not bounce. Mokxi follows the Tontek datasheet: a touch takes the full 60 milliseconds to reach SIG and so does a release, so a shorter tap is never seen, and SIG sits at its power-on state for half a second while the chip calibrates. A finger already on the pad when that time ends becomes part of the pad, which is the classic fault of a module that ignores its first touch. The toggle and activelow properties are the B and A solder jumpers on the back, for toggle or active-low output. Sensitivity, slow recalibration and water on the pad are not modeled.
- Family
- Inputs
- Pins
- 3
- toggle
- false
- activelow
- false
A circuit built around it, running and explained: the Touch sensor simulator.
3 pins
Named as the editor names them, so a wire lands where you expect it.
How to use the TTP223 touch sensor with an Arduino
SIG to a digital pin, VCC to a supply and GND to GND. SIG is a real output, so set the pin to plain INPUT, not INPUT_PULLUP, and it reads HIGH while a finger is on the pad. The climate display here powers the module from the Uno’s 3V3 pin, and its 3.3 V high still reads as HIGH on the 5 V Uno.
To make the pad a switch, act on the rising edge, the moment SIG goes from LOW to HIGH, not on the level; holding a finger there then flips the setting once. Keep fingers off the pad for the first half second after power-up: the chip is calibrating then, and a finger still on the pad when it finishes becomes part of the pad until it lifts off.
On an ESP32 power it from 3.3 V and read SIG on any GPIO; the ESP32-C3 desk robot reads its pad on GPIO 3.
bool touched = digitalRead(TOUCH) == HIGH;
bool flipped = touched && !wasTouched;
wasTouched = touched;
if (flipped) {
fahrenheit = !fahrenheit;
}What is true about the Touch sensor, TTP223, here
In its help article’s own words: what the simulation gets right, and where it stops.
Modeled
From the Tontek TTP223 datasheet:
Response time. Up to 60 ms in fast mode, which is the only mode the six-pin chip
on these modules has. A touch takes 60 ms to reach SIG, and so does a release. A
tap shorter than that is never seen.
Power-on calibration. For about half a second after power comes up the chip is measuring the pad and ignores it. A finger already on the pad when that time ends becomes part of the pad: it has to come off and go back on before it counts.
The output. A real push-pull output: 8 mA sink and 4 mA source at 3 V, so it drives a pin or an LED with no pull-up.
No time limit. The module's chip has its maximum-on-time timeout disabled, so
SIG stays high for as long as the finger stays.
Not modeled
Sensitivity (the pad feels a finger or it does not), the slow recalibration while untouched, and water on the pad.
From TTP223 touch sensor, in full.
See the Touch sensor, TTP223 in a project
One built-in project uses it. It opens in the editor, already wired.
Where it turns up in a lesson
One lesson places it in its own circuit.
The boards it is shown on
This board has a built-in project with the Touch sensor, TTP223 in it.
The rest of the bench
Every one of these is drawn and simulated the same way.
Wire up the Touch sensor, TTP223
Open the editor and push it into the breadboard. It is free, and it runs on your own machine.