ESP32CAM Face Recognition Door Lock System


In this ESP32CAM project, I have made the ESP32CAM Face Recognition Door Lock System. You can enroll multiple faces in the esp32cam face detection automatic door lock. If it detects any enrolled face, the door will unlock automatically.

ESP32CAM Face Recognition Door Lock Face match

So this is a very useful smart home project using the esp32 camera module.

Circuit of the ESP32CAM Face Recognition Lock

Circuit ESP32CAM Face Recognition Door Lock

You can easily design this smart door lock with the camera using a 12v electronic lock, ESP32 CAM module, and some basic electronics components. 

Required Components for Face Detection Door Lock

Face detection Door Lock Components
  1. ESP32-CAM board
  2. Electronic door lock 12v
  3. 7805 voltage Regulator (5v)
  4. TIP122 NPN Transistor
  5. 10k Resistor (1no)
  6. 220-ohm Resistors (2no)
  7. Capacitor 220uF
  8. Diode 1N4007 (1no)
  9. LEDs 5-mm (2no)
  10. 12V DC adaptor
  11. FTDI232 USB to TTL conveter (for programming the esp32cam)

Programming ESP32-CAM board

Circuit esp32cam program

To program the ESP32CAM, I have used FTDI232 USB to Serial interface board. I have connected the FTDI232 with ESP32CAM as per the above circuit.

While uploading the code we have to connect GPIO 0 with the GND pin of ESP32CAM.

Before uploading the code to ESP32CAM, please check the following setting:

Face Recognition Door Lock Code
  • Update the Preferences –> Aditional boards Manager URLs:,
  • Board Settings:
    • Board: “ESP32 Wrover Module”
    • Upload Speed: “921600”
    • Flash Frequency: “80MHz”
    • Flash Mode: “QIO”
    • Partition Scheme: “Hue APP (3MB No OTA/1MB SPIFFS)”
    • Core Debug Level: “None”
  • COM Port: Depends On Your System
  • GPIO 0 must be connected to GND pin while uploading the sketch
  • After connecting GPIO 0 to GND pin, press the ESP32 CAM on-board RESET button to put the board in flashing mode

Tutorial video of ESP32CAM Face Recognition

In this tutorial video, I have shown how to make this DIY Face Recognition Door Lock System using esp32 cam step by step. For better understanding please watch the complete video.

Get the IP from ESP32-CAM

ESP32 CAM IP address
How to get the IP from ESP32CAM

1. After uploading the code disconnect GPIO 0 from GND pin.
2. Open Serial Monitor with Baud rate 115200.
3. Press the RESET button on the ESP32CAM board
4. Copy the IP Address from the last line.

Now connect all the components as per the circuit diagram. And give the 12v DC supply to circuit.

After that open any browser, then type the IP address to start the stream.
Now, we have to enroll faces.

1) Click on the Start Stream.
2) Turn on Face Detection and Face Recognition.
3) Click on Enroll Face.
4) Then ESP32CAM will take some sample pictures of the face.
5) At last, a green box will appear around the face.

In this way we can enroll multiple faces.

Finally, ESP32-CAM Face Recognition Lock is ready

ESP32CAM Face Recognition Door Lock Face match
Lock open after the face matched

Now, if the ESP32 CAM detects any enrolled face, it will unlock the door and Green LED will turn on for 6 seconds.

ESP32-CAM Face Recognition Door Lock Face not match
Lock closed as the Face does not matched

If the face does not match with the enrolled face, the door will remain lock as you can see in the above picture.

I hope you like this Smart home project using ESP32-CAM board.

You can also subscribe to our newsletter to receive more such useful electronics projects through email.

Please do share your feedback on this ESP32 project. Thank you for your time.