TTP223B is a cheap and easily available capacitive touch sensor. In this project, we are going to interface the popular TTP223B Touch sensor to Arduino.
Working of Touch sensor
The capacitive touch sensor holds a tiny charge on its surface. As you know, The Human body act as ground. when the sensor comes in contact with human skin it completes the circuit as a result change in voltage.
When the surface of the sensor is touched by human skin, a charge is transferred resulting in a drop in voltage. That change in voltage gives a high signal.
TTP223B Touch sensor module features
- Low power consumption
- Power supply for 2 ~ 5.5V DC
- Output Pin Sink Current (@ VCC = 3V, VOL = 0.6V) : 8 mA
- Output pin pull-up current (@ VCC = 3V, VOH = 2.4V) : 4 mA
TTP223B Touch sensor Pinout
TTP223B is a 1 key touchpad detector IC. It works on 2.0V ~ 5.0V. Sensitivity can adjust by the capacitance(0~50pF) outside. Refer datasheet for more details.
The sensor have 3 pins. Vcc for 5v, GND for Ground, and signal for output.
Requirements
For this project, you require the following materials.
Name | Quantity |
Arduino UNO | 1 |
TTP223B Touch sensor | 1 |
Jumper Wires | – |
USB cable | 1 |
TTP223B connection with Arduino
The Connection of the touch sensor with Arduino is very simple. Connect VCC of The sensor with Arduino 5v. GND of the sensor with GND of Arduino. SIG of Touch sensor connect to D1 of Arduino.
Code
Copy the following code and upload it to your Arduino board.
//Digital Capacitive Touch Sensor Arduino Interfacing
#define sensorPin 1 // capactitive touch sensor - Arduino Digital pin D1
int ledPin = 13; // Output display LED (on board LED) - Arduino Digital pin D13
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(sensorPin, INPUT);
}
void loop() {
int senseValue = digitalRead(sensorPin);
if (senseValue == HIGH){
digitalWrite(ledPin, HIGH);
Serial.println("TOUCHED");
}
else{
digitalWrite(ledPin,LOW);
Serial.println("not touched");
}
delay(500);
}
FAQ’s
Q:- Can I change the sensitivity of the sensor? A:- yes, you should be able to do it by selecting different capacitor values. Q:- Can i connect multiple touch sensor with one Arduino? A:- yes, you can connect multiple sensors with one arduino.