0% found this document useful (0 votes)
29 views8 pages

IoT Project Report

The document describes a facial recognition security system project using an ESP32 camera module. The system captures facial images and determines if the face matches an authorized user, triggering a relay to unlock a door if so. Key components are the ESP32, camera, relay, solenoid lock, regulator, and programming is done via UART. Circuit diagrams and code snippets are provided.

Uploaded by

mussa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views8 pages

IoT Project Report

The document describes a facial recognition security system project using an ESP32 camera module. The system captures facial images and determines if the face matches an authorized user, triggering a relay to unlock a door if so. Key components are the ESP32, camera, relay, solenoid lock, regulator, and programming is done via UART. Circuit diagrams and code snippets are provided.

Uploaded by

mussa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

DEPARTMENT OF COMPUTER & SOFTWARE

ENGINEERING
COLLEGE OF E&ME, NUST, RAWALPINDI

Subject Name

Introduction to IoTs

PROJECT REPORT

SUBMITTED TO:
Dr Ali Hassan
Ma’am Malyka

SUBMITTED BY:
Students Name
1. Muhammad Mussa Kazim -404047
2. Mueed Rauf -
3. Wahaaj Nasir -

DE- 44 Dept C&SE


Submission Date:
6th Jan, 2024
Facial Recognition Security System

Working Principle:
Introduction: Facial Detection Lock System using an ESP32 Cam is a cutting-edge security
solution. By utilizing facial recognition technology, this system enhances access control, allowing
only authorized individuals to unlock doors. The ESP32 analyzes captured facial images, and upon
positive identification, triggers the relay to activate the solenoid lock, ensuring secure and easy
access. This technology finds applications in home security, offices, and various facilities where a
reliable and user-friendly access control system is important. A few key points regarding our
project are given below:
1. Facial Detection: The ESP32 Cam captures images using its integrated camera. It then processes
these images to perform facial detection. There are pre-trained machine learning models for facial
detection that can be used with the ESP32.
2. Decision Making: The ESP32 analyzes the detected faces and decides whether the recognized
face matches an authorized face stored in its database. If there's a match, it sends a signal to unlock
the door.
3. Control Signal: The ESP32, upon deciding to unlock the door, sends a control signal to the
relay. The relay acts as a switch, allowing a higher-voltage circuit (solenoid lock) to be controlled
by the lower-voltage ESP32.
4. Solenoid Activation: When the relay is triggered, it powers the solenoid lock. The solenoid
extends or retracts its plunger, depending on its design, to physically unlock or lock the door.
5. Power Regulation: The regulator IC ensures a stable power supply to all components,
preventing voltage fluctuations that could affect the proper functioning of the system.
In summary, the ESP32 Cam captures and processes facial images, determines if the face is
authorized, and triggers the unlocking mechanism if it is. The relay and solenoid lock physically
control the door lock based on the decision made by the ESP32. The regulator IC ensures a
consistent power supply for reliable operation.
Schematic Diagrams:
ESP-32 Cam Module:

Programming the ESP-32 Cam with the UART-TTL Programmer:


To program the ESP-32 Cam, we connected ‘Vcc’ and ‘Ground’ Pins of the UART-TTL
Programmer to the ‘Vcc’ and ‘Ground’ pins of the ESP-32 Camera Module. The TX(Transmit) pin
of the Programmer was connected to the U0R(Receive) pin of the ESP-32 Cam Module. The
Rx(Receive) pin of the programmer was connected to the U0T(Transmit) Pin of the ESP-32 Cam.
We then connected the ESP32-Cam’s GPIO 0 to Ground to enable programming mode.
After these Connections were complete, we used the Arduino IDE to upload our Facial Detection
Algorithm into the ESP-32 Cam. After the code upload is complete, we can disconnect the GPIO-0
from Ground to enable normal operation mode.

Circuit Diagram:
Circuit Explanation:
Once we uploaded the code to the ESP-32 Cam, the above given circuit was implemented in order
to achieve our goal of a Facial Detection Lock System. We have used a 12V Battery because the
Solenoid Lock needs a 12V supply in order to Work Properly. We convert this 12 Volts to 5 Volts
using the Voltage Regulator IC because our ESP and Relay needs a 5V Supply. The Relay acts like
a Switch in our Circuit. Whenever the ESP 32 Cam detects a recognizable face, it sends a signal to
the Relay to close the switch inside it. This allows a 12V supply to the Solenoid Lock and it closes
for a Delay of 5 Seconds(because we have added a 5s delay in our code). We also ended up using a
BJT to send the signal from ESP to Relay Module to control the Voltage and Current levels as the
Solenoid Lock was attracting too much power towards it and this was becoming problematic during
the working of our project.

Hardware Components Used:


1. ESP32 Camera Module
2. Relay Module
3. 12V Solenoid Lock
4. 12 Volts Battery
5. 7805 Regulator IC
6. UART TTL Programmer
7. Bipolar Junction Transistors
8. LEDs
9. Resistors
10. Capacitors
11. A Breadboard
12. Wires

Important Code Snippets:

#include "esp_camera.h"
#include <WiFi.h>

#define CAMERA_MODEL_AI_THINKER
#define Relay 2
#define Red 13
#define Green 12
#include "camera_pins.h"
const char* ssid = ""; //Wifi Name SSID
const char* password = ""; //WIFI Password

void startCameraServer();

boolean matchFace = false;


boolean activateRelay = false;
long prevMillis=0;
int interval = 5000;

void setup() {
pinMode(Relay,OUTPUT);
pinMode(Red,OUTPUT);
pinMode(Green,OUTPUT);
digitalWrite(Relay,LOW);
digitalWrite(Red,HIGH);
digitalWrite(Green,LOW);

Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println();

// Other code for defining inbuilt pin configuration for Face Detection Algorithm

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {


delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");

startCameraServer();

Serial.print("Camera Ready! Use 'http://");


Serial.print(WiFi.localIP());
Serial.println("' to connect");
}

void loop() {
if(matchFace==true && activateRelay==false)
{
activateRelay=true;
digitalWrite(Relay,HIGH);
digitalWrite(Green,HIGH);
digitalWrite(Red,LOW);
digitalWrite(33, HIGH);
prevMillis=millis(); //the millis() function returns the number of milliseconds since the Arduino started running.
}
if (activateRelay == true && millis()-prevMillis > interval)
{
activateRelay=false;
matchFace=false;
digitalWrite(Relay,LOW);
digitalWrite(Green,LOW);
digitalWrite(Red,HIGH);
}
}

// Note that the above code includes only the important and relevant part of our code which is enough to
understand the project requirements.

HARDWARE IMPLEMENTATION
Conclusion:
To sum it up, our project with the ESP32-CAM Module for Facial Detection Lock System is pretty
cool. It's like having a smart lock that recognizes faces! We connected a special programmer to
easily load the face-recognizing code onto the ESP32-CAM. This means our lock system can learn
and identify faces, making it a smart and secure way to control access. It's a neat example of how
these little modules can do big things, making security more high-tech and user-friendly.

You might also like