We are two students from UniLaSalle Amiens, and we had the opportunity to carry out a year-end project. To complete this project, we were given 50 hours. The project had to combine software development, electronics, and 3D modeling.
Have you ever noticed how often outsiders enter your school? Have you ever seen someone lend their badge to a friend so they can access a building? Thus, we came up with the idea of creating a highly secure smart lock!
This is how Secura was born!
With Secura, this will no longer be possible, and your school, building, home, or any other place will remain protected 24/7!
But how does this lock work?
General Functioning :The operation is very simple: Badge, Enter the code, and Walk in!
To gain access, you must have an RFID badge. Once you have your badge, scan it in front of the RFID sensor. If your badge is recognized, a code will be sent to your Secura mobile app. Once you receive the code, enter it on the keypad. If the code is correct, you can enter !
But let's take a closer look at how we developed this project.
Arduino :First, we used a Sodaq 2483, which provides LoRa connectivity, playing a crucial role in our project.
Next, we integrated an RFID module to scan badges. Once a badge is scanned, its UID is sent to TTN.
At the same time, an LCD screen is used to guide the user by displaying instructions and feedback. The screen first shows "Please scan your badge", then displays the UID of the recognized badge. If the badge is found in the database, the screen will prompt the user to enter the code, display the entered code, and finally indicate whether access is granted or denied.
The code is entered using a matrix keypad.
Finally, the electromagnetic lock will unlock if the correct code is entered; otherwise, it will remain locked.
TTN :To bridge the mobile application, our server, and Arduino, we used The Things Network (TTN).We configured it in OTAA (Over-the-Air Activation), and initially, we made sure to receive the UID of the badge on TTN to later send it to our web server.
This means we first configured the uplinks. Then, once the server processed the UID, we set up the downlinks to receive the secret code on the Sodaq.
FLASK SERVER :For the smooth functioning of our project, we set up a Python server, coded with the Flask framework. It integrates a web server for administrators and Secura users.This website allows administrators to scan a badge and retrieve its UID in order to register it when adding a new user. They can also add a user to the database, granting them a badge. Additionally, it provides access to a dashboard that shows the names and surnames of people who have scanned their badges, the doors they accessed, and the times of their entries.The administrator can thus control the entire flow of entries and exits from the building.This website was coded in HTML, CSS, JavaScript, and Flask.We also implemented security measures on the site, such as requiring a minimum number of characters for passwords, mandatory valid email addresses, and preventing access to pages without being logged in.
The server also allows us to receive the UIDs of scanned badges. Once received, the server accesses the user database to check whether the badge's UID is present or not.If it is not present, a message is sent to TTN, indicating the badge is not found, and the LCD screen displays a message saying that the user was not found.If it is present, the server generates a secret code using an algorithm that performs an operation with a secret key, a randomly generated number, and a mix of the result.This code is then sent to TTN, which forwards it to the Sodaq as well as the user's mobile app.The user simply needs to enter the code, and the Sodaq will verify whether the code is correct to grant access.
APPWRITE :To store all the information of badge holders and administrators, we used an API called Appwrite. It is an online database that can be modified both via the web and through programming. Naturally, we opted for the latter for this project.
We created two databases: one for administrators to filter access to the website, and one for users, which allows us to verify their registration and display all relevant information about them in the dashboard when they scan their badge.
Mobile application :
The Secura mobile application is a security solution that enables users to receive temporary codes when they scan their RFID badge. It is based on React Native with Expo, Appwrite for authentication and database, and Socket.IO for real-time communication.
Main features :
Authentication (Appwrite)
- Registration and login via email and password.
- Save the UID badge linked to each user.
- Persistent session via Appwrite: if the user has an active session, he/she is automatically reconnected.
- Manual logout available via a button on the home page.
Persistent session
- When the app is launched, Appwrite automatically checks for an active session (checkSession).
- If a session is found, redirection to / home with the user loaded in the global context.
- Otherwise, redirection to / sign-in.
Real-time code reception(WebSocket)
- Connection to a Flask server via Socket.IO at the address defined by NGROK (SERVER_URL).
- When a code is issued (after badge scan via
TTN), the app receives a code event.
- The UID of the received badge is compared with that of the connected user (retrieved via Appwrite).
- If a match is found, the code is displayed to the user for 10 seconds.
Global user context
- UserContext contains user and setUser, used everywhere to access session info.
- Allows access to email, badge UID, etc., without additional requests.
Key file structure :
appwrite.js
- Contains the Appwrite configuration and all management functions:
- signIn, logout, getUIDByEmail, checkSession, createUser, etc.
- Uses Appwrite SDK to create and manage sessions and documents in the database.
RootLayout.js
- Root component loaded at app launch.
- Checks whether an Appwrite session is active.
- Redirects to / home or / sign-in as appropriate.
- Manages global loading status (isLoading).
Signin.js
- Login form with email and password fields.
- On success, redirects to / home and updates UserContext.
Home.js
- Displays the name of the connected user (email).
- Displays the code received if valid, with a 10-second countdown.
- Logout button.
- Connects to Socket.IO to receive codes.
3D modeling :
To create the structure, we chose fusion 360 CAD software.
The principle was very simple. Put everything we needed for the project into a box that simulated the opening of a door.
The structure is made up of 3 parts for ease of 3D printing. Connections were made between the left and middle parts. Inserts are provided to connect the middle part with the right. Holes for threaded inserts have been made to fix the different parts.
A screen cover has been modeled to cover the screen parts, and holes have also been made to let dupont cables pass through.
3D components have been integrated into the model for greater precision.
Conclusion :Through this project, we were able to combine software development, electronics, and 3D modeling to bring Secura to life. Over the course of 50 hours, we designed a highly secure smart lock that ensures controlled access using RFID technology, a dynamic authentication system, and real-time communication between devices.
From hardware integration with Arduino and LoRa connectivity, to a Flask-based web server and a React Native mobile app, every component played a crucial role in achieving a seamless and secure experience. The 3D-printed casing, designed with Fusion 360, provided a practical and functional structure for the system.
With Secura, unauthorized access becomes a thing of the past. Whether for schools, businesses, or homes, this innovative smart lock guarantees 24/7 protection. This project allowed us to apply our technical skills, problem-solving abilities, and creativity to develop a real-world security solution—one that could make a real impact!
Comments
Please log in or sign up to comment.