Skip to content

Raspberry Pi Python code to use the MPR121 capacitive touch sensor from a threaded callback to count/log touches, while ignoring 'un-touch' events.

License

Notifications You must be signed in to change notification settings

jamieboyd/TouchDetector

Repository files navigation

TouchDetector

Python code to use the MPR121 capacitive touch sensor from Adafruit with a Raspberry Pi to count/log touches, while ignoring 'un-touch' events. Counting/Logging times of touches happens in a threaded callback (using RPi.GPIO.add_event_callback) triggered from the IRQ pin on the MPR121. A custom callback can be installed which is run from the main callback.

Adafruit_MPR121 requires the Adafuit MPR121 library which, in turn, requires the Adafuit GPIO library for I2C-bus access: git clone https://github.com/adafruit/Adafruit_Python_MPR121 git clone https://github.com/adafruit/Adafruit_Python_GPIO

NOTE : Adafruit_Python_MPR121 has been deprecated. Adafruit has a new module for mpr121 using CircuitPython at https://github.com/adafruit/Adafruit_CircuitPython_MPR121 but this requires the whole CircuitPython install, which is rather large. It may be worth switching to this in the future.

About

Raspberry Pi Python code to use the MPR121 capacitive touch sensor from a threaded callback to count/log touches, while ignoring 'un-touch' events.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages