Face Recognition Door Lock With Smartphone Notifications

by Next Builder DIY in Circuits > Gadgets

519 Views, 13 Favorites, 0 Comments

Face Recognition Door Lock With Smartphone Notifications

3D Printed_20250817_194236_0000.jpg

Have you ever wished your home security system felt as futuristic and intelligent as JARVIS from Iron Man? With my latest creation, that wish gets a step closer to reality. I’ve designed and built a Face Recognition Door Lock with Smartphone Notifications, combining sleek aesthetics with cutting-edge AI technology.

The modern design inspired by the Iron Man arc reactor, giving it that unmistakable high-tech, premium look. At the heart of the system is the DFRobot HuskyLens AI Machine Vision Sensor, an incredibly capable and beginner-friendly module that handles facial recognition with impressive speed and accuracy.

Security is at the core of this build the door only unlocks when an authorized face comes within view of the HuskyLens camera. As soon as it detects and verifies a face from the stored authorized profiles, the door unlocks instantly and a Telegram bot sends a notification straight to your smartphone. Multiple authorized faces can be stored, and each time one of them is recognized, you’ll get an alert. If the face isn’t authorized, the lock stays firmly shut and silent, making sure only trusted individuals can get inside.

The process is seamless — the HuskyLens constantly scans for faces, verifies them against its database, and either grants access with a notification or denies entry without a sound. With the latest DFRobot Beetle ESP32-C6 microcontroller as the brain of the system, everything runs smoothly, from managing the HuskyLens to handling secure Telegram communication.

The result is a responsive, reliable, and stylish door access system that feels like it belongs in Tony Stark’s lab. This project is celebrating my love for the Marvel universe while merging fandom-inspired design with real-world security and functionality. I’ve always wanted my own J.A.R.V.I.S., and now, every time I walk up to my door, I feel like Tony Stark arriving at his workshop.

Supplies

3D Printed_20250817_154432_0000.jpg
3D Printed_20250817_165105_0000.jpg
3D Printed_20250817_170639_0000.jpg
3D Printed_20250817_165321_0000.jpg
3D Printed_20250817_192146_0000.jpg
3D Printed_20250817_192456_0000.jpg
3D Printed_20250817_192607_0000.jpg
3D Printed_20250817_192916_0000.jpg
Components
  1. DFRobot Huskeylens
  2. DC Female Socket
  3. 10k ohm Resistor
  4. DFRobot Beetle ESP32-C6
  5. MP1584 Buck Converter
  6. 12v Solenoid Door Lock
Tools
  1. Soldering Iron
  2. Soldering Wire
  3. T-7000 Glue

CAD & 3D Printing

AutodeskFusion360480P-ezgif.com-video-to-gif-converter.gif
P2.png
P8.png
3D Printed_20250817_213723_0000.jpg
3D Printed_20250817_214432_0000.jpg
3D Printed_20250817_214520_0000.jpg

To start this project, I Started designing the CAD using Fusion 360. It’s a simple and compact design that’s easy to print and assemble. If you’d like to view or edit the model, you can open it directly in your browser using the Fusion 360 web viewer. Feel free to customize it however you like.

For 3D Printing, You can directly download the required STL files below:

  1. Main Panel.stl
  2. Back.stl

For 3D printing, I used JLC3DP, a professional 3D printing service known for its high precision, affordable prices, and wide range of material options. They support advanced printing technologies like SLA, SLS, MJF, and FDM, delivering smooth, durable parts that are perfect for both prototypes and final builds.

One of the best things about JLC3DP is their fast turnaround time and reliable global shipping, making it super convenient for hobbyists, students, and professionals alike. Whether you're just starting out or working on a serious engineering project, JLC3DP is a great choice

👉 Use the link to get an exclusive $70 discount on your first order from JLC3DP!

Face Registration

3D Printed_20250817_213248_0000.jpg
3D Printed_20250817_213424_0000.jpg
3D Printed_20250817_213616_0000.jpg

Registering your face on the HuskyLens is very easy. Switch the HuskyLens to Face Recognition mode, then Point the + symbol at a face, short press the learning button to learn the face. If the same face is detected by HuskyLens, a blue frame with words Face: ID1 will be displayed on the screen, which indicates that HuskyLens has learned the face and can recognize it now. You can repeat the process to add multiple faces, each with its own unique ID.

