Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

MicroPython MPR121

MicroPython driver for MPR121 capacitive touch keypads and breakout boards.

demo

demo

Compatible with:

These boards use 3.3V logic, so you would want to use a logic level converter with this for 5V systems.

Examples

Copy the file to your device, using ampy, webrepl or compiling and deploying. eg.

$ ampy put mpr121.py

Basic usage

from machine import Pin, I2C
import mpr121
import time

i2c = I2C(scl=Pin(5), sda=Pin(4))
mpr = mpr121.MPR121(i2c, 0x5A)

while True:
	print(mpr.touched())
	time.sleep_ms(100)

For more detailed examples, see /examples

Parts

Connections

VCC GND STM32F407VET6 Mini

from machine import I2C
import mpr121
i2c = I2C(3)
mpr = mpr121.MPR121(i2c, 0x5A)
MPR121 STM32F407VET6
VCC 3V3 (or 5V)
IRQ D3 (optional)
SCL A8 (SCL)
SDA C9 (SDA)
GND GND
  • I2C(1) SCL=B6, SDA=B7
  • I2C(2) SCL=B10, SDA=B11
  • I2C(3) SCL=A8, SDA=C9

TinyPICO (ESP32)

from machine import Pin, I2C
import mpr121
i2c = I2C(scl=Pin(22), sda=Pin(21))
mpr = mpr121.MPR121(i2c, 0x5A)
MPR121 TinyPICO ESP32
VCC 3V3
IRQ GPIO32 (optional)
SCL GPIO22 (SCL)
SDA GPIO21 (SDA)
GND GND

Wemos D1 Mini (ESP8266)

from machine import Pin, I2C
import mpr121
i2c = I2C(scl=Pin(5), sda=Pin(4))
mpr = mpr121.MPR121(i2c, 0x5A)
MPR121 D1 Mini ESP8266
VCC 3V3
IRQ D3 (optional)
SCL D1 GPIO5 (SCL)
SDA D3 GPIO4 (SDA)
GND GND

Links

License

Licensed under the MIT License.

Copyright (c) 2018 Mike Causer

About

MicroPython driver for MPR121 capacitive touch keypads and breakout boards

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages