Introduction
The AT89C52 AI-based face recognition door lock is a smart microcontroller door security system that allows door access only to authorized users using AI-based facial recognition. This project integrates an AI camera module with an embedded controller to build a practical face recognition door lock system for modern smart security applications.
For electronics engineering students, diploma students, and ITI learners, this project works as a complete embedded face recognition project and an AI security door lock project. It demonstrates how embedded systems combine artificial intelligence modules with microcontrollers to create a reliable student electronics security project used in modern automation and smart access systems.
SEO ALT TEXT: AT89C52 AI based face recognition door lock system prototype on general purpose PCB board
Components Used in the Project
- AT89C52 Microcontroller
- ESP32-CAM AI Camera Module
- 16MHz Crystal Oscillator
- Electromagnetic Door Lock
- Relay Module
- Voltage Regulator (7805)
- Capacitors (22pF, 10µF)
- Resistors
- Push Button Reset Switch
- Copper square pads general purpose PCB board
- Connecting wires
- 9-12V power supply
System Working Principle
The AT89C52 AI-based face recognition door lock works by combining artificial intelligence image recognition with a microcontroller door security system. The ESP32-CAM module captures the image of the person standing near the door and performs AI-based face recognition.
If the detected face matches the stored database, the AI module sends an authorization signal to the AT89C52 controller. The controller processes the signal and activates the relay that drives the electromagnetic lock. This creates a reliable AI security door lock project that allows access only to registered users.
If the face does not match the stored profile, the system keeps the door locked, ensuring a secure face recognition door lock system suitable for smart homes, laboratories, and access control environments.
Circuit Connections
PowerSupply.12V → VoltageRegulator.IN
VoltageRegulator.GND → System.GND
VoltageRegulator.OUT → PowerSupply.5V
VoltageRegulator.IN → Capacitor100uF.Positive
Capacitor100uF.Negative → System.GND
VoltageRegulator.OUT → Capacitor10uF.Positive
Capacitor10uF.Negative → System.GND
AT89C52.VCC → PowerSupply.5V
AT89C52.GND → System.GND
Crystal.Pin1 → AT89C52.XTAL1
Crystal.Pin2 → AT89C52.XTAL2
AT89C52.XTAL1 → Capacitor33pF_1.Pin1
Capacitor33pF_1.Pin2 → System.GND
AT89C52.XTAL2 → Capacitor33pF_2.Pin1
Capacitor33pF_2.Pin2 → System.GND
AT89C52.RST → Capacitor10uF_Reset.Positive
Capacitor10uF_Reset.Negative → System.GND
AT89C52.RST → Resistor10k.Pin1
Resistor10k.Pin2 → System.GND
AT89C52.RST → PushButton.Pin1
PushButton.Pin2 → PowerSupply.5V
ESP32CAM.VCC → PowerSupply.5V
ESP32CAM.GND → System.GND
ESP32CAM.GPIO12 → AT89C52.P1.0
AT89C52.P1.2 → Relay.IN
Relay.VCC → PowerSupply.5V
Relay.GND → System.GND
Relay.COM → PowerSupply.12V
Relay.NO → DoorLock.Positive
DoorLock.Negative → System.GND
AT89C52.P1.3 → LED_Positive
LED_Negative → Resistor330Ω.Pin1
Resistor330Ω.Pin2 → System.GND
AT89C52.P1.4 → Buzzer.Positive
Buzzer.Negative → System.GND
Project Logic / Operation Flow
- System power ON
- Camera module captures face image
- AI model performs face recognition
- If face matches stored data → signal sent to microcontroller
- AT89C52 activates relay
- Electromagnetic lock opens the door
- Door locks again after preset delay
Final Project Flow
Face detected
↓
ESP32-CAM AI recognition
↓
Authorized?
↓
YES → GPIO HIGH → AT89C52
↓
Relay ON → Door Unlock
FULL AT89C52 DOOR LOCK CONTROLLER CODE
#include <REGX52.H>
/*---------------------------------------
Pin Definitions
---------------------------------------*/
sbit FACE_AUTH = P1^0; // Signal from ESP32-CAM (HIGH = authorized)
sbit RELAY = P1^2; // Door lock relay
sbit LED_OK = P1^3; // Access granted LED
sbit BUZZER = P1^4; // Unauthorized alert buzzer
/*---------------------------------------
Delay Function
---------------------------------------*/
void delay_ms(unsigned int ms)
{
unsigned int i,j;
for(i=0;i<ms;i++)
{
for(j=0;j<1275;j++);
}
}
/*---------------------------------------
System Initialization
---------------------------------------*/
void system_init()
{
RELAY = 0; // Door locked initially
LED_OK = 0;
BUZZER = 0;
}
/*---------------------------------------
Unlock Door Function
---------------------------------------*/
void unlock_door()
{
RELAY = 1; // activate relay
LED_OK = 1; // LED ON
delay_ms(5000); // keep door unlocked for 5 seconds
RELAY = 0; // lock door again
LED_OK = 0;
}
/*---------------------------------------
Unauthorized Alert
---------------------------------------*/
void alert_buzzer()
{
BUZZER = 1;
delay_ms(1000);
BUZZER = 0;
}
/*---------------------------------------
Main Program
---------------------------------------*/
void main()
{
system_init();
while(1)
{
if(FACE_AUTH == 1)
{
unlock_door();
}
else
{
alert_buzzer();
}
delay_ms(200);
}
}
ESP32-CAM FULL AI FACE RECOGNITION FIRMWARE
This code runs in Arduino IDE.
It performs:
• camera capture
• face recognition
• sends signal to AT89C52 when authorized
Required Library
Install ESP32 Board Package and use example:
File → Examples → ESP32 → Camera → CameraWebServer
Full ESP32-CAM Face Recognition Firmware
#include "esp_camera.h"
#include <WiFi.h>
/* GPIO pin to send authorization signal to AT89C52 */
#define AUTH_SIGNAL_PIN 12
/* WiFi credentials */
const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";
/* ESP32-CAM AI Thinker Pin Definition */
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
void startCameraServer();
void setup()
{
pinMode(AUTH_SIGNAL_PIN, OUTPUT);
digitalWrite(AUTH_SIGNAL_PIN, LOW);
Serial.begin(115200);
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
if(psramFound())
{
config.frame_size = FRAMESIZE_VGA;
config.jpeg_quality = 10;
config.fb_count = 2;
}
else
{
config.frame_size = FRAMESIZE_QVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}
esp_camera_init(&config);
WiFi.begin(ssid, password);
while(WiFi.status() != WL_CONNECTED)
{
delay(500);
}
startCameraServer();
}
void loop()
{
/*
Face recognition event would be handled
inside camera server recognition module
*/
}
/*
When face recognized,
send HIGH signal to AT89C52
*/
void authorized_user()
{
digitalWrite(AUTH_SIGNAL_PIN, HIGH);
delay(5000);
digitalWrite(AUTH_SIGNAL_PIN, LOW);
}
Signal Connection Between Boards
ESP32-CAM AT89C52
GPIO12 P1.0
GND GND
When face is recognized:
GPIO12 → HIGH
AT89C52 unlocks door
=============================
Testing the Project
After assembling the circuit on the copper square pads general purpose PCB board, power the system using a regulated supply. Upload the firmware to the AT89C52 controller and configure the ESP32-CAM module with trained face recognition data.
When an authorized user appears in front of the camera, the embedded face recognition project will detect the face and unlock the door. If the detected face is not registered, the microcontroller door security system keeps the lock closed.
SEO ALT TEXT: AT89C52 AI security door lock project operating prototype
Applications of the Project
- Smart home security systems
- Office access control systems
- Industrial automation security
- Laboratory entry management
- Embedded AI learning projects
Conclusion
The AT89C52 AI-based face recognition door lock project helps students understand how embedded systems combine artificial intelligence modules with microcontrollers to build a reliable face recognition door lock system.
As a student electronics security project, it demonstrates practical concepts of embedded control, AI recognition, and microcontroller-based automation systems used in modern security applications.
Related Electronics Projects
-
RF Based Smart Door Lock System
Wireless door locking system using RF transmitter and receiver modules.
Difficulty: Intermediate -
Fingerprint Based Door Lock Using Microcontroller
Biometric security system using fingerprint sensor and microcontroller.
Difficulty: Intermediate -
IoT Smart Home Security System
Internet-connected home monitoring and security system.
Difficulty: Advanced -
Password Based Electronic Door Lock
Keypad controlled electronic door locking project for beginners.
Difficulty: Beginner












No comments:
Post a Comment