# Smart-Home-Security-System
**ESP32 Smart Door Lock**

A PIN-based smart lock built on the ESP32 — keypad entry, OLED feedback, servo-driven deadbolt, and brute-force lockout protection. No app, no cloud, no subscription. Just you, a keypad, and a locked door.

# Demo

[▶ Watch the demo video](https://www.youtube.com/shorts/98UHolFIUHg?feature=share)

<p align="center">
  <img src="assets/hss1.png" width="250">
  <img src="assets/hss7.png" width="250">
  <img src="assets/hss8.png" width="250">
</p>

# Features
**4x4 Matrix Keypad Entry** — enter a numeric PIN, # to confirm, * to clear

**OLED Status Display** — real-time feedback (Enter PIN, Access Granted, Access Denied, Locked out)

**Servo-Driven Lock** — smooth open/close motion, not a jarring snap

**Audio Feedback** — distinct tones for keypresses, success, and errors

**Brute-Force Lockout** — auto-locks out input after repeated failed attempts

**Safe GPIO Mapping** — carefully chosen pins that avoid ESP32 boot-strapping conflicts

# Hardware

| Component | Notes |
|---|---|
| ESP32 Dev Board | Any standard variant |
| 4x4 Matrix Keypad | Rows/cols on GPIO 19, 18, 5, 17 / 16, 4, 25, 33 |
| SSD1306 OLED (128x64, I2C) | SDA=21, SCL=22, addr `0x3C` |
| SG90 (or similar) Servo | Signal on GPIO 14 |
| Piezo Buzzer | GPIO 13 |

# Libraries

| Library | Purpose |
|---|---|
| Keypad | Reads input from the 4x4 matrix keypad |
| Adafruit_GFX | Core graphics library for the OLED display |
| Adafruit_SSD1306 | Driver for the SSD1306 OLED screen |
| ESP32Servo | Controls the servo motor on ESP32 |

Install via Arduino Library Manager or PlatformIO.

# Getting Started
Wire the hardware per the pin table above.

Install the required libraries.

Flash main.ino to your ESP32.

Open Serial Monitor at 115200 baud to watch logs.

Enter your PIN on the keypad, press # to unlock.

⚠️ Set your own PIN before deploying. The default in this repo is a placeholder — see Security Notes below.

# Security Notes

This is a hobby/learning project, not a certified security product. If you're using it on a real door:

Change the default PIN immediately — don't rely on the value committed to this repo.

Consider a longer PIN (4–6 digits) and a stronger lockout policy; short PINs with weak lockouts are brute-forceable faster than you'd think.

The lock logic lives entirely on the microcontroller with no network exposure in this version — that's a feature, not a limitation (nothing to hack remotely).

Treat this as a fun way to learn embedded systems, not a replacement for a proper deadbolt on your only entry point.

<p align="center">
  <img src="assets/hss5.png" width="250">
  <img src="assets/hss6.png" width="250">
</p>


# Contributors

This project was built together by:

- **Aiman Ali** — [@aemi6296-crypto](https://github.com/aemi6296-crypto) — Hardware assembly & circuit design
- **Imtisal Zainab Hashmi** — [@imtisal-zainab-hashmi](https://github.com/imtisal-zainab-hashmi) — Code development


# License

This project is licensed under the MIT License. You are free to use, modify, and distribute this code, including for commercial purposes, provided the original copyright notice is retained.

**Built as a learning project exploring ESP32, embedded UI feedback, and basic access control logic.**
