Skip to content

MikeCoats/CircuitPython_AT42QT2120

Repository files navigation

CircuitPython-AT42QT2120

Documentation Status Build Status Code Style: Ruff

A CircuitPython module for the AT42QT2120 capacitive touch sensor IC, (mostly) compatible with Adafruit's MPR121 library.

This library's interface is designed after Adafruit's MPR121 module. The ICs diverge in functionality, so we only include functions available on both chips. To determine which functionality is required, I surveyed several consumers of the MPR121 library. This includes three examples from Adafruit, and many of the projects "dependent" on their library on GitHub.

A full list of all the projects I surveyed and their usage of the MPR121 library can be found in the Compatibility Audit. This audit should let us cover enough of the design to use an AT42QT2120 as a drop-in replacement for most users of the MPR121.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install circuitpython-at42qt2120

Usage Example

import busio
import board
from adafruit_bus_device import i2c_device

from at42qt2120 import AT42QT2120

i2c_bus = busio.I2C(board.SCL, board.SDA, frequency=100000)
at = AT42QT2120(i2c_bus)

print(at.touched_pins)
print([at[i].raw_value for i in range(12)])

Documentation

API documentation for this library can be found on Read the Docs.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

About

CircuitPython module for the AT42QT2120 capacitive touch sensor IC

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks