Menu
Close
SIGN IN REGISTER
Forgot password?
Close
Cart
07.07.2025

TTP223B Touch Sensor Usage

How to Use the TTP223B Capacitive Touch Sensor with Arduino?

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.

Why Choose TTP223B?

  • Operates at 2.0V–5.5V, making it ideal for battery-powered systems.
  • By using solder pads on the module, you can switch between momentary or toggle modes.
  • Provides stable and self-calibrated capacitive sensing without the need for external components.

TTP223B Touch Sensor

Working Principle

The TTP223B detects changes in capacitance when touched and converts this into a digital signal.

  • In default mode: Outputs HIGH (5V) when touched, and LOW (0V) when not touched.
  • In toggle mode: Each touch inverts the output state (e.g., ON → OFF).

Pinout

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)

Required Components

Arduino Wiring Diagram

  • VCC → Arduino 5V
  • GND → Arduino GND
  • SIG → Arduino Digital Pin 2
  • LED (optional) → Arduino Digital Pin 4 (via 100Ω resistor)

When the sensor is touched, the LED lights up and the message "Touch detected!" appears in the Serial Monitor.

Wiring Diagram

Example Code:


/*
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
}
}

Applications

  • Touch-controlled lamps or buttons
  • Controlling buzzers, relays, or LEDs
  • User interface in IoT projects
  • Alternative to mechanical buttons for durability and long lifespan

Advantages

  • Low-cost and widely available
  • Works without external resistors or capacitors
  • Sensitivity can be adjusted by adding an external capacitor (0–50pF)
  • Integrates easily with other modules like relays, motor drivers, buzzers, etc.

Source: https://playwithcircuit.com/how-to-interface-ttp223b-touch-sensor-with-arduino/