How a touch becomes HIGH · 05 of 9

Asleep and awake

Left alone, the chip looks at the pad about every 160 ms and sleeps in between, on about 1.5 µA. A touch wakes it to a look every 20 ms or so for about 12 s after you let go. So the first touch after a rest takes up to 220 ms to show on SIGNAL, and the next one up to 60 ms.

It sleeps between looks

The TTP223 spends almost all its time asleep. In its low-power mode it wakes about every 160 ms, measures the pad, compares, and sleeps again. That is how it idles on about 1.5 µA at 3 V, a figure a coin cell would hardly notice.

The cost is that a touch waits for the next look.

Asleep and awake
First touch seen after
...
Second touch seen after
...
Datasheet limits
220 / 60 ms
Idle, the chip looks at the pad about every 160 ms and sleeps in between, on about 1.5 µA. Press Play.

Press Play. The first touch lands while the chip is idling, and SIGNAL stays LOW until the next look finds it. After that the chip is awake and looks about every 20 ms, so the second touch shows almost at once. The positions of the looks are illustrative; the periods are the datasheet's.

The numbers Tontek gives

At 3 V the datasheet gives the response time as at most 220 ms from low-power mode and at most 60 ms once awake. Both are upper limits, not typical times. After the finger lifts, it stays awake for about 12 s, then drops back to sleep.

In the six-pin package on this board the low-power mode is fixed. The larger TTP223 packages have a pin to keep the chip always awake; this one does not.

What it means for a sketch

Nothing, mostly. A finger stays on a pad for a few hundred milliseconds, and both figures are inside that. It matters in two places:

  • Timing a touch. A stopwatch started on SIGNAL going HIGH starts late by up to a fifth of a second on the first touch after a rest, and by much less on the next.
  • Quick taps. A brush of the pad shorter than one idle gap can fall between two looks and never reach SIGNAL at all.

There is no bounce to handle. A mechanical switch chatters for a few milliseconds as its contacts settle; this chip decides once per look and drives SIGNAL cleanly, so the sketch can act on the first change it sees.

When it does not work

The first touch feels slow, the rest are fine.

That is the chip waking. Idle, it looks at the pad only about six times a second, so the first touch waits for the next look: up to 220 ms by the datasheet. Once awake it looks every 20 ms or so, and stays awake about 12 s after the last touch.

A very quick tap is sometimes missed.

A tap shorter than the gap between two looks can fall between them, and when the chip is idle that gap is about 160 ms. Rest the finger a moment longer. Nothing in the sketch can fix a touch the chip never saw.

Can I make it always fast?

Not on this chip. Fast mode is an option pin on the larger TTP223 packages; in the six-pin one fitted here, low-power mode is fixed inside the chip. If every millisecond matters, the ESP32's own touch pins are read by the sketch directly.

How much current does it draw?

The chip: about 1.5 µA idle and 3.5 µA awake, at 3 V, by the datasheet. The LED is the big load: about 1 mA on 3.3 V and 2.6 mA on 5 V while the pad is touched, worked out rather than measured. Untouched, the block costs almost nothing.

Alongside this page
Where this goes next

Why VCC is the voltage your pin sees, and which pin to put it on.

VCC sets the HIGH →

Edit this page — content/books/tp223-touch-sensor/asleep-and-awake.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

This page covers several products. Choose yours to see the right discussions.

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →