Abstract
This project centers around a door lock that implements facial recognition and smart features via mobile app integration. The lock hardware itself will retract a deadbolt when a valid face is detected, allowing the user to simply push the door open on their way in, providing ease of access second only to unsecured automatic sliding doors. In addition, a user will be able to download an application onto their Android mobile device that provides them greater features and control over their door locking device. These features include the ability to create a user account, unlock the device remotely, add new users, retrieve a Live Capture Image, and allow the lock to be opened by any face for a set period if the user is expecting company. This project is displayed working on a miniaturized door mockup with a functioning mobile app. 
This project was completed as my Senior Design project, and was awarded Best Presentation and Best Overall Project.
To begin, the brain for this project is a Raspberry Pi 4, and the peripherals are seen in the following image, along with direction of data transfer. As you can see, Google FireBase is used as a communication medium between the Android Mobile app and the Raspberry Pi itself.​​​​​​​

Hardware Connection Diagram

Wiring Schematic for AuraLock Project Hardware

The wiring schematic seen here illustrates the connections between each of the hardware peripherals used. A MCP3008 ADC chip is also implemented in order to measure resistance on the servo (for halting deadbolt) as voltage spikes.
The previous wiring diagram was then converted to a PCB design using EagleCAD. This PCB was then milled out on a Bantam desktop PCB mill via subtractive manufacturing.
EagleCAD Design
EagleCAD Design
3D Model of PCB Design w/ADC Chip
3D Model of PCB Design w/ADC Chip
Milled PCB using Bantam Desktop PCB Mill
Milled PCB using Bantam Desktop PCB Mill
The following images represent the 3D modeling for the hardware housing. All 3D modeling was done using SolidWorks, however Fusion360 was implemented when preparing the deadbolt to be milled on the Tormach CNC.
Exploded View of Lock Internals
Exploded View of Lock Internals
Exploded View of Lock Internals
Exploded View of Lock Internals
Assembled Lock Model
Assembled Lock Model
Here one can see a collection of images displaying the process of manufacturing the previous 3D models using FDM 3D printing and CNC.
PRUSA MK3S+ Printing Lock Housing
PRUSA MK3S+ Printing Lock Housing
Tormach XS CNC Milling Aluminum Deadbolt
Tormach XS CNC Milling Aluminum Deadbolt
Printed Lock Housing v1
Printed Lock Housing v1
The following images display the assembled hardware module.
Assembled Lock Hardware
Assembled Lock Hardware
Mechanical Unlocking Mechanism
Mechanical Unlocking Mechanism
Side View
Side View
Side View
Side View
Raspberry Pi Ports Exposed
Raspberry Pi Ports Exposed
Back View: Ports for Power, SD Card
Back View: Ports for Power, SD Card
Front View, Deadbolt Extended
Front View, Deadbolt Extended
Interior View
Interior View
PCB Wiring
PCB Wiring
Hardware Stack and Wire Management
Hardware Stack and Wire Management
Next I will discuss the software running on the Raspberry Pi
This state diagram illustrates the function of the Raspberry Pi software. 
This state diagram is sectioned into threads, labeled in red. Each thread runs simultaneously, however some threads will halt the processes of others at times so they do not conflict with one another.
Threads are shown communicating with the Firebase database.

Raspberry Pi Software State Diagram

The Facial Recognition & Capture Thread is responsible for taking an image every 0.5 seconds and processing it to discern whether or not there are authorized faces within it. If there is an authorized face, the door will unlock and an image and name of the user will be sent to Firebase. If the user has specified a delayUnlock, the lock will simply open for any face while there is delayTime remaining. This thread is also responsible for taking an image any time the user requests a LiveCapture, in which case an image will be uploaded to Firebase as LiveCapture.jpg, where it will be downloaded and displayed my the mobile app.
The Unlock Thread is responsible for checking whether the user has requested a remote unlock, in which case the door will unlock. 
The Delayed Unlock Thread allows a user to specify an interval of time in which the door will open for any face. This is useful when a user is expecting company or hosting a gathering where very few of the guests will be registered users.
The Encode New Face Thread is responsible for receiving the images of new users from the app and encoding that image for recognition by the RPi. Encodings are dynamically added to a dictionary array.
The Door Sense Thread simply detects if the door has been opened and then waits to re-lock it once closed. This handles the case when a user manually unlocks the door from inside while exiting.
The software for this project can be viewed in the AuraLock RPi repository.
Next I will discuss Google Firebase

