ESP32 Projects
Start a build
Markdown

ESP32 CAM Smart Door Lock for ESP32-CAM

An ESP32 camera project for AI Thinker ESP32-CAM involving OLED display, Camera module.

AI Thinker ESP32-CAMArduinoUnrated
Parts and source

Before you start

Check the exact OLED display, Camera module configuration against the upstream wiring or parts list.

Upstream README

๐Ÿ” ESP32-CAM Smart Door Lock System

An AI-powered smart door lock system using ESP32-CAM, Edge Impulse, and Arduino IDE for offline face recognition and secure access control.

ESP32 Arduino Edge Impulse License


๐Ÿ“– Overview

This project is a Face Recognition Based Smart Door Lock System developed using the ESP32-CAM module and Edge Impulse TinyML.

Unlike cloud-based face recognition systems, this project performs completely offline face recognition without requiring an internet connection.

To improve power efficiency, the ESP32-CAM remains in sleep mode until motion is detected by the PIR sensor. When a person is detected, the camera wakes up, captures the face, performs face recognition using the trained Edge Impulse model, and unlocks the door only if the face belongs to an authorized user.


โœจ Features

  • ๐Ÿ” Offline AI-based Face Recognition
  • ๐Ÿ“ท ESP32-CAM Camera Module
  • ๐Ÿ‘ค PIR Motion Detection
  • โšก Relay Controlled Door Lock
  • ๐Ÿ”“ Automatic Door Unlock
  • ๐Ÿ”’ Automatic Door Relock
  • ๐Ÿ’ก Flash LED during face detection
  • ๐ŸŸข Status LED for successful authentication
  • ๐Ÿ˜ด Sleep Mode for low power consumption
  • ๐ŸŒ No Internet Required

โš™๏ธ Working Principle

  1. ESP32-CAM remains in sleep mode.
  2. PIR sensor detects human movement.
  3. ESP32-CAM wakes up.
  4. Flash LED turns ON.
  5. Camera captures the user's face.
  6. Edge Impulse model performs face recognition.
  7. If the face matches a registered user:
    • Relay turns ON
    • 12V Solenoid Lock unlocks
    • Green LED turns ON
  8. After a predefined delay:
    • Relay turns OFF
    • Door locks automatically
  9. ESP32-CAM returns to sleep mode.

If an unknown face is detected, the door remains locked.


๐Ÿ›  Hardware Used

Component Quantity
ESP32-CAM (AI Thinker) 1
PIR Motion Sensor 1
5V Relay Module 1
12V Solenoid Door Lock 1
LED 1
Breadboard 1
Jumper Wires Several
USB to TTL Programmer 1
12V Power Supply 1

๐Ÿ’ป Software Used

  • Arduino IDE
  • Edge Impulse
  • ESP32 Board Package
  • C++

๐Ÿง  Machine Learning Model

The face recognition model was trained using Edge Impulse.

Multiple images of authorized users were captured and used for training. The trained model was exported as an Arduino library and integrated into the ESP32-CAM project along with PIR sensor, relay, LED, and sleep mode functionality.


๐Ÿ“‚ Repository Structure

ESP32-CAM-Smart-Door-Lock
โ”‚
โ”œโ”€โ”€ Code
โ”‚   โ”œโ”€โ”€ ESP32_CAM_Door_Lock.ino
โ”‚   โ””โ”€โ”€ README.md
โ”‚
โ”œโ”€โ”€ Images
โ”‚   โ”œโ”€โ”€ Breadboard connection.jpg
โ”‚   โ”œโ”€โ”€ ESP_32 CAM &PIR.jpg
โ”‚   โ””โ”€โ”€ README.md
โ”‚
โ”œโ”€โ”€ Demo
โ”‚   โ”œโ”€โ”€ Working.mp4
โ”‚   โ””โ”€โ”€ README.md
โ”‚
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ README.md

๐Ÿ“ธ Hardware Setup

Complete Hardware Setup

Hardware Setup


ESP32-CAM and PIR Sensor

ESP32 CAM


๐ŸŽฅ Demonstration

The working demonstration video is available in the Demo folder.

๐Ÿ“‚ Demo/Working.mp4


๐Ÿš€ Getting Started

Clone the Repository

git clone https://github.com/roopankumar1404/ESP32-CAM-Smart-Door-Lock.git

Open

Code/ESP32_CAM_Door_Lock.ino

using Arduino IDE.

Install Required Libraries

  • ESP32 Board Package
  • Edge Impulse Library

Upload

Connect the ESP32-CAM using a USB-to-TTL programmer and upload the sketch.


๐Ÿ”ฎ Future Improvements

  • Mobile Application Integration
  • Visitor Log Storage
  • Cloud Notifications
  • RFID Backup Authentication
  • Fingerprint Authentication
  • Battery Backup
  • OLED Status Display
  • Remote Door Unlock

๐Ÿ‘จโ€๐Ÿ’ป Author

Roopan Kumar

Electronics and Communication Engineering

GitHub: https://github.com/roopankumar1404


๐Ÿ“„ License

This project is licensed under the MIT License.


โญ If you found this project useful, consider giving this repository a star.