esp32-touch-and-input
/esp32-touch-and-input
Use when capacitive touch or buttons misbehave - touch triggers by itself, works dry and fails when wet, a button bounces, or the pin reads pressed at boot. Covers touch sensing, calibration, debounce and the GPIO matrix.
- Author
- Esmail-sarhadi ↗
- Repository
- esp32-agent-skills ↗
- Licence
- MIT
- Last repository change
- 11.11.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 11.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when capacitive touch or buttons misbehave - touch triggers by itself, works dry and fails when wet, a button bounces, or the pin reads pressed at boot. Covers touch sensing, calibration, debounce and the GPIO matrix.
Original author description
Use when capacitive touch or buttons misbehave - touch triggers by itself, works dry and fails when wet, a button bounces, or the pin reads pressed at boot. Covers touch sensing, calibration, debounce and the GPIO matrix.
How it works
- Which chips have capacitive touch
- Reading it properly
- The pad is a capacitor with a long antenna attached
- Buttons: bounce, and the pull that is not there
- Wake from deep sleep
SKILL.md preview
--- name: esp32-touch-and-input description: Use when capacitive touch or buttons misbehave - touch triggers by itself, works dry and fails when wet, a button bounces, or the pin reads pressed at boot. Covers touch sensing, calibration, debounce and the GPIO matrix. license: MIT --- # Touch and input on ESP32 Touch sensing measures capacitance; every wire, every enclosure and every hand changes it. That is why touch designs fail in the field and pass on the bench. ## Which chips have capacitive touch The classic ESP32 has ten touch channels (GPIO4, 0, 2, 15, 13, 12, 14, 27, 33, 32) and the ESP32-S2 has fourteen. The **S3, C3 and C6 do not** - a design that needs touch and picked an S3 needs an external controller (TTP223, CAP1203, or a touch-capable display). ## Reading it properly `touchRead()` returns a raw count that drifts with temperature and supply voltage. Do not compare it to a constant: - Take a baseline at boot with nothing touching (average of 20 reads). - Trigger on a delta from that baseline, not on an absolute value. - Re-baseline slowly while untouched, so a humid day does not look like a finger. The hardware also offers an interrupt threshold (`touchAttachInterrupt`) that fires without polling, which is what you want for a wake source from deep sleep. ## The pad is a capacitor with a long antenna attached - Long traces pick up mains hum and the switching regulator. Keep the trace under 10 cm and surrounded by ground. - A ground plane directly under the pad increases the baseline and reduces the delta. A hatch, not a solid pour, is the usual compromise. - Water on the panel is a conductor: a design that works dry and triggers continuously when wet needs a guard ring driven at the same potential, or a different sensing technology. ## Buttons: bounce, and the pull that is not there Mechanical contacts bounce for 1 to 10 ms. A 20 ms debounce in software is enough for a human and too slow for nothing. Two hardware rules: - GPIO34 to 39 have no internal pull-ups. A button there with `INPUT_PULLUP` reads floating and looks pressed at random. - GPIO0, 2, 5, 12 and 15 are strapping pins. A button that holds one of them at boot changes the boot mode - the board flashes instead of running. ## Wake from deep sleep Only RTC GPIOs can wake the chip. On the classic ESP32 that is GPIO0 to 15 and 25 to 27; on the S3 it is 0 to 21. A button on GPIO35 wakes nothing, no matter what the code says. | Symptom | Usually | |---|---| | touch fires with nothing near | baseline taken with a hand on the board, or no ground reference | | works dry, fails wet | water bridging pads, no guard ring | | reads pressed at boot | floating input (34-39), or a strapping pin | | double triggers per press | no debounce, or debounce on the wrong edge | | battery drains in a week | polling touch in a loop instead of waking on the interrupt |
Files in this package (2)
- LICENSE.txt 1 KB
- SKILL.md 3 KB
Versions
The database has no other skills named esp32-touch-and-input.
Database snapshot: 13.11.2026 · package version 09ef52bcbe53 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 90esp32-touch-calibration-validation
Use when designing, reviewing, debugging or validating touch calibration validation for ESP32 firmware; apply target-specific constraints, failure analysis and measurable verification before release. - 90roblox-input
Use when handling Roblox touch, gamepad, keyboard, mouse or motion input, on-screen action buttons, or cross-platform action binding. - 100axiom-audit-touch
Use when the user mentions touch support on the Mac, touchscreen MacBook readiness, Sidecar touch, mouseDown or tracking-loop migration, or wants to audit a macOS app for touch. - 100input-keyboard-mouse-touch
Use this skill when handling user input in Phaser 4. Covers keyboard keys, mouse clicks and movement, touch events, pointer handling, drag and drop, hit areas, interactive objects, and gamepad support. Triggers on: keyboard, mouse, touch, pointer, drag, drop, click, input, gamepad, cursor keys. - 100esp32c6-touch-lcd147
Firmware development for the Waveshare ESP32-C6-Touch-LCD-1.47 board (ESP32-C6FH8, QFN32, 8 MB flash, SKU 31203 / 31201-M) — its 1.47" 172x320 JD9853 IPS panel, AXS5106L capacitive touch controller on I2C 0x63, QMI8658A IMU on I2C 0x6B, microSD/TF slot on the shared SPI2 bus,… - 100input-handling
Use when implementing input — InputEvent system, Input Map actions, controllers/gamepads, mouse/touch, action rebinding, and input architecture