Firebase Database Data Structure

Here one can see the data structure for the Firebase database that allows for communication between the Android app and Raspberry Pi. Each variable is either read or written to in order to transfer information.

For example, the "Unlock" variable is set to "True" when a user requests to unlock the door from the mobile app. The variable is then immediately reset to "False" by the Raspberry Pi once it has been read, and the door unlocked. 
Similarly, the "DelayUnlock" variable is set to "True" by the mobile app when a user requests to have the door remain unlocked for a set period of time indicated by the "delayTime" variable. During this time the door will unlock for any face, authorized or not. The RPi reads this variable and immediately resets the variable to "False" while also reading the "delayTime" variable. The RPi then updates the "timeRemaining" variable every minute until time has elapsed, allowing a user to see the time remaining from their mobile app.

There also exists two image folders in Firebase Storage from which the RPi and Android app push and pull images of users. There is also a third file that stores the LiveCapture.jpg image displaying the current view from the lock.
Next I will discuss the mobile application component of this project
This image seen to the left is the Home Screen of the mobile application. Here the user may select any of the available features, including Remote Unlock, Live Capture, Fixed Unlock, Add Face, or History.

By clicking the About page, the user may view information describing each of these features, however they are described here for your viewing:
Unlock: The Unlock feature allows a user to remotely unlock their AuraLock from anywhere in the world, as long as there is an internet connection.
Live Capture: This feature allows a user to retrieve an image capture displaying what the AuraLock camera sees at that moment.
Fixed Unlock: This feature is described as the "DelayUnlock" above. This feature is what allows a user to specify a period of time during which anyone (authorized or not) is able to unlock the door using facial recognition. This feature would be used in the situation of parties or gatherings where many people would be entering that are not registered users.
Add Face: The Add Face feature is how a user may add a new face to be encoded by the Raspberry Pi.
History: The history feature allows a user to view the most recent unlock made. This includes an image of who unlocked the door, the name of who unlocked the door, and the time at which this unlock was made.

Each of these features are illustrated in GIFs below. Due to their large file size, if some do not load in preview you may either reload your webpage or select each GIF individually.
Unlock Feature GIF
Unlock Feature GIF
Delay Unlock Feature GIF
Delay Unlock Feature GIF
History Feature GIF
History Feature GIF
Live Capture Feature GIF
Live Capture Feature GIF
Add Face Feature GIF
Add Face Feature GIF
The software for the Mobile App can be viewed in the AuraLock Android App Repository.
Next I will discuss the Model Door and Completed Project
The following images display the completed prototype installed in the simulated door. This should allow one to gain a better understanding of how the hardware is situated in the frame of the door, rather than the door itself.
Exterior of Door
Exterior of Door
Camera and LED module separate from Door
Camera and LED module separate from Door
Close up of Camera and LED module
Close up of Camera and LED module
Lock Hardware installed in Door Frame
Lock Hardware installed in Door Frame
Exterior of Door, Opened
Exterior of Door, Opened
Lock Hardware, Uncovered as Door is Opened
Lock Hardware, Uncovered as Door is Opened
Interior of Door
Interior of Door
View of Unlocking Mechanism and Lock Hardware
View of Unlocking Mechanism and Lock Hardware
Close up of Unlocking Mechanism
Close up of Unlocking Mechanism
Deadbolt extends INTO Door, from Frame
Deadbolt extends INTO Door, from Frame
Top down view of Mock Door, Deadbolt extended
Top down view of Mock Door, Deadbolt extended
Final Demonstration of the Remote Unlock Feature
Below you can see a complete demonstration of the Remote Unlock feature. The user selects the Unlock button on the Mobile Application, the Firebase variable "Unlock" is updated, and the door unlocks for 5 seconds. Since the door was not opened, it simply re-locks after the 5 seconds has passed.

You may also like

Back to Top