This instructable describes an approach for using facial recognition to control door access. Please note that the facial recognition part of the solution uses a commercial iOS application. It is possible to use open source software such as openCV for facial recognition but the results will not be as good as a commercial algorithm.

Parts List:

  • Raspberry Pi running node.js,
  • Pi Power module for Raspberry Pi, allows 12V supply for door strike and 5v for Raspberry Pi,
  • 12V Barrel Connector Power Supply such as this 12V Power Supply,
  • Barrel Jack Power Switch such as Sparkfun's which provides a convenient way to switch on and off power to the Raspberry Pi,
  • Electric door strike such as the Lockwood ES2100,
  • Single 12V Relay such as this one from Amazon (any generic relay will do),
  • iPad secure mounting case such as the Brateck PAD-12,
  • iOS Facial Recognition application such as QikFACE Biometric Access Control iPad application (free version includes 3 users).

The steps involved to open the door are:

  1. A subject wishing to gain access presents themselves to the iPad securely mounted on the external door,
  2. The QikFACE Biometric Access Control application captures the subject's face and optionally requests a PIN,
  3. The Access Control application submits the photo and PIN to the biometric server for authentication,
  4. If authentication is successful QikFACE Biometric Access Control application sends an HTTP request to the node.js server on the Raspberry Pi requesting that the door be opened,
  5. The Raspberry Pi sets a high signal on the pin connected to the 12V relay which in turn opens the latch on the electric door strike,
  6. The subject gains access to the door. After 10s the Raspberry Pi automatically sets the signal on the 12V relay to low and the electric door strike reverts to a locked state.

Step 1: Install the Electric Door Strike

In this instructable the electric lock used is the Lockwood ES2100 but any lock with an electrically controlled strike can be used. If the lock is already installed even better. Depending on the situation it could be somewhat expensive to install the lock. The lock installation shown in the photographs attached to this step cost $400 for a professional locksmith to install, of course you can do it yourself in some circumstances.

The electric door strike must be installed so that the control wires can be accessed by the Raspberry Pi circuit on the internal side of the door.

Make sure the lock is in Fail-Secure mode before installing. In this mode it should not be possible to move the latch with your hand unless the lock is electrically activated.

Step 2: Install the Raspberry Pi and Node.js

An easy way to signal the Raspberry Pi that will be used to control the electric door strike is to use the lightweight web server Node.js. Node.js applications are written in javascript and are very lightweight making them prefect for the Raspberry Pi. The example Node.js program listed below simply signals the lock to open whenever any incoming HTTP request is received by the Node.js server. In a real-life deployment the program would most likely need to employ an authentication mechanism such as a shared secret to ensure only trusted parties can signal the lock.

A good guide to installing nodejs on a Raspberry Pi from scratch can be found here. If your Raspberry Pi already has Raspbian installed then the instructions below should be enough to get Node.js installed.

  1. If the Raspbian operating system isn't already installed on the Raspberry Pi install it. An easy way to install Raspbian is using the NOOBS installation manager,
  2. Install Node.js

    $ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    $ sudo apt install -y nodejs
    $ npm install rpio
  3. Copy the program below to your Raspberry Pi and save it as secure_door.js,
  4. Start the program with

    $ node secure_door.js
  5. Check the program is working by entering https://IP_address_of_the_Raspberry_Pi:8080 into a web browser and if it is working properly the response will be "Success /",
  6. Once you are up and running you may wish to run the Node.js program as a daemon. The ideal way to accomplish that is to use the pm2 process manager.

    // Modules needed: npm install rpio
    const LISTEN_PORT = 8080;
    const DOOR_LATCH_PIN = 12;
    const CLOSE_LATCH_TIMEOUT = 5000;

    var http = require('http');
    var rpio = require('rpio');
    var fs = require('fs');

    /* Bare bone HTTP request handler. Every incoming HTTP request will cause the door to be opened. Extra application logic should be added to ensure only trusted parties can open the door. */

    function handleRequest(request, response) {
    console.log("Request received for %s.", request.url);
    rpio.write(DOOR_LATCH_PIN, rpio.HIGH);
    setTimeout(closeLatch, CLOSE_LATCH_TIMEOUT);
    response.end("Success " + request.url);

    /* This method is called after the timeout period to deactivate the electric door strike. */

    function closeLatch() {
    console.log("Closing door latch.");
    rpio.write(DOOR_LATCH_PIN, rpio.LOW);

    var server = http.createServer(handleRequest);
    rpio.open(DOOR_LATCH_PIN, rpio.OUTPUT, rpio.LOW);
    server.listen(LISTEN_PORT, function() {
    console.log("Server listening on port %s.", LISTEN_PORT);

Step 3: Wire Up the Circuit

The first step in wiring up the circuit is to identify the positive and ground wires for the electric door latch. If the latch has monitoring capabilities there will be a number of additional wires, these instructions do not use any of those.

  1. If the electric lock needs a positive supply greater than 5v then you will need to solder two wires to the underside of the Pi Power shield where the 12V Power supply connects. This 12V supply is what will be used to activate the electric door lock,
  2. Place the Pi Power shield onto the Raspberry Pi and solder pins 2 and 25 to get the 5V supply from the Pi Power to the Raspberry Pi (full Pi Power instructions),
  3. Connect the Relay to the Pi Power and the electric door lock as shown in hte circuit diagram,
  4. Ensure the USB connection to the Raspberry Pi is removed and connect the 12V power cord to the barrel connector on the Pi Power.

Step 4: Attach IPad and Install IPad Application

Once the door lock is installed and wired up the next step is to install the facial recognition application that will be used to activate the lock. To install the iPad application visit the Apple App Store and search for "QikFACE" and select "QikFACE Biometric Access Control" from the results.

At this stage you can now test the end-to-end system to make sure the door can be opened from the iPad application. Once it's working correctly the final step is to mount the iPad securely outside the door. The best way to mount the iPad will depend on the type of wall and what's available to attach the enclosure to. The attached photos show one example of how the iPad can be attached.

About This Instructable




More by qikid:Facial Recognition Controlled Door Access 
Add instructable to: