TTP223B is a compact capacitive sensor module that provides touch input instead of physical buttons. It is often preferred in Arduino projects due to its low power consumption, easy connection, and stable operation.
The TTP223B detects changes in capacitance when touched and converts this into a digital signal.
Pin | Function |
---|---|
VCC | 2.0–5.5V DC power (typically connected to Arduino 5V) |
GND | Ground |
SIG / IO | Digital output pin (goes HIGH when touched) |
When the sensor is touched, the LED lights up and the message "Touch detected!" appears in the Serial Monitor.
/*
Interfacing TTP223B Touch Sensor with Arduino
by www.PlaywithCircuit.com
*/
// Define pin numbers
const int touchPin = 2; // Touch sensor pin
const int ledPin = 4; // LED pin
void setup() {
Serial.begin(9600); // Start serial communication
pinMode(touchPin, INPUT); // Set touchPin as input
pinMode(ledPin, OUTPUT); // Set ledPin as output
}
void loop() {
int touchState = digitalRead(touchPin); // Read touch sensor state
if (touchState == HIGH) {
digitalWrite(ledPin, HIGH); // Turn on LED
Serial.println("Touch detected!");
while (digitalRead(touchPin) == HIGH); // Wait until released
} else {
digitalWrite(ledPin, LOW); // Turn off LED
}
}
Source: https://playwithcircuit.com/how-to-interface-ttp223b-touch-sensor-with-arduino/