Huskeylens Assembly

3D Printed_20250817_214628_0000.jpg
3D Printed_20250817_214825_0000.jpg
3D Printed_20250817_214720_0000.jpg
3D Printed_20250817_215150_0000.jpg
3D Printed_20250817_215306_0000.jpg

Start by placing the HuskyLens into its dedicated slot inside the enclosure. Make sure it is aligned correctly with the front opening for a clear view. Once positioned, secure it firmly using the two provided screws.

After securing the module, connect the included 4-pin JST connector to the HuskyLens. This connector makes the wiring neat and simple, ensuring a stable and reliable connection.

DC Jack Assembly

3D Printed_20250817_214923_0000.jpg
3D Printed_20250817_215418_0000.jpg
3D Printed_20250817_215036_0000.jpg

Insert the DC female jack into the dedicated slot in the enclosure. Ensure it is properly aligned so that connecting the male jack from outside for power input will be smooth and convenient. To secure it firmly in place, apply small amount of T-7000 glue (or any strong adhesive of your choice).

Microcontroller Assembly

3D Printed_20250818_225132_0000.jpg
3D Printed_20250818_225257_0000.jpg
3D Printed_20250818_225033_0000.jpg

Place the microcontroller inside the enclosure at the cutout for the Type-C port. Align it properly so the Type-C connector is accessible from outside for easy programming. Apply a small amount of T-7000 glue to fix it in place. Don’t use too much glue—just enough to hold it securely.

MP1584 Setup & Assembly

3D Printed_20250817_215930_0000.jpg

There isn’t a dedicated slot for the MP1584 buck converter, so you can place it in any free space inside the enclosure. Before fixing it with T7000 glue, first set it up for a stable 5V output. To do this, connect two wires to the input and provide 12V. Then, measure the output voltage and carefully rotate the potentiometer on the buck converter until it reads exactly 5V. Once it is set, secure the module inside the enclosure.

Warning: Be gentle while adjusting the potentiometer. Rotating it too much can cause sudden voltage spikes, which may damage your circuit.

Mosfet Assembly

3D Printed_20250821_175424_0000.jpg
3D Printed_20250821_181751_0000.jpg
3D Printed_20250817_220055_0000.jpg

Since the enclosure is designed with a thick wall for a more professional look, the MOSFET module could not be placed directly inside. To solve this, I removed the MOSFET from the module first.

There isn’t a dedicated slot for the MOSFET, so you can place it in any free space inside the enclosure. Once positioned, secure it firmly using T-7000 glue. Make sure the MOSFET is fixed properly and has enough space for air circulation, as it can heat up during use.

Solenoid Lock

3D Printed_20250817_220436_0000.jpg
3D Printed_20250817_220332_0000.jpg
3D Printed_20250817_215816_0000.jpg

Pass both wires of the solenoid lock through the two small holes provided in the enclosure. These holes are made specifically to allow the wires to pass through easily for proper connection. Ensure the wires are passed gently without pulling too hard to avoid damage.

Connection

Untitled Sketch 2_bb.png
3D Printed_20250817_215601_0000.jpg
3D Printed_20250817_215659_0000.jpg
3D Printed_20250817_220224_0000.jpg

You can follow the circuit diagram above to make all the connections. However, for clarity, I’ve also explained each connection step by step below.

HuskyLens AI Camera

  1. VCC → 5V pin of ESP32
  2. GND → GND of ESP32
  3. TX → RX of ESP32
  4. RX → TX of ESP32

DFRobot Beetle ESP32-C6

  1. VIN → 5V output from MP1584 buck converter
  2. GND → Common GND (shared with HuskyLens, MOSFET, and power supply)
  3. TX/RX → Connected to HuskyLens
  4. GPIO pin → Gate of MOSFET (through resistor)

MOSFET (for Solenoid Control)

  1. Gate → ESP32 GPIO pin
  2. Source → GND
  3. Drain → Negative wire of Solenoid Lock

Resistor connected with Gate & Drain Pin

Solenoid Lock

  1. Positive wire → 12V supply
  2. Negative wire → MOSFET Drain

