Divins Mathew
Published © Apache-2.0

Smart Door with Face Unlock

Bring the power of face unlock to your shelf, door or wardrobe with Bolt IoT.

IntermediateFull instructions provided24 hours48,411
Smart Door with Face Unlock

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Arduino UNO
Arduino UNO
×1
Buzzer
Buzzer
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×2
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Green
5 mm LED: Green
×1
Resistor 10k ohm
Resistor 10k ohm
×2
Resistor 330 ohm
Resistor 330 ohm
×2
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Windows 10
Microsoft Windows 10
Microsoft Visual Studio
Arduino IDE
Arduino IDE
Face++

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Facebolt Doorlock.fzz

Fritzing Circuit Schematic

Code

WinForms Application - Visual Studio Project (Facebolt Doorlock).zip

C#
* Extract the zip file and open the .sln file in Visual Studio.
* Modify the code with your API credentials.
* Run the project.
* Add a trusted face.
* Finally, Start face monitoring.
No preview (download only).

BoltDoorLock.ino

C/C++
Arduino code.
#include <Servo.h>

#define ServoPin 4
#define LockSignalPin 2
#define UnLockSignalPin 3
#define BellButtonPin 5
#define LockButtonPin 8
#define RingBellSignalPin 6
#define BuzzerPin 7
#define GreenLedPin 9
#define RedLedPin 10

Servo myServo;

void setup() 
{
    pinMode(LockSignalPin, INPUT);
    pinMode(UnLockSignalPin, INPUT);
    pinMode(BellButtonPin, INPUT);
    pinMode(LockButtonPin, INPUT);

    pinMode(BuzzerPin, OUTPUT);
    pinMode(RedLedPin, OUTPUT);
    pinMode(GreenLedPin, OUTPUT);
    pinMode(RingBellSignalPin, OUTPUT);

    digitalWrite(RedLedPin, LOW);
    digitalWrite(GreenLedPin, LOW);
    digitalWrite(RingBellSignalPin, LOW);

    myServo.attach(ServoPin);
    Serial.begin(9600);
}

void loop() 
{
    int lockButton, lock, unlock, bell;
    char snum[5];

    lock = digitalRead(LockSignalPin);
    unlock = digitalRead(UnLockSignalPin);
    
    // Check if lock signal from Bolt is HIGH
    if(lock == HIGH)
    {
        // Turn motor to locked position
        myServo.write(120);
        
        // Set LED indications
        digitalWrite(GreenLedPin, LOW);
        digitalWrite(RedLedPin, HIGH);

        // Buzz locking sound
        digitalWrite(BuzzerPin, HIGH);
        delay(1000);
        digitalWrite(BuzzerPin, LOW);
        delay(1000);
    }
    // Check if unlock signal from Bolt is HIGH
    else if(unlock == HIGH)
    {
        // Turn motor to unlocked position
        myServo.write(0);
        
        // Set LED indications
        digitalWrite(GreenLedPin, HIGH);
        digitalWrite(RedLedPin, LOW);
        delay(2000);
    }

    bell = digitalRead(BellButtonPin);
    if(bell == HIGH) // User pressed bell ring betton
    {
        // Signal Bolt that ring button was pressed
        digitalWrite(RingBellSignalPin, HIGH);

        // A calling bell sound pattern !
        digitalWrite(BuzzerPin, HIGH); 
        delay(100);
        digitalWrite(BuzzerPin, LOW);
        delay(20);
        digitalWrite(BuzzerPin, HIGH);
        delay(200);
        digitalWrite(BuzzerPin, LOW);
        delay(100);
        digitalWrite(BuzzerPin, HIGH);
        delay(100);
        digitalWrite(BuzzerPin, LOW);
        delay(20);
        digitalWrite(BuzzerPin, HIGH);
        delay(200);
        digitalWrite(BuzzerPin, LOW);
        delay(1500);

        // Turn off the signal
        digitalWrite(RingBellSignalPin, LOW);
    }

    lockButton = digitalRead(LockButtonPin);
    if(lockButton == HIGH) // User pressed lock betton
    {
        // Turn motor to locked position
        myServo.write(120);
        
        // Set LED indications
        digitalWrite(GreenLedPin, LOW);
        digitalWrite(RedLedPin, HIGH);

        // Buzz locking sound
        digitalWrite(BuzzerPin, HIGH);
        delay(1000);
        digitalWrite(BuzzerPin, LOW);
    }
}

Bolt IoT Cloud API - Client Library

This is an unofficial client library that I wrote, for communicating with the Bolt Cloud API. This library is used in our WinForms Application for communicating with the Bolt WiFi Module.

Credits

Divins Mathew

Divins Mathew

1 project • 13 followers

Comments