OVERVIEW of Face Recognition based Door Lock using Raspberry Pi B+ OpenCV

Face recognition is an amazing field of computer vision with many possible applications to hardware and devices. Using embedded SOC platforms like the Raspberry Pi and open source computer vision libraries like OpenCV, you can now add face recognition to your own maker projects! In this project, I’ll show you how to build a face recognition based door lock which unlocks itself using face recognition running on a Raspberry Pi.

For this face recognition based door lock project, you need basic skills related to Linux, Raspberry Pi and electronics. If you are not confident with Raspberry Pi you can take any free tutorial from YouTube.

If you are looking for other IOT projects please check this link >>>>



  • Raspberry Pi
  • SD Card
  • Raspberry Pi Camera
  • Servo Motor
  • 10k -ohm   1/4 watt resistor
  • Push Button
  • Hookup Wires
  • Power Supply for Pi and Servo
  • Wood / Glue and Misc for Construction


My Door Lock is based on this below adafruit Tutorial by Toiy DiCola

Please follow his tutorial to learn how this is made. Below is a video of my project’s demonstration.


This implementation of facial recognition involves Principal component analysis (PCA) and Eigenfaces. The Principal Component Analysis (PCA) was independently proposed by Karl Pearson (1901) and Harold Hotelling (1933) to turn a set of possibly correlated variables into a smaller set of uncorrelated variables. The idea is, that a high-dimensional dataset is often described by correlated variables and therefore only a few meaningful dimensions account for most of the information. The PCA method finds the directions with the greatest variance in the data, called principal components.

Here is the documentation for Eigenface and its implementation >>>



Git  >> https://github.com/arnabdasbwn 

Follow me on Instagram >> https://www.instagram.com/arnabdasbwn/

Follow me on Twitter >> https://twitter.com/ArnabDasBwn

Subscribe to my YouTube Channel >> https://www.youtube.com/c/ArnabDasBwn

Credits: Adafruit, Tony DiCola

Crazy Engineer



Rajitha Akwaththa · September 4, 2018 at 5:02 pm

Can I get a full tutorial on this, please? All the codes and connections?

    Crazy Engineer · September 4, 2018 at 8:10 pm

    Hi, The Link for the full detailed tutorial is there on this page. Please follow that tutorial. Make sure to check for dependencies while doing this project.

Sannan Riaz · January 22, 2019 at 6:08 pm

when i execute
this line…it shows errors.(errors: Scanning dependencies of target pch_Generate_opencv_core
[ 13%] Generating precomp.hpp
[ 13%] Generating precomp.hpp.gch/opencv_core_RELEASE.gch
In file included from /usr/include/c++/6/bits/stl_algo.h:59:0,
from /usr/include/c++/6/algorithm:62,
from /home/pi/opencv-2.4.9/modules/core/include/opencv2/core/core.hpp:56,
from /home/pi/opencv-2.4.9/modules/core/precomp.hpp:48:
/usr/include/c++/6/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
compilation terminated.
modules/core/CMakeFiles/pch_Generate_opencv_core.dir/build.make:62: recipe for target ‘modules/core/precomp.hpp.gch/opencv_core_RELEASE.gch’ failed
make[2]: *** [modules/core/precomp.hpp.gch/opencv_core_RELEASE.gch] Error 1
CMakeFiles/Makefile2:960: recipe for target ‘modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all’ failed
make[1]: *** [modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all] Error 2
Makefile:149: recipe for target ‘all’ failed
make: *** [all] Error 2
kindly help me out.

Zein Sahial · February 2, 2019 at 2:06 pm

Hello sir, can i add some more servo in the project sir?

    Crazy Engineer · February 10, 2019 at 2:30 pm

    To do any more task you have to edit the Python Code

Talat shah · February 9, 2019 at 8:56 am

Hi! need your help i did face recognition successfully using rpi i just want when my face recognized the system call me by my name how is it possible??

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.