Skip to content

Latest commit

 

History

History
76 lines (49 loc) · 2.16 KB

README.md

File metadata and controls

76 lines (49 loc) · 2.16 KB

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

Examples

Basic usage

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

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

Connections

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

Links

License

Licensed under the MIT License.