This is an old revision of the document!
! Version: 11.05 - 1st assigment version. Work was started on the other milestones as well but it is yet unfinished ! Done: general details, hardware implementation and most of the software implementation.
! Version 21.05 - 2nd milestone - full functionality achieved. !
Smart Locker is a solution for securing valuable items coming in the form of a lockable safe.
Smart Locker is a solution for securing valuable items coming in the form of a lockable safe - similar to the EasyBox lockers, which also were the inspiration for this project.
Mainly, this locker is designed to secure various items. Nevertheless, the circuit can be easily adapted (due to it's mechanism) to lock/unlock doors, drawers or so on.
Functionality TLDR:
To implement the project in a physical format, a servo motor is used which performs the opening/closing of the door. A toothed wheel was attached to this motor to create a mechanism together with a rack. In this way, the rotational motion from the motor is used to move the lock to the correct position. To actuate the servo motor, and thus open the door, a keypad is added, through which the user can enter the correct password, as well as an RFID card communication module, where, using the correct card, the door can be opened.
The locking mechanism rests against a weight sensor - if the door is forced (i.e high weight reading), the buzzer is triggered.
The alarm system is activated if the door is forced or 3 incorrect passwords have been entered consecutively or the wrong card has been used 3 times, or a combination of these two events, with the user having three attempts to open the door. Once the alarm system is activated, a buzzer will emit a loud audible signal, which can only be stopped by using the correct RFID card.
Servo Motor
RFID Module (RC522)
Load Cell
Buzzer
I2C Bus
Power Connections VCC (5V)
GND
State Machine: The core logic is driven by the currentState variable, which can be one of the following:
The loop() function continuously checks for RFID card presence and reads the keypad. Based on the current state and the input received, it transitions to other states and performs corresponding actions.
Important Functions setup(): Initializes all the peripherals (LCD, servo, buzzer, keypad, RFID) and sets the initial state of the door lock. loop(): The main execution loop that handles state transitions, reads sensors and input devices, and performs actions based on the current state. handleIdleState(): Manages the PIN entry process via the keypad, checks the entered PIN against the stored password, and handles locking/unlocking or triggering the alert state. unlockDoor(): Controls the servo motor to the unlocked position. lockDoor(): Controls the servo motor to the locked position. isMasterCard(): Checks if the scanned RFID card's UID matches the masterUID. isUserCard(): Checks if the scanned RFID card's UID matches the userUID. Why Were the Libraries Used? The code utilizes several libraries to simplify interaction with the hardware components:
<Servo.h>: This library provides functionalities to control servo motors. It's used here to move the servo that controls the door lock. <Wire.h>: The Wire library allows communication with I2C devices. It's essential for communicating with the I2C-based Liquid Crystal Display (LCD). <LiquidCrystal_I2C.h>: This library provides a convenient way to control I2C-based LCDs, making it easy to display text and information to the user. <Keypad.h>: This library simplifies reading input from a matrix keypad. It handles the scanning of rows and columns to detect which key is pressed. <SPI.h>: The SPI (Serial Peripheral Interface) library is used for communication with devices that use the SPI protocol, such as the MFRC522 RFID module. <MFRC522.h>: This library provides functions to interact with the MFRC522 RFID reader/writer module, allowing the system to read RFID card UIDs. These libraries abstract away the low-level details of hardware communication, making it easier to develop the application logic. For instance, instead of manually sending I2C commands to the LCD, the LiquidCrystal_I2C library provides functions like lcd.print() and lcd.setCursor(). Similarly, the Keypad library handles the complexities of reading a matrix keypad, returning the pressed key directly. The MFRC522 library simplifies the process of detecting and reading data from RFID cards.
11th of May - started initial wiring of the components to check basic functionalities.
14th of May - finished wiring and torture of the sacrificed shoebox.
1. Frontal view.
2. Interior view
3. This is the mechanism that prevents the use of brute force - an weight sensor is placed above the locking mechanism.
4. Interior overview.
5. Final version - 21st of May