Power Supply (12V input via DC Jack)

  1. Positive → Solenoid Lock positive wire + input of MP1584 buck converter
  2. Negative → Common GND to MP1584 Buck Converter.

MP1584 Buck Converter

  1. Input + → 12V supply positive
  2. Input – → 12V supply negative (GND)
  3. Output + → ESP32 VIN (5V)
  4. Output – → ESP32 GND

Final Assembly

3D Printed_20250817_220654_0000.jpg
3D Printed_20250817_220758_0000.jpg
3D Printed_20250817_220549_0000.jpg

Once all the components are in place, align the cover with the bottom enclosure and ensure the camera opening is clear. Match the orientation properly, then secure the cover using two screws. Do not overtighten the screws, as this may damage the enclosure or misalign the cover.

Telegram Chat Bot

Screenshot_2025_0813_151317.jpg
Screenshot_2025_0813_151353.png
Screenshot_2025_0813_151411.png
IMG_20250813_163737.png

Creating a chatbot on Telegram is quick and easy. Open Telegram and search for @BotFather, then start a chat. Type /newbot and follow the prompts.

  1. Bot name: Enter any name you like for your project.
  2. Username: Choose a unique username for your bot. It must end in bot Like this, (for example: TetrisBot or tetris_bot)

Once completed, BotFather will send you a congratulations message along with your Bot Token ID. Make sure to keep your token secure and store it safely, it can be used by anyone to control your bot, as well as it will be required later to connect your hardware with the bot.

Chat ID

Screenshot_2025_0813_064631.png
Screenshot_2025_0814_164819.png
Screenshot_2025_0818_223401.png

After creating your chatbot, open your internet browser and go to;)

https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates

Replace <YOUR_BOT_TOKEN> with the token you got from BotFather. At first, you might see some basic data with true or false values. Now, go back to your chatbot in Telegram and send it any message, such as hi. Then return to your browser and refresh the page. If everything is correct, you will see some data along with your Chat ID, which will be used later in the code.

Arduino IDE Setup

Arduino-IDE-ESP32-Json-URL.png
arduino-ide-2-boards-manager.png
Install-ESP32-Arduino-IDE-2.png

Install Arduino IDE

If you do not already have it, download and install Arduino IDE 2.0 latest Version from official website of Arduino.

Add the ESP32-C6 Board Support URL

  1. Open Arduino IDE.
  2. Go to File > Preferences.
  3. In the Additional Board Manager URLs field, paste the following URL:
https://espressif.github.io/arduino-esp32/package_esp32_index.json
  1. Click OK to save your changes.

Install the latest version of ESP32 Board.

  1. Go to Tools > Board > Boards Manager.
  2. In the search bar, type ESP32.
  3. Click & Install the latest version of ESP32

Verify Board Installation

  1. Once installed, DFRobot Bettle ESP32-C6 should now appear under Tools > Board.
  2. Select DFRobot Bettle ESP32-C6 from the list to start programming the device.

Code Uploading

Library Installation

Before uploading the code to the microcontroller, it’s important to ensure that all the required libraries are installed in the Arduino IDE. To install, open the Arduino IDE, go to the Library Manager (Sketch → Include Library → Manage Libraries) then search for the following libraries and click Install:

  1. Huskeylens

If you do not find the HuskeyLens library in the Library Manager, you can manually install it from GitHub. Open the HuskeyLens Library GitHub page, then click on the green Code button and select Download ZIP. Once the ZIP file is downloaded, extract it on your computer. After extracting, go back to the Arduino IDE and click on Sketch > Include Library > Add .ZIP Library. Navigate to the folder where you extracted the library and select it. The HuskeyLens library will then be successfully added to your Arduino IDE.

Set-up In Code

Before uploading the code, make sure to update it with your own Wi-Fi credentials in these lines:

// WiFi credentials
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";

Replace "YOUR_WIFI_SSID" with the name of your Wi-Fi network, and "YOUR_WIFI_PASSWORD" with your actual Wi-Fi password. Be sure to keep the quotation marks around your credentials.

Next, enter your Telegram bot credentials in these lines:

