MSP430 Low Cost PinOsc Capacitive Touch Keypad

From Texas Instruments Wiki
Jump to: navigation, search


When attempting to build a low cost 45 button remote keypad, there are numerous factors to consider. These might include processor selection (pin count, memory, speed), external components required, sensor configuration, power consumption, scanning interval, etc.

The MSP430 Value Series addresses all of these factors with a variety of low cost MCU options. Specifically utilized in this application report is the MSP430G2553 featuring PinOsc GPIOs designed for capacitive touch sensing along with integrated 16-bit Timer0_A3 and Timer1_A3 modules for timing control of measurement process and scan interval to permit low-power and low-cost flexible capacitive touch solutions.

Within next sections, the system components targeting a Capacitive Touch Keypad interface will be introduced and discussed. This will include focus on the sensor configuration options, system firmware, PC GUI interface, and PCB.
Additional information on implementing Low Cost PinOsc Capacitive Touch can be found in the MSP430 Low Cost PinOsc Capacitive Touch Overview.

For other MSP430G2553 PinOsc application examples, see MSP430 Low Cost PinOsc Capacitive Touch Trackpad.

System Overview

Within this section, the system sub-components will be addressed in detail. Figure 1 shows one system example that implements MSP430 PinOsc Capacitive Touch using a sensor array.
MSP430 Keypad System Block Diagram.jpg
Figure 1. System Block Diagram
User Note: Throughout the following sections, details will be presented relative to the MSP430G2553. Other MSP430 devices have the PinOsc GPIO structure, so be certain to reference the appropriate device datasheet for exact use case details.

Capacitive Touch Sensor Arrays

The first component to low cost PinOsc Capacitive Touch sensing using the MSP430 is the sensor configuration. There are a number of methods of implementing a capacitive touch Keypad (Individual Button Sensors shown in Figure 2, Half-Pad Array Sensors shown in Figure 3, and Linear Row-Column Array Sensors shown in Figure 4). Each approach has its benefits and drawbacks.

Individual Button Sensor Elements

Using Individual Button Sensor Elements (Figure 2) offers the ability to detect all buttons being pressed at any point, the decoder method is very simple, and offers a clean surface detection area. However, it does require 12 GPIO inputs to implement and consumes more average power for scanning. While this is fine for some application, it would make it difficult or impossible for other features like swipe gesture or sub-point resolution detection used in Trackpad applications.
Figure 2. Individual Button Sensors
Figure 2. Individual Button Sensors

Half-Pad Array Sensor Elements

Using Half-Pad Array Sensor Elements (Figure 3) provides a cleaner surface area for each button position to enable easier detection, requires fewer GPIOs (7), and is lower power than the individual button scanning. However, it cannot support simultaneous button detection on all pins (multiple buttons can however be detected on any single row or column). Like the Individual Button Sensors, this method is not optimal for swipe gesture, and is incapable of supporting sub-resolution Trackpad applications.
Half Pad Array Sensor Elements.jpg
Figure 3. Half-Pad Array Sensors

Linear Row-Column Array Sensor Elements

Finally, using Linear Row-Column Array Sensor Elements (Figure 4) provides a sensor surface area that is capable of supporting individual button position detection, simple gesture analysis, and sub-sensor point detection that can be used for Trackpads. Also, like the Half-Pad Sensors it requires fewer GPIOs (7) and is lower power than the individual button scanning. In addition, it can also be used for implementing simplified gesture detection like horizontal or vertical swipes. However, for button detection, it also cannot support simultaneous detection on all pins (multiple buttons can however be detected on any single row or column). 
Figure 4. Linear Row-Column Array Sensors
Figure 4. Linear Row-Column Array Sensors

MSP430G2553 PinOsc Capacitive Touch Keypad PC GUI

Before Running the MSP430G2553 PinOsc_Remote_Keypad_GUI, make sure that the MSP430G2553_Remote_Custom CCS Project is loaded to the Target Board.  See Download section below.

PinOsc Remote GUI Sleep.jpg  PinOsc Remote GUI Active.jpg 

Low Power Sleep Operation

Swipe ON to Activate Keypad

Recommend using INPUT as a finger landing pad to begin swipe ON operation.  Once you observe the D8 LED flashing faster, you can swipe across 0 and Enter to trigger the Wakeup.

