IoT Based Smart and Secure Lock V20

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

instructables

IoT Based Smart and Secure Lock V2.0

by make2explore

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 ngerprint based authentication.
Also we are going to use di erent 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.

Supplies:

Parts Required
1. NodeMCU ESP32 Development Board
2. RC522 RFID Reader Module
3. FPM10A Fingerprint Sensor
4. 3.5" Nextion Touchscreen HMI Display
5. MB102 Breadboard Power Supply module
6. 12V Solenoid Lock
7. 2 Channel Relay Board 5V
8. Batteries - 7.4V LiPo, 11.1V LiPo and Power Bank.

IoT Based Smart and Secure Lock V2.0: Page 1


IoT Based Smart and Secure Lock V2.0: Page 2
Step 1: ESP32 and MFRC522 RFID Interfacing

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

#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 nal code.

IoT Based Smart and Secure Lock V2.0: Page 3


Step 2: ESP32 and Fingerprint Sensor Interfacing

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 ngers data in Sensors memory.
It is recommended to enroll at least 4-5 templates (of one nger) for each user.
Also keep note of each users template numbers( Finger ID's). We'll require those to add authorized users
in nal code.

IoT Based Smart and Secure Lock V2.0: Page 4


Step 3: ESP32 and Nextion Display Interfacing

Important Points to Note before interfacing


Download Iteadlib Nextion library from its o cial 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 con gure the Nextion Library for use with the ESP32. It is
precon gured for the ATMega 2560. We need to do some changes.
ESP32 have 3 Hardware serial ports.
In this project(in nal 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 con g open and edit NexCon g.h, and locate following line
#define DUBUG_SERIAL_ENABLE

and ensure that it is not commented out.

IoT Based Smart and Secure Lock V2.0: Page 5


Then, locate the line de ning nexSerial

#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 con gure the baud rate for Serial Monitor and Nextion. as shown
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’ le of nextion library.

#include<softwareserial.h>

Or you can just renamenexupload.cppand nexupload.h les 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.

IoT Based Smart and Secure Lock V2.0: Page 6


Step 4: Main Circuit Diagram

Step 5: Demonstration

In this video we've given detailed step wise explanation to build and implement this project.

https://youtu.be/X8uOJ63XOb8

Step 6: Documentation

Project Source code, Schematics and all Nextion Display design les are available on following GitHub Repo
https://github.com/make2explore/IoTbasedLockV2.0
Project's improvement suggestions, Bugs, Queries and solutions are most welcomed.

IoT Based Smart and Secure Lock V2.0: Page 7

You might also like