1. Introduction
In this project, we will build a simple yet powerful burglar alarm using an Arduino and a TTP223 Capacitive Touch Sensor. Unlike mechanical buttons, this sensor detects the change in capacitance when a human finger (or hand) comes near the sensing area. This makes it ideal for "invisible" security triggers on door handles, safes, or windows.
2. Components
Arduino Uno or Nano
TTP223 Touch Sensor Module
Active Buzzer (5V)
LED (Red)
220Ω Resistor
9V Battery or Power Adapter
Jumper Wires and Breadboard
3. Circuit and Connections
| Arduino Uno Pinout Diagram |
| TTP223 Touch Sensor Pinout Diagram |
| Pinout Diagram of Buzzer |
TTP223 Sensor:
VCC → Arduino 5V
GND → Arduino GND
SIG (Signal) → Arduino Digital Pin 2
Buzzer:
Positive (+) → Arduino Digital Pin 8
Negative (-) → Arduino GND
LED:
Anode (+) → 220Ω Resistor → Arduino Digital Pin 13
Cathode (-) → Arduino GND
4. Detailed Step-by-Step Circuit Working
Sensing: The TTP223 module stays in a "Low" state by default. When a person touches the metallic pad (or a surface attached to it), the internal timing circuit detects a change in capacitance.
Signal Output: The sensor immediately sends a "High" (5V) signal through the SIG pin to the Arduino.
Processing: The Arduino is programmed to "listen" to Pin 2. Once it sees a High signal, it enters the "Alarm Mode."
Alerting: The Arduino sends power to Pin 8 (Buzzer) and Pin 13 (LED). The buzzer creates a loud sound, and the LED flashes to provide a visual warning of the intrusion.
5. Libraries to be included
This project uses standard Digital I/O, so no external libraries are required. This makes the code very lightweight and fast!
6. Code
const int touchPin = 2; // Pin connected to TTP223 SIG
const int buzzerPin = 8; // Pin connected to Buzzer
const int ledPin = 13; // Pin connected to LED
void setup() {
pinMode(touchPin, INPUT); // Set touch sensor as input
pinMode(buzzerPin, OUTPUT); // Set buzzer as output
pinMode(ledPin, OUTPUT); // Set LED as output
Serial.begin(9600);
}
void loop() {
int touchState = digitalRead(touchPin); // Read sensor value
if (touchState == HIGH) {
Serial.println("Intruder Detected!");
digitalWrite(ledPin, HIGH);
digitalWrite(buzzerPin, HIGH);
delay(1000); // Alarm stays on for 1 second
} else {
digitalWrite(ledPin, LOW);
digitalWrite(buzzerPin, LOW);
}
}
7. Detailed Step-by-Step Code Working
Pin Definition: We define
touchPinas 2 because it supports interrupts (useful for more advanced versions).digitalRead(touchPin): This command checks the state of the sensor in every loop cycle (thousands of times per second).Condition Checking: The
if (touchState == HIGH)checks if the sensor has been triggered.Execution: When triggered, the
digitalWritecommands turn on the buzzer and LED.Reset: Once the touch is removed, the
elseblock turns the alarm off automatically.
8. Tips
Sensitivity: You can increase the sensitivity of the TTP223 by soldering a small capacitor (0–50pF) to the dedicated pads on the module.
Hidden Placement: You can stick the sensor behind a thin piece of plastic, glass, or wood (up to 3mm thick), and it will still detect a touch!
Latch Mode: By soldering the "A" or "B" jumpers on the TTP223, you can make the alarm stay ON even after the intruder lets go.
9. Uses
Home Security: Attach to door knobs or window frames.
Locker Guard: Secure your personal belongings or jewelry boxes.
Secret Switch: Use it as a hidden "on" switch for other electronics projects.
10. Conclusion
The Touch Sensor Burglar Alarm is a cost-effective and easy-to-build solution for home security. It introduces beginners to capacitive sensing and demonstrates how simple logic can protect valuable assets.
https://simplebasicelectronics.blogspot.com/2 026/03/arduino-pir-motion-sensor-alarm.html
https://simplebasicelectronics.blogspot.com/2026/03/arduino-gas-leak-detector-using-mq-2.html
https://simplebasicelectronics.blogspot.com/2026/03/arduino-flame-sensor-fire-alarm.html
https://simplebasicelectronics.blogspot.com/2026/04/arduino-driver-drowsiness-detection.html
https://simplebasicelectronics.blogspot.com/2026/03/diy-arduino-rain-alarm-yl83.html