Are you tired of using traditional push buttons and switches in your projects and you want to add a touch of elegance by using a capacitive touch sensor with Arduino?
You are in the right place! In this tutorial you will learn how to interface TTP223B capacitive touch sensor with Arduino and everything you need to know about it, what it is, how it works, types, pinout, specification, and code at the end of this tutorial.
If so, let’s get started!
Table of Contents
Arduino Touch Sensor
Arduino touch sensor is an electronic device that allows you to detect any touch or proximity from a human user without needing any physical buttons or switches, which makes your project more fun and user-friendly.

Types Of Touch Sensors
There are 5 different types of touch sensor technology:
- Resistive touch screen
- Capacitive touch sensor
- Infrared touch sensor
- Surface acoustic wave (SAW) touch sensor
- Optical touch sensor
Each of these sensor technologies has its own advantages and disadvantages, so choosing the right sensor for your project is essential to make your project successful, which depends on your project requirements.
There are two types of touch sensors on the market you can buy: resistive touch sensor, and capacitive touch sensor. But in this tutorial, we will talk about one of these sensors which is (Capacitive Touch Sensor) and the most common one is (TTP223B module) for many reasons:
- Low priced
- Easy to use
- Available in the markets widely
What Is Capacitive Touch Sensor?
A capacitive touch sensor is an electronic sensor that allows you to detect touch or proximity by measuring changes in the (capacitance) which is the ability of any object to store an electrical charge. So when any conductive object (like a human finger) comes into close proximity to the sensor, the capacitance of the sensor will be changed.

There are a variety of electronic devices that use capacitive touch sensors for many applications, such as:
- Smartphones and tablets for touchscreens and touch buttons
- Laptops and desktops for touchpads and touchscreens
- Home appliances for touch controls
- Industrial and medical equipment for touchscreens and touch buttons
- Automotive displays and controls for touchscreens and touch buttons
There are several advantages of capacitive touch sensors over the types of touch sensors, such as:
- They are able to withstand wear and tear better, making them more durable.
- They are more responsive and accurate, as they can detect even light touches.
- They can support multi-touch and gestures.
- They are less influenced by humidity and temperature.
TTP223B Capacitive Touch Sensor Pinout
The picture down below is TTP223B capacitive touch sensor pinout, let’s take a look at it.

VCC: This is a power supply pin, you can connect it with the 5V Arduino pin.
GND: This is a common GND pin, connect it with the GND Arduino pin.
Signal: This is an output pin, when it’s touched it will be (High). Otherwise (Not touched) it will be (Low). Connect it with the Arduino digital pin.
TTP223B Capacitive Touch Sensor Specification
Take a look at the table down below, to learn the technical specifications for the TTP223B capacitive touch sensor.
Power supply voltage (VCC) | 2.0–5.5 V |
Output high (VOH) | 0.8 VCC |
Output low (VOL) | 0.3 VCC |
Output Pin Sink Current | (@ VCC = 3V, VOL = 0.6V) | 8 mA |
Output pin pull-up current | (@ VCC = 3V, VOH = 2.4V ) | 4 mA |
Response time (low power mode) | 220 mS |
Response time (touch mode) | 60 mS |
Size | 24x24x7.2 mm |
Weight | 2g |
How Does Capacitive Touch Sensor Work?
The TTP223B capacitive touch sensor works as a switch, similar to a button, which utilizes capacitance to detect touch. As pressure is applied to the sensor’s surface, the change in capacitance allows for the flow of current through the circuit.
The sensor consists of a conductive electrode film situated atop a glass panel that has a conductive printed circuit pattern.
A (High) output signal is generated when the touch sensor’s surface is pressed (touched), while a (Low) signal is produced when it is not. Additionally, the sensor enters low power mode if left untouched for a few seconds.
TTP223 Capacitive Touch Sensor Datasheet
Download TTP223 capacitive touch sensor datasheet file down below to learn more technical details.
Touch Sensor With Arduino
Touch Sensor is easy to use with microcontrollers, so let’s connect TTP223 capacitive touch sensor with Arduino. However, it’s important to know all the required parts before we dive in.
Parts Requirement
- Arduino Uno
- TTP223 capacitive touch sensor
- breadboard
- Hook-up wires
Interfacing Capacitive Touch Sensor With Arduino
To interface TTP223B capacitive touch sensor with Arduino you need to connect the VCC and the GND for the sensor with the 5V and GND for the Arduino, then connect the (signal) output pin for the sensor with the digital pin (6) for the Arduino.

Capacitive Touch Sensor Fritzing
This is a TTP223B capacitive touch sensor Fritzing file connection, you can download it.
Touch Sensor Arduino Code
Finally, This is TTP223B capacitive touch sensor Arduino code without Library, so you can copy it and use it in your project.
Capacitive Touch Sensor Arduino Code
With TTP223B capacitive touch sensor Arduino code you can detect the state of the sensor, so when you touch the sensor the word (Touched) will be displayed on your serial monitor, otherwise (Not Touched) will be displayed on it.
const int SignalPin = 6;
int state;
void setup() {
Serial.begin(9600);
pinMode(SignalPin, INPUT);
}
void loop() {
state = digitalRead(SignalPin);
if(state == HIGH)
Serial.println("Touched");
else if(state == LOW)
Serial.println("Not Touched");
delay(1000);
}
This is the result that will appear on your serial monitor.

Touch Sensor With Arduino Frequently Asked Questions
What Is The Main Function Of A Touch Sensor?
The main function of a touch sensor is to detect physical touch or pressure and convert it into an electrical signal that can be interpreted by a device or system, to enhance user interfaces by providing a more intuitive and interactive experience for the users.
What Is The Voltage Of TTP223 Touch Sensor?
The operating voltage of the TTP223 touch sensor is typically between 2.0V and 5.5V DC, this voltage range makes it compatible with a wide range of microcontrollers like Arduino for example.
How To Connect Touch Sensor To Arduino?
To connect TTP223B capacitive touch sensor with Arduino you need to connect the VCC and the GND for the sensor with the 5V and GND for the Arduino, then connect the (signal) output pin for the sensor with the digital pin (6) for the Arduino.
Are you still reading? Awesome! You are in the right direction to be the master of Arduino!
We would like to express our appreciation for taking the time to read this article about interfacing TTP223B capacitive touch sensor with Arduino, we hope that this tutorial provided you with all the information that you needed to know about this topic.
Welcome to ROBOSENS, our mission is to simplify the information by providing you with brief Arduino tutorials and straight to the point.
Do you want to dive in deeper and learn more about sensors? Check out these articles below.
HC-SR04 Ultrasonic Sensor Interfacing With Arduino
Interfacing Force Sensing Resistor (FSR) with Arduino
DHT11 Humidity and Temperature Sensor with Arduino
Digital Temperature Sensor with Arduino
LDR photoresistor with Arduino
Sources: