Fingerprint scanner sensors are used at many places like Industries, Offices, Schools, Colleges and Hotels. By embedding IoT with the Fingerprint sensor, we can elevate the Fingerprint-based security system project to the next level.
So in this project tutorial, we are going to build and IoT Based Biometric Security System using the GT5111C3 fingerprint sensor, NodeMCU and Solenoid lock. Adafruit IO is used to save the entry details online while IFTTT is used to send the Email notifications when an unauthorised person scans the finger on the fingerprint sensor.
COMPONENTS REQUIRED- NodeMCU ESP8266
- GT511C3 Fingerprint Sensor
- Solenoid Lock
- Relay Module
- Buzzer
- 12V Adapter
- Jumper Wires
- Breadboard
GT511C3 Fingerprint Sensor Module
The GT-511C3 Fingerprint Scanner Sensor module consists of an optical sensor mounted on a small circuit board. The optical sensor scans a fingerprint and ARM Microcontroller coupled with EEPROM processes the scanned fingerprint. GT-511C3 module can store 200 fingerprints. Each fingerprint is saved with a different ID. Operating voltage for GT-511C3 is from 3.3V to 6V.
Solenoid Lock
Solenoid lock work on the electronic-mechanical locking mechanism. This solenoid lock has a slug with a slanted cut and a good mounting bracket. In normal conditions slug remains outside the bracket but when DC voltage is applied slug moves inside the bracket. Ideal Operating voltage for the solenoid lock is 12V. It can be used with 9V, but it results in slower operation.
IOT BIOMETRIC SECURITY SYSTEM CIRCUIT DIAGRAMThe circuit for IoT based Biometric Security System consists of a NodeMCU, GT511C3 Fingerprint Sensor, Solenoid Lock, Relay Module and Buzzer. VCC and GND pin of Fingerprint sensor are connected to 3.3V and GND pin of NodeMCU while TX and RX pins are connected to D6 and D5 pins of NodeMCU. Positive pin of the buzzer is connected to D2 pin of NodeMCU, and the negative pin is connected to GND of NodeMCU. The solenoid lock is connected to NodeMCU through the relay module. The NodeMCU and Solenoid Lock both are powered with 12V Adapter.
Adafruit IO Setup
Adafruit IO is an IoT platform that allows you to visualise, and analyse live data on the cloud. Using Adafruit IO, you can control motors, read sensor data, and make cool IoT applications over the internet. In this project, we are sending the Entry details to Adafruit IO Dashboard.
- To send data to, you need to create on Adafruit IO if you don’t have one. For this, navigate to Adafruit IO website and click on ‘Get started for Free’ on the top right of the screen.
Adafruit username and AIO key are required to send data to Adafruit IO. For that click on ‘View AIO Key’ on the top right corner to get your account username and AIO key
After getting the AIO key, create a feed. For that click on ‘Feeds.’ Then click on ‘Actions, ’ you will see some options from them click on ‘Create a New Feed.’
All your data will be stored in this feed. You can also create an Adafruit IO dashboard for customised visualisation of your data.
IFTTT Setup
Here we are using IFTTT to send Email notifications when an unauthorised person scans his finger on the fingerprint sensor. IFTTT (If This Then That) is a web-based service by which we can create chains of conditional statements, called applets. Using these applets, we can send Emails, Twitter, Facebook notifications.
To use the IFTTT sign in to your IFTTT account if you already have one or create an account.
Now search for ‘Webhooks’ and click on the Webhooks in Services section.
Now, in the Webhooks window, click on ‘Documentation’ in the upper right corner to get the private key.
Copy this key. It will be used in the program.
After getting the private key now, we will create an applet using Webhooks and Email services. To create an applet, click on your profile and then click on ‘Create.’
Now in the next window, click on the ‘This’ icon.
Now search for Webhooks in the search section and click on ‘Webhooks.’
Now choose ‘Receive a Web Request’ trigger and in the next window, enter the event name as login_event and then click on create trigger.
After this, click on ‘Then That’ and then click on Email.
Now in Email, click on ‘send me an email’ and enter the email subject and body and then click on create action.
How to Enrol a Fingerprint
Before programming the NodeMCU for Fingerprint based security system we first have to enrol fingerprints into GT511C3 fingerprint sensor. For that download the FPS_GT511C3 library and add it to your Arduino IDE.
After that restart your IDE and go to File > Example > Fingerprint Scanner TTL > FPS_Enroll
Upload the FPS_Enroll program into your NodeMCU.
IOT BASED BIOMETRIC SECURITY SYSTEM ARDUINO CODE EXPLANATIONIn this project, NodeMCU is programmed using the Arduino IDE. So, make sure you have downloaded NodeMCU board files in Arduino IDE. If you are new to this and don’t know how to install the NodeMCU board files in Arduino IDE, then follow this article.
Programming NodeMCU Using Arduino IDE
Complete code for IoT Based Biometric Security System is given at the end of the page.
Start the code by including all the required library files. Here the FPS_GT511C3 library is used for the Fingerprint module, and Adafruit MQTT library is used for MQTT communication between NodeMCU and Adafruit IO.
#include "FPS_GT511C3.h"
#include "SoftwareSerial.h"
#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
After that enter the Wi-Fi credential and password with the Adafruit IO username, AIO Key and IFTTT Private key.
const char *ssid = "Galaxy-M20"; // Enter your WiFi Name
const char *pass = "ac312124"; // Enter your WiFi Password
#define MQTT_SERV "io.adafruit.com"
#define MQTT_PORT 1883
#define MQTT_NAME "Enter Your Adafruit IO Username"
#define MQTT_PASS "Enter the AIO Key"
const char *host = "maker.ifttt.com";
const char *privateKey = "Enter the IFTTT Key";
Set up the feed you're publishing to. Here ‘Fingerprint is the feed name’, change it with your feed name.
Adafruit_MQTT_Client mqtt(&client, MQTT_SERV, MQTT_PORT, MQTT_NAME, MQTT_PASS);
Adafruit_MQTT_Publish Fingerprint = Adafruit_MQTT_Publish(&mqtt, MQTT_NAME "/f/Fingerprint");
Inside the void loop function check the scanned fingerprint and if it matches with the enrolled fingerprint then open the solenoid lock and publish the person’s name on the Adafruit IO dashboard.
if (id ==7) //<- change id value depending model you are using
{
Serial.print("Ashish Entered");
Buzzer();
digitalWrite(relay, HIGH);
delay(6000);
digitalWrite(relay, LOW);
msg = "Ashish Entered";
msg.toCharArray(msg1, 20);
if (! Fingerprint.publish(msg1))
{
//delay(7000);
}
}
else if (id ==8)
{
Serial.print("Manoj Entered");
Buzzer();
digitalWrite(relay, HIGH);
delay(6000);
digitalWrite(relay, LOW);
msg = "Manoj Entered";
msg.toCharArray(msg1, 20);
if (! Fingerprint.publish(msg1))
{
}
}
And if the scanned fingerprint doesn’t match with enrolled fingerprint then send an email to the mentioned email address using the IFTTT trigger.
else
{//if unable to recognize
send_event("login_event");
Serial.println("Finger not found");
for(int I = 7; I > 0; i--){
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(100);
}
TESTING THE IOT BASED BIOMETRIC SECURITY DOOR LOCK PROJECTOnce the Code and Hardware are ready, we can check if everything is working or not. Upload the code to NodeMCU and connect it to Adapter. Now, wait for Wi-Fi connection. Once the NodeMCU connects to the Wi-Fi, scan your finger on the fingerprint sensor. If the finger is enrolled, then it will open the lock with a beep sound, and it will send a message with the person’s name to Adafruit IO. And if the finger isn’t enrolled, then it will send an email to the associated email address that an unauthorised person tried to enter.
Comments