A smart home security system that leverages the power of ESP32-CAM microcontroller to perform real-time facial recognition and automatically control a 12V electronic door lock. This project demonstrates the integration of computer vision, embedded systems, and IoT technologies to create a secure, contactless access control solution.
🚧 Project Status: Fully functional prototype - suitable for learning and demonstration purposes. Consider additional security measures for production use.
This system eliminates the need for physical keys or cards by using facial recognition technology. When a registered face is detected, the system automatically unlocks the door, providing seamless and secure access control. The entire system runs on an ESP32-CAM module, making it cost-effective and easy to deploy.
- Face Detection: ESP32-CAM continuously monitors for faces in its field of view
- Recognition: Detected faces are compared against enrolled user profiles
- Access Control: Authorized faces trigger the door lock mechanism
- Remote Monitoring: Web interface allows real-time monitoring and user management
- Real-time face detection using ESP32-CAM's onboard processing
- Multiple user enrollment with persistent storage
- Confidence-based recognition to minimize false positives
- Wi-Fi enabled for remote monitoring and control
- Web-based interface for live video streaming
- User management through browser interface
- Real-time status updates and notifications
- 12V electronic door lock control
- Transistor-based switching for safe voltage isolation
- Status LED indicators for visual feedback
- Low-power operation suitable for continuous use
- Encrypted face data storage
- Configurable recognition threshold
- Access logging (expandable feature)
- Fail-safe operation in case of system errors
| Component | Purpose | Specifications |
|---|---|---|
| ESP32-CAM | Main controller & camera | AI-Thinker ESP32-CAM module |
| Electronic Door Lock | Access control mechanism | 12V solenoid or electromagnetic lock |
| TIP122 Transistor | High-current switching | NPN Darlington transistor |
| 7805 Voltage Regulator | Power supply regulation | 5V output, 1A capacity |
| FTDI232 Adapter | Programming interface | USB-to-TTL converter |
| Resistors & Capacitors | Circuit protection | Various values for driver circuit |
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ ESP32-CAM │ │ TIP122 │ │ 12V Door │
│ │ │ Driver │ │ Lock │
│ GPIO12 ├────┤ Circuit ├────┤ │
│ │ │ │ │ │
│ Wi-Fi │ │ 7805 Reg │ │ Status │
│ Interface │ │ Circuit │ │ LED │
└─────────────┘ └──────────────┘ └─────────────┘
│ │
│ │
┌───▼───┐ ┌────▼────┐
│ Web │ │ Power │
│ User │ │ Supply │
│ UI │ │ 12V │
└───────┘ └─────────┘
Software Requirements:
- Arduino IDE 1.8.x or newer
- ESP32 board package installed
- Basic knowledge of Arduino programming
Hardware Setup:
- Assembled circuit as per connection diagram
- Stable 12V power supply
- Wi-Fi network credentials
# Add ESP32 board manager URL
File → Preferences → Additional Boards Manager URLs:
https://dl.espressif.com/dl/package_esp32_index.json
# Install ESP32 board package
Tools → Board → Board Manager → Search "ESP32" → Install| ESP32-CAM Pin | FTDI232 Pin | Purpose |
|---|---|---|
| U0T | TX | Serial transmission |
| U0R | RX | Serial reception |
| GND | GND | Ground connection |
| 5V | 5V | Power supply |
| GPIO0 | GND | Programming mode (remove after flashing) |
- Connect GPIO0 to GND (programming mode)
- Select Board: "ESP32 Wrover Module"
- Choose correct COM Port
- Upload
Code_FaceRecognitionDoorLock_ESP32CAM_01.ino - Disconnect GPIO0 from GND
- Press RESET button
- Open Serial Monitor (115200 baud)
- Note the displayed IP address
- Open web browser
- Navigate to
http://<ESP32-IP-ADDRESS> - Use the interface to enroll authorized faces
- Test the recognition system
- Configure unlock duration and sensitivity
iot-face-recognition-door-lock/
├── 📄 Code_FaceRecognitionDoorLock_ESP32CAM_01.ino # Main Arduino sketch
├── 📄 app_httpd.cpp # Web server implementation
├── 📄 camera_index.h # HTML interface definitions
├── 📄 camera_pins.h # Pin configuration
├── 📄 README.md # This documentation
├── 📄 LICENSE # MIT License
└── 📁 docs/ # Additional documentation
├── 📄 HARDWARE_SETUP.md # Detailed hardware guide
├── 📄 TROUBLESHOOTING.md # Common issues & solutions
└── 📄 SECURITY_CONSIDERATIONS.md # Security best practices
- Live Video Stream: Real-time camera feed
- Face Enrollment: Add new authorized users
- User Management: View and delete enrolled faces
- System Status: Monitor lock status and connectivity
- Configuration: Adjust recognition sensitivity
- Recognition Threshold: Fine-tune detection accuracy
- Unlock Duration: Set how long door remains unlocked
- Auto-lock Timer: Configure automatic re-locking
- Network Configuration: Update Wi-Fi credentials
- Prototype Status: This is a learning project - additional security measures recommended for production
- Physical Security: Ensure ESP32-CAM is mounted securely and protected from tampering
- Network Security: Use WPA3 encryption on your Wi-Fi network
- Regular Updates: Keep firmware updated with latest security patches
- Implement HTTPS for web interface
- Add backup authentication method (PIN/RFID)
- Implement access logging and monitoring
- Add intrusion detection capabilities
- Use encrypted storage for face data
🔴 ESP32-CAM won't connect to Wi-Fi
Symptoms: Serial monitor shows connection timeouts Solutions:
- Verify Wi-Fi credentials in code
- Check signal strength at installation location
- Ensure 2.4GHz network (ESP32 doesn't support 5GHz)
- Try different power supply (minimum 1A recommended)
🔴 Face recognition accuracy issues
Symptoms: False positives or failed recognition Solutions:
- Improve lighting conditions
- Re-enroll faces with better image quality
- Adjust recognition threshold in settings
- Clean camera lens
- Ensure faces are well-centered during enrollment
🔴 Door lock not activating
Symptoms: Recognition works but lock doesn't trigger Solutions:
- Check power supply to lock mechanism
- Verify transistor circuit connections
- Test lock manually with direct 12V
- Check GPIO pin configuration
- Mobile App: Dedicated smartphone application
- Cloud Integration: Remote monitoring via cloud platform
- Multiple Camera Support: Cover multiple entry points
- Voice Notifications: Audio feedback for recognition events
- Temporal Access Control: Time-based access restrictions
- Integration APIs: Connect with home automation systems
- Additional security features
- UI/UX improvements
- Hardware compatibility extensions
- Documentation translations
- Performance optimizations
- Computer Vision: Face detection algorithms and implementation
- Embedded Systems: ESP32 programming and peripheral control
- IoT Security: Best practices for connected devices
- Web Development: Creating responsive embedded interfaces
- ESP32-CAM Face Recognition Door Lock Tutorial
- Random Nerd Tutorials – ESP32-CAM Video Streaming
- ESP32 Official Documentation
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Bug fixes and improvements
- Documentation updates
- Hardware compatibility
- Security enhancements
- Feature additions
This project is licensed under the MIT License - see the LICENSE file for details.
If you use this project in your work, please provide attribution:
IoT Face Recognition Door Lock System by [Your Name]
https://github.com/yourusername/iot-face-recognition-door-lock
- Issues: Report bugs and request features via GitHub Issues
- Discussions: Join community discussions for questions and ideas
- Wiki: Check the project wiki for additional documentation
If this project helped you, please consider:
- ⭐ Starring the repository
- 🍴 Forking for your own modifications
- 📢 Sharing with others who might find it useful
- 💡 Contributing improvements back to the community
esp32-cam face-recognition iot smart-home embedded-systems computer-vision arduino door-lock security wifi web-interface diy maker electronics automation
⚡ Ready to build your own smart security system? Star this repo and get started!