IoT Based Smart and Secure Lock V2.0

0 1112 Medium

In this project we've built IoT based smart and secure lock which have 4 layers of access. RFID + PIN + Fingerprint + OTP.

projectImage

Things used in this project

 

Hardware components

HARDWARE LIST
1 DFRobot Fingerprint Sensor
1 Espressif ESP32 Development Board - Developer Edition
1 Itead Nextion NX4832T035 - 3.5" HMI TFT LCD Touch Display Module
1 MB102 Breadboard Power Supply module
1 12V Solenoid Lock
1 2 Channel Relay Board 5V
1 Batteries - 7.4V LiPo, 11.1V LiPo and Power Bank.

Software apps and online services

 

Microsoft VS Code

 

PlatformIO IDE

 

Arduino IDE

Story

 

In this project we've built IoT based smart lock which have 4 layers of access. RFID + PIN + Fingerprint + OTP. We have slightly upgraded our previous version of the project. In this version we are going to add one more accessibility layer. That is biometric, means, we've added fingerprint based authentication.

 

-Also we are going to use different MCU development Board. In version 1 we have used Particle Photon Board, but in this project we will use ESP32 development board.

 

-So now, if user want to unlock this lock, then he or she should have Valid RFID, Fingerprint, PIN and OTP, means one time password.

 

-Also we have programmed this lock system to keep record data of user entries with user name and timestamp. This data will recorded on our dedicated mySQL database which is hosted on our webserver, hence the system Administrator can login to that web portal and, keep track of how many time this lock got opened.

 

-NextionTouchscreen HMI Display is used for interacting with this door lock.

 

 

Step 1: ESP32 and MFRC522 RFID Interfacing

projectImage

Connect the components as shown in circuit diagram.

 

-Then install the latest Arduino IDE (if previously not install on your system)

 

-Install ESP32 Board core into an Arduino IDE - Video Tutorial

 

-Install MFRC522 library from Arduino IDE library manager

 

-use Dumpinfo sample code from library to check the working of interfacing

 

-In code, make sure to change the SS and RST pins as

CODE
#define SS_PIN 21       /*SDA/SS Pin of RFID Reader*/ 
#define RST_PIN 22      /*RESET Pin of RFID Reader*/

Using this example (Dumpinfo), get the UID's of RFID cards/Tags. Note them down. We'll require those to add authorized users in final code.

Step 2: ESP32 and Fingerprint Sensor Interfacing

projectImage

Connect the components as shown in circuit diagram.

 

-Then install the latest Arduino IDE (if previously not install on your system)

 

-Install ESP32 Board core into an Arduino IDE - Video Tutorial

 

-Install Adafruit-Fingerprint-Sensor-Library from Arduino IDE library manager

 

-use enrollsample sketch from library to check the working of interfacing

 

-Use this sketch to enroll correct authorized fingers data in Sensors memory.

 

-It is recommended to enroll at least 4-5 templates (of one finger) for each user.

 

-Also keep note of each users template numbers(Finger ID's). We'll require those to add authorized users in final code.

Step 3: ESP32 and Nextion Display Interfacing

projectImage

Important Points to Note before interfacing

 

-Download Iteadlib Nextion library from its official website. or Repository

 

-Install the Nextion Library in the Arduino IDE

 

-- You can use method of adding zip library -- Sketch > Include Library > Add.ZIP Library

 

-Before using Nextion library, we need to configure the Nextion Library for use with the ESP32. It is preconfigured for the ATMega 2560. We need to do some changes.

 

-ESP32 have 3 Hardware serial ports.

 

-In this project(in final circuit), we have connected Nextion display to Serial1 and Fingerprint sensor to Serial2

 

-So we'll use as as following

 

- dbSerial enabled --- (To get the debug messages ON on Serial)

 

- nexSerial to use our hardware serial i.e Serial1

 

- Fingerprint sensor to Serial2

 

To do above config open and edit NexConfig.h, and locate following line

CODE
#define DUBUG_SERIAL_ENABLE

and ensure that it is not commented out.

 

-Then, locate the line defining nexSerial

CODE
#define nexSerial Serial1

ensure it is Serial1 (pins GPIO09/GPIO10)

 

-Then next, Edit NexHardware.cpp to change the baud rates.

 

locate the nexInit() function, here we configure the baud rate for Serial Monitor and Nextion. as shown

CODE
dbSerial.begin(115200);
nexSerial.begin(9600);

Finally, Arduino's AVR Software serial is not compatible with Nextion, It throws errors. So we have to comment out following line from ‘Nexupload.cpp file of nextion library.

CODE
#include<softwareserial.h>

-Or you can just renamenexupload.cppand nexupload.h files from Nextion library folder itself with any other extensions like e.g nexupload.txt

 

-Among above two workarounds any one will bypass the nexupload error of nextion library.

 

To know more about how to get started with with Nextion display, refer this video, there we have explained how use Nextion IDE and how to upload GUI to Nextion HMI Touchscreen Display etc.

Step 4: Main Circuit Diagram

projectImage

Demo

Project Source code, Schematics and all Nextion Display design files are available on following GitHub Repo

 

Project's improvement suggestions, Bugs, Queries and solutions are most welcomed.

Schematics

icon IoTbasedLockV2.0-main.zip 4.61MB Download(0)

Code

icon iot_based_smart_secure_lock_v2.zip 5KB Download(0)
icon IoTbasedLockV2.0-main (1).zip 4.61MB Download(0)

The article was first published in hackster, April 5, 2022

cr: https://www.hackster.io/make2explore/iot-based-smart-and-secure-lock-v2-0-cfd6af

author: make2explore

License
All Rights
Reserved
licensBg
0