TTP223 Capacitive Touch Sensor Module — Single-Button ON/OFF

10,00 DH

Availability:

482 in stock

SKU: 0154-A Categories: ,

Description

TTP223 Capacitive Touch Sensor Module — Single-Button ON/OFF

The TTP223 detects touch using capacitive sensing. The source describes this board as an ON/OFF model that alternates its output state with each touch.

Specifications stated in the source

  • Supply voltage: 2–5.5 V DC
  • Response time: 60 ms in touch mode; approximately 220 ms in low-power mode
  • Digital output: HIGH when touch is detected; source describes alternating ON/OFF states
  • Current: typically a few µA, according to the source
  • Module size: 15 × 11 mm
  • VOH: 0.8 × VCC; VOL: 0.3 × VCC (source-listed values; verify against the datasheet)
  • Price: MAD 10

How it works and common uses

A finger or other conductive object changes the capacitance at the sensing electrode. The TTP223 detects this change and provides a digital output. Uses listed include touch switches, lighting controls, user interfaces and interactive projects.

Pins

  • VCC: supply, 2–5.5 V
  • SIG: digital output
  • GND: ground

Switching modes

The source says solder pads A and B configure the behavior:

  • A open, B open: normally LOW; goes HIGH when touched.
  • A open, B closed: normally LOW; goes HIGH on touch and stays HIGH until the next touch.
  • A closed, B open: normally HIGH; goes LOW on touch and stays LOW until the next touch.
  • A closed, B closed: normally HIGH; goes LOW while touch is maintained.

Confirm the pad configuration for your board. The examples below detect a LOW-to-HIGH edge, so their behavior depends on the selected module mode.

Basic Arduino Uno example

This source example toggles an LED when a touch is detected. Connect VCC to 5 V, GND to GND, SIG to D2, and an LED to D13 through a 220 Ω resistor to GND.

const int touchPin = 2;
int touchState = 0;
int lastState = LOW;
int ledPin = 13;
int ledState = LOW;


void setup() {
  Serial.begin(9600);
  pinMode(touchPin, INPUT);
  pinMode(ledPin, OUTPUT);
}


void loop() {
  touchState = digitalRead(touchPin);
  if (lastState == LOW && touchState == HIGH) {
    if (ledState == LOW) {
      ledState = HIGH;
    } else {
      ledState = LOW;
    }
    digitalWrite(ledPin, ledState);
  }
  lastState = touchState;
  delay(50);
}

Basic example: purpose and parts

The example reads the touch output and toggles the LED state. Parts listed: Arduino Uno, TTP223 module, LED, 220 Ω resistor and jumper wires.

Advanced Arduino Uno example with an LCD

The second source example displays LED ON/OFF status on a 1602 I²C LCD while toggling the LED. The source pin mapping is: touch SIG to D2, LED to D13 through a 220 Ω resistor, and LCD VCC/GND to 5 V/GND with SCL to A5 and SDA to A4.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27, 16, 2);
const int touchPin = 2;
int touchState = 0;
int lastState = LOW;
int ledPin = 13;
int ledState = LOW;


void setup() {
  lcd.begin();
  lcd.backlight();
  Serial.begin(9600);
  pinMode(touchPin, INPUT);
  pinMode(ledPin, OUTPUT);
}


void loop() {
  touchState = digitalRead(touchPin);
  if (lastState == LOW && touchState == HIGH) {
    if (ledState == LOW) {
      ledState = HIGH;
      lcd.setCursor(0, 1);
      lcd.print("LED ON ");
    } else {
      ledState = LOW;
      lcd.setCursor(0, 1);
      lcd.print("LED OFF");
    }
    digitalWrite(ledPin, ledState);
  }
  lastState = touchState;
  delay(50);
}

Advanced example: parts and code notes

Parts listed: Arduino Uno, TTP223 module, 1602 I²C LCD, LED, 220 Ω resistor and jumper wires. The source code uses Wire.h and LiquidCrystal_I2C.h, reads the touch signal and updates the LCD when the LED state changes.

Library setup

Install a compatible LiquidCrystal I²C library through the Arduino IDE Library Manager. The source menu labels may vary by IDE version.

Verify the supply and output levels for your board and Arduino before wiring.

Thank you for your loyalty!

EN