Interfacing TTP223 Capacitive Touch Sensor With Arduino

by electronicsworkshop111 in Circuits > Arduino

3337 Views, 4 Favorites, 0 Comments

Interfacing TTP223 Capacitive Touch Sensor With Arduino

Screenshot from 2023-03-27 20-27-26.png

Overview

In this article, We will interface with TTP223 Capacitive Touch Sensor with Arduino. We will also discuss its working Principle, pin out, features, modes of operation and finally we will write a simple program to interface it with Arduino.

Introduction

capacitive touch sensor works by using the principle of capacitance, which is the ability of a capacitor to store electrical charge. When a human body, such as a finger, approaches the sensor, a capacitance is created between the sensor and the body. The body and the sensor act as the plates of a capacitor, and this results in the induction of a charge between them.

Interfacing TTP223 capacitive touch sensor with Arduino is a simple and easy way to add touch sensing capabilities to your Arduino project. The TTP223 is a touch sensor IC that works on the principle of capacitive sensing. It can detect finger touches on a touchpad, and output a digital signal indicating the touch event.

To interface the TTP223 with Arduino, you need to connect the touch sensor to the Arduino using the digital input pins. You also need to program the Arduino to read the touch sensor’s output and respond accordingly.Once the touch sensor is connected to the Arduino, you can read its output by checking the state of the digital input pin in your Arduino program. If the input pin is high, it means that the touch sensor has been touched, and you can perform the desired action in response to the touch event.

Overall, interfacing the TTP223 capacitive touch sensor with Arduino is a simple and effective way to add touch sensing capabilities to your Arduino project.


Supplies

1 Arduino Nano Boardmicrocontroller 1 https://amzn.to/3EBaQFT

2 Connecting wires jumper wire some https://amzn.to/3tX7PLl

3 BreadboardNormal 1 https://amzn.to/3Vlefzw

4 TTP223 TouchCapacitive 1 https://amzn.to/3KfbflJ



TTP223 Capacitive Touch Sensor

TP223 is a capacitive touch sensor module that can detect the touch of a finger or a conductive object. It is a compact and low-cost module that can be easily integrated into various electronic projects.The module has a single touch pad, which can be connected to a microcontroller or a digital input of a circuit. When a user touches the touch pad, the module detects the change in capacitance and outputs a digital signal to indicate the touch.


The TP223 module has a wide operating voltage range of 2.0V to 5.5V, making it compatible with a variety of electronic devices. It also has a built-in power-on reset circuit, which ensures reliable operation during power-up.The TP223 module is commonly used in various applications such as touch switches, touch lamps, touch sensors, and other human-machine interfaces. It is easy to use, requires minimal external components, and has low power consumption, making it an excellent choice for battery-powered devices.

Overall, the TP223 capacitive touch sensor module is a versatile and reliable touch sensor module that can be used in a wide range of electronic projects.

TTP223 Capacitive Touch Sensor

Pin Configuration of TTP223 Touch Sensor

The touch sensor as you can see in the picture above consists of only three pins. These are the signal, VCC, and GND pins.

The OUT pin is connected with the digital pin of Arduino board. This will be set up as an input. When pressure will be applied at the sensor’s surface, the signal will be 1 or HIGH. Other wise it will be 0 or LOW.

The VCC pin is connected with the power pin of the Arduino. The touch sensor module supports 2.0-5.5V DC power supply. We will connect this pin with Arduino 5V pin.

The GND pin is connected with the GND of the Arduino board.

Pin diagram of TTP223 Capacitive Touch Sensor

Features of TTP223 Capacitive Touch Sensor

  • The response time max 220mS at low power mode @VDD=3V
  • Sensitivity can adjust by the capacitance(0~50pF) outside
  • Stable touching detection of the human body for replacing traditional direct switch key
  • Provides Low Power mode
  • Provides direct mode、toggle mode by pad option(TOG pin) Q pin is CMOS output
  • All output modes can be selected active high or active low by pad option(AHLB pin)
  • Operating voltage 2.0V~5.5V
  • Operating current @VDD=3V, no load
  • At low power mode typical 1.5uA, maximum 3.0uA
  • After power-on have about 0.5sec stable-time, during the time do not touch the keypad, And the function is disabled
  • Auto calibration for life.
  • At low power mode, the re-calibration period is about 4.0sec normally,
  • When key detected touch and released touch, the auto re-calibration will be redoing after about 16sec from releasing key
  • The sensitivity of TTP223N-BA6 is better than TTP223-BA6’s. But the stability of TTP223N-BA6 is worse than TTP223-BA6’s.


