This capacitive touch sensor module uses the TTP229 integrated circuit, making it easy to add capacitive touch input to your project. It features 16 sensitive touch pads that make an ideal replacement for the old fashioned keypads.
Specifications
- On-board 16-key TTP229 capacitive touch sensor IC
- On-board power indicator LED
- Working Voltage Range: 2.4 V to 5.5 V
- Configurable output mode
- PCB Size: 49.3 x 64.5 mm
Pinout
1.....VCC (2.4 - 5.5V)
2.....GND
3.....SCL (serial clock in)
4.....SDO (serial data out)
5.....OUT 1 (key 1 state)
6.....OUT 2 (key 2 state)
7.....OUT 3 (key 3 state)
8.....OUT 4 (key 4 state)
9.....OUT 5 (key 5 state)
10...OUT 6 (key 6 state)
11...OUT 7 (key 7 state)
12...OUT 8 (key 8 state)
Documents
TTP229-Capacitive-Touch-Sensor-Module-16-channels-Datasheet
TTP229B-Schematic-Diagram
Code:
/* FILE: TTP229_16_Key_Capacitive_Touch_Example
DATE: 25/02/15
VERSION: 0.1
REVISIONS:
25/02/15 Created version 0.1
This example sketch will read the current state of the
of the keypad and if a key is pressed output its key number to the serial port.
The sketch assumes that the keypad is configured to 16 key active low mode
by shorting pads P1-3 and P1-P4 together (see schematic or sport forum for more
information). Connect the keypad to your Arduino as follows:
Keypad......Arduino
VCC.........+5V
GND.........GND
SCL.........Digital pin 8
SDO.........Digital pin 9
/* Define the digital pins used for the clock and data */
#define SCL_PIN 8
#define SDO_PIN 9
/* Used to store the key state */
byte Key;
void setup()
{
/* Initialise the serial interface */
Serial.begin(9600);
/* Configure the clock and data pins */
pinMode(SCL_PIN, OUTPUT);
pinMode(SDO_PIN, INPUT);
}
/* Main program */
void loop()
{
/* Read the current state of the keypad */
Key = Read_Keypad();
/* If a key has been pressed output it to the serial port */
if (Key)
Serial.println(Key);
/* Wait a little before reading again
so not to flood the serial port*/
delay(100);
}
/* Read the state of the keypad */
byte Read_Keypad(void)
{
byte Count;
byte Key_State = 0;
/* Pulse the clock pin 16 times (one for each key of the keypad)
and read the state of the data pin on each pulse */
for(Count = 1; Count <= 16; Count++)
{
digitalWrite(SCL_PIN, LOW);
/* If the data pin is low (active low mode) then store the
current key number */
if (!digitalRead(SDO_PIN))
Key_State = Count;
digitalWrite(SCL_PIN, HIGH);
}
return Key_State;
}