Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » Touch Based Door Lock System Using Arduino & Touch Sensor TTP223
Arduino Projects

Touch Based Door Lock System Using Arduino & Touch Sensor TTP223

Mamtaz AlamBy Mamtaz AlamUpdated:August 22, 20222 Comments3 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
Touch Based Door Lock System Using Arduino
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Touch Based Door Lock System Using Arduino:

In this project of we will learn How to design Touch-Based Door Lock System Using Arduino & Touch Sensor TTP223. Door Lock System using Arduino & TTP223 Capacitive Touch Sensor Switch is a simple project for switching circuit, i.e switching the servo motor on/off with the help of simple touch. The door can be locked or unlocked just by simply touching. We are using Touch Sensor TTP223 as a switch and LCD to display the status of door lock and LED to indicate on/off status as well.



The application area of this project is home and office where a simple touch can open and close the door. Interfacing touch sensor TTP223 with Arduino acts as a switch for unlocking the door.

Before starting you can check our previous project Touch Detector using Arduino TTP223 Capacitive Touch Sensor Switch


TTP223 CAPACITIVE TOUCH SENSOR

Introduction:

A capacitive touch sensor module based on the dedicated TTP223 touch sensor IC. The module provides a single integrated touch sensing area of 11 x 10.5mm with a sensor range of ~5mm. An on-board LED will give a visual indication of when the sensor is triggered. When triggered the module’s output will switch from its idle low state to high (default operation). Solder jumpers allow for reconfiguring its mode of operation to be either active low or toggle output.

Touch Based Door Lock System Using Arduino

Internal Structure:

TTP223 is 1 Key Touch pad detector IC, and it is suitable to detect capacitive element variations. It consumes very low power and the operating voltage is only between 2.0V~5.5V. The response time max about 60mS at fast mode, 220mS at low power mode @VDD=3V. Sensitivity can adjust by the capacitance(0~50pF) outside.

Working Mechanism of TTP223 Capacitive Touch Sensor

Capacitive screens do not use the pressure of your finger to create a change in the flow of electricity. Instead, they work with anything that holds an electrical charge – including human skin.

When a finger hits the screen a tiny electrical charge is transferred to the finger to complete the circuit, creating a voltage drop on that point of the screen. The software processes the location of this voltage drop and orders the ensuing action.



Components Required

1. Arduino Uno Board
2. TTP223 Capacitive Touch Sensor
3. 16X2 LCD Display
4. SG90 Servo Motor
5. LED
6. Resistor 330 ohm
7. Breadboard
8. Connecting Wires


Circuit Diagram & Connections

Touch Based Door Lock System Using Arduino

Connect the signal pin of TTP223 Touch Sensor to Arduino Digital Pin 7.

Connect servo motor signal pin to Arduino Digital Pin 3.

Connect the LED to Arduino Digital Pin 5 via a 330-ohm resistor.

Connect the LCD to analog pin A0, A1, A2, A3, A4, A5 of Arduino as shown in the figure.


Practical Working of the Project:

After the Code Uploaded the, the LCD will display

C++
1
2
Touch Based
Door Lock System

The Servo Motor will reset to the original position.

If the Touch Sensor is Touched, the LCD will display 2 Lines

C++
1
2
Status: Unlocked
Touch to Lock

Similarly, Servo Motor will rotate by 180 degrees, and LED will glow.



If the Touch Sensor is Touched again, the LCD will display 2 Lines

C++
1
2
Status: Locked
Touch to Unlock

Similarly, Servo Motor will rotate reversely by 180 degrees a and LED will get off.

You can see these in the photos below.

  • 1
  • 2
  • 3

  • 1
  • 2
  • 3


Source Code/Programs:

Here is a code for Touch-Based Door Lock System Using Arduino & Touch Sensor TTP223. Copy the code, the compile, and upload it to Arduino UNO Board.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<LiquidCrystal.h>
LiquidCrystal lcd(A0,A1,A2,A3,A4,A5);
const int servoPin = 3; // Servo pin
const int touchPin = 7; // Pushtouch pin
int ledPin = 5;
int touchState = 0;
int directionState = 0;
Servo myservo;
int pos = 0;
void setup() {
lcd.begin(16,2);
lcd.print(" Touch Based");
lcd.setCursor(0, 1);
lcd.print("Door Lock System");
myservo.attach(3);
pinMode(touchPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop(){
touchState = digitalRead(touchPin);
if (directionState == 0){
if (touchState == HIGH) {
directionState = 1;
for(pos = 0; pos < 180; pos += 1)
digitalWrite(ledPin,1);
lcd.clear();
lcd.print("Status: Unlocked");
lcd.setCursor(0, 1);
lcd.print("Touch to Lock");
{
myservo.write(pos);
delay(15); // waits 15ms to reach the position
}
}
} else if (directionState == 1) {
if (touchState == HIGH) {
directionState = 0;
for (pos = 180; pos>=1; pos -=1)
digitalWrite(ledPin,0);
lcd.clear();
lcd.print("Status: Locked");
lcd.setCursor(0, 1);
lcd.print("Touch to Unlock");
{
myservo.write(pos);
delay(15);
}
}
}
}


Video Tutorial & Explanation:

Touch Based Door Lock System using Arduino & TTP223 Sensor
Watch this video on YouTube.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleGas Level Monitor On Internet Using ESP8266 & Gas Sensor
Next Article Simple Phone: Call & SMS using GSM Module & Arduino

Related Posts

DC Energy Meter using Arduino

Build a DC Energy Meter using Arduino – 32V/5A

Updated:August 26, 20252K
Interfacing ADXL375 Accelerometer with Arduino

Interfacing ADXL375 Accelerometer with Arduino (±200g)

Updated:June 28, 2025
PZEM-004T Arduino Energy Meter

DIY AC Energy Meter using PZEM-004T & Arduino

Updated:March 6, 20258K
Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Updated:February 2, 20259K
Password Based Door Lock Security System Using Arduino & Keypad

Password Based Door Lock Security System Using Arduino & Keypad

Updated:February 2, 20252436K
Earthquake Detector Alarm with with Accelerometer & Arduino

Earthquake Detector Alarm with Accelerometer & Arduino

Updated:February 2, 2025661K
View 2 Comments

2 Comments

  1. anthony on August 20, 2020 10:06 PM

    why is nothing working for me no leds are turning on nothing will work please if anyone could help me that would be 100% helpful and i would be very thankful… Thankyou!

    Reply
  2. A Praveen on October 22, 2023 2:55 AM

    Anthony Include Servo.h library so it will work comment when it works

    Reply

CommentsCancel reply

Latest Posts
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

May 31, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32

DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32

February 1, 2026
Top Posts & Pages
  • IoT Based PM & Air Quality Monitoring System using ESP32
    IoT Based PM & Air Quality Monitoring System using ESP32
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
    ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
  • How to use INA226 DC Current Sensor with Arduino
    How to use INA226 DC Current Sensor with Arduino
  • IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
    IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
  • How to use INA219 DC Current Sensor Module with Arduino
    How to use INA219 DC Current Sensor Module with Arduino
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (204)
    • ESP32 MicroPython (7)
    • ESP32 Projects (81)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.