Using MPR121 touch keyboard controller with Arduino
MPR121 is a Proximity Capacitive Touch Sensor Controller developed by the company NXP. Being only 3x3 millimeters in size this chip allows us to connect up to 12 touch sensors. The communication protocol is I2C. This makes it an ideal candidate for the user keyboard in the URU Card project.
Unfortunately, this IC is not produced anymore but still can be purchased for quite a low price.
Schematic
The schematic is extremely simple and follows the Datasheet. Initially, I did not have a 75K resistor and used a 68K one and it worked.
PCB Layout
Touch inputs are connected to twelve copper pads of 8x8 millimeters each. The copper from the other side of the board is removed.
Software
There is a library to implement all the required features of the chip - Adafruit MPR121 - available in the PlatformIO library repository. Usage of the library is extremely simple:
#include <Adafruit_MPR121.h>
Adafruit_MPR121 cap = Adafruit_MPR121();
void setup()
{
cap.begin(0x5A);
}
void loop()
{
// bits 0..11 are set if the corresponding pad is touched
uint16_t touched = cap.touched();
}
For the testing the keyboard and the UI in general I have written a tiny program using the examples provided by library.
Conclusion
I’ve met negative reviews about stability of the chip and problems to program it. Luckily I did not have any issues so far. The touch recognition works absolutely stable, the keyboard does not need any debouncing circuitry or code.
References
- MPR121 Datasheet https://www.nxp.com/docs/en/data-sheet/MPR121.pdf
- Arduino Library Adafruit MPR121
- URU Card UI test project URU Card - UI Test