Contents

Interfacing TTP223 Touch Sensor with Arduino

TTP223 Capacitive Touch Sensor Features

The TTP223 sensor can be used in a wide range of applications such as smartphones and tablets. It can also detect from behind glass and thin surfaces. When a finger touches the sensor, the module output gets HIGH, and immediately switches to LOW if not touched.

The operating voltage is 2 to 5.5 V. Its maximum response time is 220 milliseconds.

You can download the datsheet of this module here.

TTP223 Capacitive Touch Sensor Pinout

This Module has 3 pins:

  • VCC: Module power supply – 2 to 5.5 V
  • GND: Ground
  • SIG: Digital output

You can see the pinout of this module on the first side in the image below.

Required Materials

Hardware Components

Arduino UNO R3 × 1
TTP223 Capacitive Touch Sensor × 1
Male to Female jumper wire × 1

Software Apps

Arduino IDE
Note

You need to provide only one of these sensors.

Interfacing TTP223 Capacitive Touch Sensor with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to TTP223 sensor. Connect wires accordingly.

Step 2: Code

Upload the following code to Arduino.

/*
  TTP223B-Capacitive-Touch-Switch-Module
  made on 21 oct 2020
  by Amir Mohammad Shojaee @ Electropeak
  
Home
*/ const int SENSOR_PIN = 2; // Variables will change: int lastState =LOW; int currentState; void setup() { Serial.begin(9600); // initialize the Arduino's pin as aninput pinMode(SENSOR_PIN, INPUT); } void loop() { // read the state of the the input pin: currentState = digitalRead(SENSOR_PIN); if(lastState == HIGH && currentState == LOW) Serial.println("Sensor is touched"); // save the the last state lastState = currentState; }

When the digital output changes from LOW to HIGH, “Sensor is Touched ” appears in Serial Monitor.

The code output is as follows. As you can see, the sensor has been touched 4 times.

Liked What You See?​
Get Updates And Learn From The Best​

Leave a Reply

Your email address will not be published. Required fields are marked *