PCB Manufacturer

PCBWAY is a highly skilled company specializing in PCB manufacturing. They offer their services at incredibly low prices, such as providing 10 PCBs for only $5. Additionally, new members receive a $5 bonus. The website allows customers to upload their Gerber Files and place orders.

ORDER LINK

PCBWAY is known for producing PCBs of exceptional quality and maintaining high standards, which is why many people trust them for their PCB and PCBA needs.

Below are some of my PCB’S manufactured by PCBWAY and I am fully satisfied by their Quality of service they provide.


Modes / Configuration of TTP223 Touch Sensor

There are four different configurations for this touch switch, which is explained below in details.

Modes of TTP223 Capacitive Touch Sensor

Config 1:

  • To obtain configuration one both A and B terminals should be in open position.
  • Default output state will be LOW
  • Changes the state (to HIGH) when a touch is detected and will be back to the default state when touch is released

Config 2:

  • To obtain configuration one both A should be open and B should be closed position.
  • Default output state will be LOW
  • Changes the state when a touch is detected and remains on that state until another touch is detected.

Config 3:

  • To obtain configuration one both A should be closed and B should be in open position.
  • Default output state will be HIGH
  • Changes the state (to LOW) when a touch is detected and will be back to the default state when touch is released

Config 4:

  • To obtain configuration one both A and B terminals should be closed position.
  • Default output state will be HIGH
  • Changes the state when a touch is detected and remains on that state until another touch is detected.

Touch sensitivity Adjustment

The TP223 capacitive touch sensor module’s sensitivity can be adjusted by adding a capacitor. The value of the capacitor can range from 0 to 50 pf, with 0 pf providing maximum sensitivity, and 50 pf providing the lowest sensitivity.

For example, if you want to use the touch switch through a glass or acrylic material, you may need to adjust the sensitivity based on the thickness of the material. Adding a capacitor with an appropriate value can increase or decrease the sensitivity of the touch sensor, allowing it to detect touches through the material.

In general, adjusting the sensitivity of the TP223 module can help optimize its performance for different applications and environments. By adding or removing capacitors, you can fine-tune the module’s sensitivity to meet specific requirements and improve its reliability and accuracy.


Interfacing TTP223 Capacitive Touch Sensor With Arduino

Here’s an explanation of how to connect the TTP223 capacitive touch sensor with an Arduino board VCC: Connect the VCC pin of the TTP223 module to the 5V pin of the Arduino board. This pin provides power to the module GND: Connect the GND pin of the TTP223 module to the GND pin of the Arduino board. This pin completes the circuit and provides a reference voltage SIG(DATA): Connect the SIG pin of the TTP223 module to any of the digital input pins of the Arduino board. This pin will provide the signal to the Arduino indicating whether a touch has been detected or not.

When the TTP223 module is powered on, the SIG pin will be in a stable low state until a touch is detected. When a touch is detected, the SIG pin will go high, indicating to the Arduino that a touch has occurred.

Custom Touch panel using TTP223 Capacitive Touch Sensor

Custom Touch panel using TTP223 Capacitive Touch Sensor

Make Own TTP223 Capacitive Touch Sensor Module

I have included the Design File (Geber ) in the article itself. You can just download it and order from your PCB manufacturer

4 channel custom TTP223 Capacitive Touch Sensor Module front view

4 channel custom TTP223 Capacitive Touch Sensor Module back view

Gerber

gerberDownload

I have already uploaded all these required manufacturing files in PCBWAY website. You can easily go to the below link and place you order, and get your own Own TTP223 Capacitive Touch Sensor Module manufactured from one of the best pcb manufacturer PCBWAY.

ORDER IT DIRECTLY FROM PCBWAY

Source Code / Programming

This sketch will display on the serial monitor, the state of the signal pin. Whenever the sensor will be pressed a relevant message will also be displayed.


const int signal_pin = 2;
int state;     
         
void setup() {
  Serial.begin(115200);
  pinMode(signal_pin, INPUT);
}
 
void loop() {
  state = digitalRead(signal_pin);
  Serial.println(state);
  if(state == HIGH)
  Serial.println(" TOUCH Detected!");
  delay(500);
}