// Telegram Bot credentials
const char* botToken = "YOUR_BOT_TOKEN";
const char* chatID = "YOUR_CHAT_ID";

Replace "YOUR_BOT_TOKEN" with your own bot token which one you got during creating a bot, and "YOUR_CHAT_ID" with your own chat ID which one you got from internet browser.

Uploading Code

Once everything done, you’re ready to upload the code. Connect the Beetle ESP32-C6 to your computer using a USB-C cable, select the correct board and port from the Tools menu, and hit the Upload button.

#include "HUSKYLENS.h"
#include <WiFi.h>
#include <WiFiClientSecure.h>

// WiFi credentials
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";

// Telegram Bot credentials
const char* botToken = "YOUR_BOT_TOKEN";
const char* chatID = "YOUR_CHAT_ID";

// HuskyLens (UART2 on ESP32)
HUSKYLENS huskylens;
HardwareSerial huskySerial(2); // Use UART2 (RX2=16, TX2=17)

// Solenoid Lock Pin
#define LOCK_PIN 4 // D4 on Beetle ESP32-C6
bool unlocked = false;

void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("Booting...");

pinMode(LOCK_PIN, OUTPUT);
digitalWrite(LOCK_PIN, LOW); // Initially locked

// Connect to WiFi
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi...");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\n✅ WiFi Connected");

// Initialize HuskyLens (UART2)
huskySerial.begin(9600, SERIAL_8N1, 16, 17); // RX=16, TX=17
if (!huskylens.begin(huskySerial)) {
Serial.println("❌ HuskyLens not connected!");
while (1); // Stop if HuskyLens fails
}
Serial.println("✅ HuskyLens connected!");

Serial.println("System ready.");
}

void loop() {
if (huskylens.request()) {
while (huskylens.available()) {
HUSKYLENSResult result = huskylens.read();
int id = result.ID;
Serial.print("Detected ID: ");
Serial.println(id);

if (id >= 1 && id <= 5 && !unlocked) {
Serial.println("✅ Authorized face. Unlocking...");
digitalWrite(LOCK_PIN, HIGH); // Unlock
unlocked = true;

String message = "🔓 Door unlocked by ID-" + String(id);
sendTelegramMessage(message);

delay(5000); // Keep unlocked for 5 sec
Serial.println("🔒 Locking again...");
digitalWrite(LOCK_PIN, LOW); // Lock
unlocked = false;
}
}
}
delay(100);
}

void sendTelegramMessage(String message) {
WiFiClientSecure client;
client.setInsecure(); // Skip SSL verification (not secure for production)

if (!client.connect("api.telegram.org", 443)) {
Serial.println("❌ Telegram connection failed");
return;
}

String url = "/bot" + String(botToken) +
"/sendMessage?chat_id=" + String(chatID) +
"&text=" + message;

Serial.println("Sending to Telegram: " + message);

client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: api.telegram.org\r\n" +
"Connection: close\r\n\r\n");

delay(1000);
}

Testing

Now it’s time to bring the project to life. Provide a 12V supply to the DC jack — you can simply use a 12V adapter for this. Once the power is supplied, wait for about 5 to 10 seconds, as the microcontroller needs a short time to connect with WiFi.

After it connected successfully, I pointed the camera toward my face — and you won’t believe how well it worked! The HuskyLens instantly recognized me, and the door unlocked almost immediately. The responsiveness was even faster than I expected — it felt like a real professional smart lock system.

On top of that, I also received a notification on my Telegram via the bot I created, confirming the unlock event. This made the whole experience more exciting and reliable, as I could monitor the activity in real-time.

Conclusion

Building this project was more than just a technical challenge—it was a way of bringing my curiosity and fascination with Marvel Studios’ Iron Man into real life. I’ve always admired the idea of J.A.R.V.I.S. controlling Tony Stark’s smart home, and through this build, I got to experience a small piece of that world. What started as a fandom-inspired experiment turned into something surprisingly practical. The face recognition door lock is not only fun and futuristic, but also highly responsive, reliable, and secure—making it a genuinely useful device for daily life. This blend of creativity, inspiration, and utility is exactly why I love making, and I’m excited to keep exploring projects that connect imagination with real-world applications.

Happy Making 🤞🏻