In this post we are going to show you how to connect a capacitive touch keypad to your Programmable XBee module.
If you got the Programmable XBee SDK created by Digi, you already have an example of how this set up works. Here, we’re using a MPR121 driver touchpad to simulate the keyboard of a mobile phone. When 10 numbers are pressed, it simulates a phone call.
The purpose of this example is to show you how to use the MPR121 driver based keyboard API. The MPR121 Capacitive Touch Keypad is available from Sparkfun (PN: SEN-10250): To test the MPR121 sample you need to install CodeWarrior 10.2 (download from Digi here) and Programmable XBee SDK (download from Digi here).
Once installed, open CodeWarrior, go to File -> New -> Programmable XBee Sample Project. In the new window that pops up, select the sample “MPR121 Telephone Example” found under the “Keyboards” item.
Now, you should build and flash the “MPR121 Telephone” demo application into the Programmable XBee. After flashing the demo, check that you have the application header in the serial console– this means that the demo is running.
In the config.xml you have the lines of the Programmable XBee module that should be used for this example and should be connected to the touch keypad.
Here is a screenshot of the config.xml file for the sample. As the MPR121 is an I2C sensor we need the I2C component and one GPIO acting as IRQ.
Here is the schematic:
After you have set up all the hardware, connect the power supply and then open a serial terminal. In the serial console you should see the sample banner. When you touch the keypad you will emulate the keyboard of a mobile phone.
The Programmable XBee SDK offers an API for controlling the 12 keys of the capacitive display with I2C protocol using an XBee programmable module:
|void mpr121_default_config (void)
Initialize mpr121 device
|ssize_t mpr121_write (uint8_t regaddr, uint8_t data)
Write a byte in the selected address.
|ssize_t mpr121_read (uint8_t regaddr)
Reads a byte from selected address.
Enjoy! Questions or comments? Let us know!