Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mcauser/micropython-ttp223

MicroPython examples using TTP223 capacitive touch module
https://github.com/mcauser/micropython-ttp223

capacitive-touch-sensor micropython stm32f4 ttp223

Last synced: about 16 hours ago
JSON representation

MicroPython examples using TTP223 capacitive touch module

Awesome Lists containing this project

README

        

# MicroPython TTP223

Using a TTP223 1-key capacitive touch module with MicroPython.

I was going to write a driver for this module, but it's pretty much just a drop in replacement for a push button. No driver needed.

The module features 3 pins, VCC, I/O and GND and has a red LED which illuminates when a touch is detected and the I/O pin goes HIGH.

It's sensitive enough to detect my finger around 3mm away from the touch pad.

![demo](docs/demo.jpg)

#### Examples

**Basic usage**

```python
from machine import Pin
import time

d3 = Pin('D3', Pin.IN, Pin.PULL_DOWN)

while True:
print(d3.value())
time.sleep_ms(100)
```

**Using interrupts**

```python
from machine import Pin

d3 = Pin('D3', Pin.IN, Pin.PULL_DOWN)
d4 = Pin('D4', Pin.IN, Pin.PULL_DOWN)

def touch(pin):
print('Touched {}'.format(pin.name()))

d3.irq(touch, Pin.IRQ_FALLING)
d4.irq(touch, Pin.IRQ_FALLING)
```

## Trigger mode

There are 2 pads A and B which can be bridged with a dab of solder to change the trigger mode.

Pad A | Pad B | Description
----- | ----- | --------------------------------------
Open | Open | Momentary, High TTL level output (default)
Short | Open | Momentary, Low TTL level output
Open | Short | Latching, High TTL level output
Short | Short | Latching, Low TTL level output

## Parts

* [VCC-GND STM32F407VET6 mini](https://www.aliexpress.com/item/STM32F407VET6-Mini-version-of-the-core-board-STM32-minimum-system-version/32709285751.html) $15.47 AUD
* [TTP223 Capacitive Touch Module](https://www.aliexpress.com/item/5PCS-LOT-NEW-TTP223-Touch-button-Module-Capacitor-type-Single-Channel-Self-Locking-Touch-switch-sensor/32416625219.html) $0.22 AUD
* [Female-Female Dupont wires](https://www.aliexpress.com/item/10pcs-10cm-2-54mm-1p-1p-Pin-Male-to-Male-Color-Breadboard-Cable-Jump-Wire-Jumper/32636873838.html) $0.64 AUD

## Connections

STM32F407VET6 | TTP223 Capacitive Touch Module
------------- | -----------------
3V3 (or 5V) | VCC
D3 (any pin) | I/O
GND | GND

## Links

* [micropython.org](http://micropython.org)
* [TTP223 datasheet](https://infusionsystems.com/support/TTP223.pdf)

## License

Licensed under the [MIT License](http://opensource.org/licenses/MIT).