https://github.com/todbot/touchytouch
Capacitive sense (capsense) touch Arduino library that mimics how CircuitPython touchio work
https://github.com/todbot/touchytouch
arduino capacitive capsense circuitpython rp2040 sense touch touchio
Last synced: 6 months ago
JSON representation
Capacitive sense (capsense) touch Arduino library that mimics how CircuitPython touchio work
- Host: GitHub
- URL: https://github.com/todbot/touchytouch
- Owner: todbot
- License: mit
- Created: 2024-02-05T02:18:08.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-05T01:09:28.000Z (10 months ago)
- Last Synced: 2025-07-28T22:44:45.065Z (6 months ago)
- Topics: arduino, capacitive, capsense, circuitpython, rp2040, sense, touch, touchio
- Language: C++
- Homepage:
- Size: 11.7 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TouchyTouch
Capacitive sense touch Arduino library that mimics how CircuitPython `touchio` works.
This library emulates how the CircuitPython touchio library implements capacitive touch sensing.
It also includes basic button debouncing.
It is based on the CircuitPython "touchio" code at: https://github.com/adafruit/circuitpython/blob/main/shared-module/touchio/TouchIn.c
The `touchio` code is not platform-specific, but does require a 1M pull-down resistor.
Thus the `TouchyTouch` Arduino library is also not platform-specific and also requires a pull-down resistor.
### How it works:
From the `touchio` C code:
```
// This is a capacitive touch sensing routine using a single digital
// pin. The pin should be connected to the sensing pad, and to ground
// via a 1Mohm or thereabout drain resistor. When a reading is taken,
// the pin's capacitance is charged by setting it to a digital output
// 'high' for a few microseconds, and then it is changed to a high
// impedance input. We measure how long it takes to discharge through
// the resistor (around 50us), using a busy-waiting loop, and average
// over N_SAMPLES cycles to reduce the effects of noise.
```