Keypad Active Operation Enabled

Press EXIT to return to Sleep Operation

Easter Egg is implemented by pressing the two unlabled buttons in the lower right corner at the same time.  Use your thumb to tap cover both buttons.

MSP430G2553 PinOsc Capacitive Touch Remote Sensor Element Calibration GUI

In order to have proper PinOsc detection, it is important to optimize the Sensor Elements Threshold Levels.  The MSP430G2553 PinOsc Capacitive Touch Remote Sensor Element Calibration GUI shown here enables determination of the MAX detected sensor element level.  The GUI can ouput 3 option levels (Thick Plastic, Med Plastic, or Thin Plastic).  These settings also scale the graphing functionality. 

The result of the Calibration should be saved into the CapTouchLib folder in the MSP430G2553_Remote_Custom Project.  Make reference to the structure.c file in the CapTouchLib folder. 

Important Note:  When using the MSP430G2553_Remote_SensorElementCalibration_Custom CCS Project, there are three Project Active Build Configuration options (THICK_PLASTIC, MED_PLASTIC, or THIN_PLASTIC).  The output of the PinOsc_Remote_Sensor_Calibration_GUI reflects the selected configuration.  To get the desired performance of the MSP430G2553_Remote_Custom Project, the same Project Active Build Configuration option(THICK_PLASTIC, MED_PLASTIC, or THIN_PLASTIC) must also be applied.

PinOsc Remote Sensor Calibration GUI.jpg

Output Data Content will look something like the following and can be saved as an include file (board_xxx.h) into the CapTouchLib folder and be referenced in the structure.c file.
#include "structure.h"
#ifdef THIN_PLASTIC // THIN Plastic ~0.1mm
    #define C1_MAX_VALUE 1352
    #define C2_MAX_VALUE 1273
    #define C3_MAX_VALUE 1462
    #define C4_MAX_VALUE 1389
    #define C5_MAX_VALUE 1256
    #define R1_MAX_VALUE 908
    #define R2_MAX_VALUE 1050
    #define R3_MAX_VALUE 1365
    #define R4_MAX_VALUE 1576
    #define R5_MAX_VALUE 1618
    #define R6_MAX_VALUE 1826
    #define R7_MAX_VALUE 1911
    #define R8_MAX_VALUE 2036
    #define R9_MAX_VALUE 2267

Since these are MAX reading, each sensor element #define xxx_MAX_VALUE is applied to the .threshold_cal, .threshold_sense, and .maxResponse values.

In the structure.c, for each sensor element (const struct Element type) these levels are set as follows:

.threshold_cal = 0.1 * xxx_MAX_VALUE (or 10% of the xxx_MAX_VALUE level) = level to which the sensor element baseline adjustment occurs due to temperature drift.

.threshold_sense = 0.3 * xxx_MAX_VALUE (or 30% of the xxx_MAX_VALUE level) = level above which the sensor element is detected as active.

These levels can be changed if desired.

MSP430G2553 PinOsc Capacitive Touch Keypad PCB Schematic

MSP430 Keypad Schematic.jpg 

MSP430G2553 PinOsc Capacitive Touch Keypad PCB Layout

PCB PinOsc Remote SilkScreen.jpg PCB PinOsc Remote Front.jpg PCB PinOsc Remote Back.jpg
Silkscreen Front Back

Download Packages

MSP430 Remote Keypad QuickStart using CCSv4.2.4


MSP430G2553 Remote Control Application

MSP430G2553_PinOsc_Remote_GUI Package (Processing Windows Executable) Operates with MSP430G2553 PinOsc Remote Custom Firmware Package (CCSv4.2 Project) on custom

MSP430G2553_PinOsc_Remote_HW Package (KiCad package, schematic, gerbers)

MSP430G2553 Remote Control Sensor Calibration Application

MSP430G2553_PinOsc_Remote_Sensor Element Calibration GUI Package (Processing Windows Executable) Operates with MSP430G2553 PinOsc Remote Custom Sensor Element Calibration Firmware Package (CCSv4.2 Project) on custom

MSP430G2553_PinOsc_Remote_HW Package (KiCad package, schematic, gerbers)