Face recognition door unlock using AI
We are building a system that utilizes convolutional neural networks, stochastic gradient descent for reducing the loss function, ReLU as the activation function and Open-CV for using the powerful image processing libraries. To train the face recognition model, we are using a custom dataset that con
2025-06-28 16:32:32 - Adil Khan
Face recognition door unlock using AI
Project Area of Specialization Artificial IntelligenceProject SummaryWe are building a system that utilizes convolutional neural networks, stochastic gradient descent for reducing the loss function, ReLU as the activation function and Open-CV for using the powerful image processing libraries. To train the face recognition model, we are using a custom dataset that contains the facial images of authorized users. Furthermore, a laptop PC is being used to host all the computation and processing along with handling the image input (taken in via a camera). The activation of the relay that controls the physical unlocking of the door is dependent upon the approval of the system. Access will only be granted to the known user by comparing the input images with the stored image of the authorized user i.e. the known user. This system aims to reduce the existing intricacies of traditional security methods and hopes to make peoples’ lives more secure without being too expensive. It has great scope in various domains and promises to be the mainstream technology of the future. we focused particularly on the study that would determine the feasibility of the proposed project. We walked through the operational feasibility that shed light on how the project is able to solve the target problem and how each of the components are equally significant in the creation of this project. Technical feasibility determined the potential problems that may arise while using this project and how the users are supposed to handle it skillfully. And finally, the economic feasibility study proved our claim that the project is economically viable and can be produced on a large scale since the components used are easily available in the market.
Project ObjectivesMachine Learning and Computer Vision have practically enabled modern embedded devices to use cameras and understand whatever input they get. It is high time that people may have the feasibility of using modern security systems to their advantage that allows them the freedom from keeping a whole bunch of keys and worry about their safekeeping all the time. We aim to build strong and reliable security systems that are easy to use and are not ultra-expensive. Furthermore, we believe that people shouldn’t rely on old fashioned locks to keep their prized possessions safe since they are quite easy to pick and are helpless in front of modern tools. We have come up with the solution in the form of a door unlocking system that is based upon facial recognition. The access shall only be granted if the image of the person trying to access the door, matches the stored image of the legitimate user.
Project Implementation MethodHardware Implementation
The first thing to do is to check all the physical components and verify whether they are working on an optimum level or not. The laptop is to be fully charged and a backup is to be made available at all times. If the laptop consists of a built-in high definition camera of at least 5 MP quality, then good. Otherwise, a USB 5 MP camera is to be connected with the laptop and positioned in a manner that it may be able to appropriately capture a focused image of the user present in front of it. The Arduino Uno microcontroller is to be connected with the laptop using a USB cable via which the two devices would communicate. The Arduino Uno is to be provided a separate DC supply (7V – 12V) for optimal performance. The relay is to be connected with the microcontroller in a traditional hardwired manner. The Vcc of the relay is connected with the digital output pin of Arduino, while the ground of the relay is connected with the ground of Arduino. The NO port is connected with the 220V power supply of the door lock, while the NC and common port is shorted and connected with the domestic 220V electricity supplying plug. The ground of the door lock power supply is also connected with this 220V electricity supplying plug.
Software Implementation
The laptop has Windows 10 OS pre-installed and operating with the latest update. The facial recognition program, contained in the python file, is executed and run using the Anaconda navigator. The facial recognition program is implemented as follows:
First, we import the required libraries:

Then we set up connection with the connected Arduino Uno’s serial communication port:

After that, we provide the path to the database that contains the authorized users’ images:

If a match is found, then character “c” should be sent to Arduino via the communication port. It will be saved in the variable “on”:

We will list down the authentic users’ images in the variable “cls”:

For the encoding points:

And for the encoding list:

To activate the camera and take the input:

Finally, we will use a loop that would continuously look for the authorized users’ image in the camera. The character “c” will be sent to the Arduino if a match is found. Otherwise, the loop will continue running infinitely until the match is found:


On the other hand, when a match is found and character “c” is sent to the Arduino via the serial communication port, the Arduino Uno sends a HIGH signal to the connected relay for 1 second. That HIGH signal closes the relay and activates the 220V power supply that unlocks the door.

The benefits of our project in different organizations and systems are;
- We can use it for the attendance of staff, students and workers in different organizations, hospitals, universities, schools and industries.
- We can monitor it smartly in a unique way.
- Government can use it for the Criminal Records of the thief and other criminals by recognition of face.
- We can use it for home security.
- We can also use it for the automation of doors unlocking in the vehicles.
- Use it for the authentication of people and has many benefits in modern society.
Hardware we use in this project are ;
- Laptop PC
- Megapixel USB Camera
- Arduino Uno Microcontroller
- Relay module
- Automatic Door Lock
The following software/packages are installed so that machine learning can easily be carried out:
- Python 3.8
- Anaconda distribution
- Jupyter Notebook
- Conda package manager
- Dlib face recognition toolkit
| Item Name | Type | No. of Units | Per Unit Cost (in Rs) | Total (in Rs) |
|---|---|---|---|---|
| Total in (Rs) | 58150 | |||
| Laptop Core i5 3rd Gen | Equipment | 1 | 35000 | 35000 |
| Arduino UNO microcontroller | Equipment | 1 | 1000 | 1000 |
| HD USB Camera | Equipment | 1 | 5000 | 5000 |
| 4 channel relay module | Equipment | 1 | 750 | 750 |
| Automatic Door lock | Equipment | 1 | 4000 | 4000 |
| Wooden door model | Equipment | 1 | 2650 | 2650 |
| USB 2.0 Cable | Equipment | 1 | 150 | 150 |
| Jumper wires | Equipment | 1 | 150 | 150 |
| FYP 1 report hard book binding 3 copies | Miscellaneous | 3 | 1550 | 4650 |
| FYP 2 report hard book binding 3 copies | Miscellaneous | 3 | 1600 | 4800 |