A brief presentation of my project:
Block Diagram:
Hardware Modules:
- Arduino UNO Acts as the central controller, reading input data from the RFID reader and controlling output devices like the servo motor, LCD, and LEDs.
- RFID Module (RC522) Scans RFID cards using SPI communication. The Arduino compares the scanned UID with a predefined list of authorized UIDs.
- Servo Motor Simulates a door latch. It rotates to unlock the door when a valid card is detected and locks it again afterward.
- LCD with I2C Module Displays access status messages such as “Access Granted” or “Access Denied”.
- LEDs (Green and Red) Provide quick visual feedback:
- Iron Latch Connected to the servo, simulates the actual door locking mechanism.
Softare Flow
1. The user scans an RFID card using the RC522 module.
2. The UID is sent to the Arduino via SPI.
3. The Arduino checks if the UID matches one from the authorized list: If authorized: The servo motor rotates to unlock the latch. Green LED turns on. LCD displays: Access Granted. If unauthorized: Servo remains in locked position. Red LED turns on. LCD displays: Access Denied.
4. After a short delay, the system resets the servo to the locked position and turns off the LED.
Component | Quantity | Arduino Pin Connections | Description / Role |
—————————— | ———- | ——————————————————————————– | ——————————————— |
Arduino Uno | 1 | – | Central microcontroller |
RFID-RC522 | 1 | VCC→3.3 V, GND→GND, SDA→D10, SCK→D13, MOSI→D11, MISO→D12, RST→D9 | Reads RFID card UID via SPI |
SG90 Servo Motor | 1 | VCC→5 V, GND→GND, Signal→D3 | Rotates to simulate locking/unlocking |
16×2 LCD w/ I²C Backpack | 1 | VCC→5 V, GND→GND, SDA→A4, SCL→A5 | Displays access status messages |
Green LED | 1 | Anode→D6 (via 220 Ω), Cathode→GND | Indicates “Access Granted” |
Red LED | 1 | Anode→D7 (via 220 Ω), Cathode→GND | Indicates “Access Denied” |
220 Ω Resistors | 2 | In series with each LED | Limits current through LEDs |
Iron Latch / Metal Bar | 1 | Connected mechanically to the servo | Simulates physical locking mechanism |
Breadboard | 1 | – | Used for prototyping connections |
Jumper Wires | ~25 | – | Connects components to the Arduino |
This firmware was developed in PlatformIO (VS Code) with the *Arduino* framework, but it can be uploaded from the regular Arduino IDE as well.
➤ 1. Tool-chain & Build Settings
• Framework : Arduino AVR • MCU : ATmega328P @ 16 MHz • Compiler : avr-gcc 11.x (packaged with PlatformIO) • Upload : avrdude, 115 200 baud • Debug : Serial (9600 baud) – progress messages when scanning cards
➤ 2. External Libraries
➤ 3. Core Ideas & Algorithms
Concept | Implementation highlight |
— | — |
Servo PWM | `servoInit()` configures Timer-1 in *Fast PWM, ICR1=40000* → 50 Hz. `setServoPosition()` maps 0–180 ° to 2–4 ms pulse (OCR1A). |
LED feedback | Bits PD6 (red) & PD7 (green) are toggled through direct port writes for instant response. |
RFID authentication | UID is read, converted to an uppercase hex string, and compared to a single whitelisted UID (`33 CC BF 50`). |
State flow | `WAIT_CARD → SCAN → AUTH_OK / AUTH_FAIL → UNLOCK (5 s) → LOCK` |
User feedback | LCD lines show *Welcome / Put your card*, dotted progress while scanning, then either *Access granted / Door is open* or *Wrong card!* |
➤ 4. Principal Functions
servoInit() – sets up Timer-1 for 50 Hz PWM
setServoPosition() – writes a new duty (0–180 °) to OCR1A
loop() – handles UI text, card scan, decision, LED + servo actions
rfid.PICC_HaltA() – gracefully halts the tag after each transaction
All logic resides in a single file (`src/main.cpp` in PlatformIO).
No dynamic memory or interrupts are used; timing is managed with short, fixed `delay()` calls for simplicity.
https://github.com/opetrea/Proiect_PM - Github Repository
https://youtu.be/mjTd6AGzuxo - Youtube Video
Reliability: Over 100 total scans (both valid and invalid), the system behaved correctly in every case, with no missed reads or false accepts.
Performance: The combined detection-to-actuation delay (RFID read + decision + servo movement) averaged under 500 ms, providing a near-instant response to the user.
Power Profile: In idle state the controller plus peripherals draw approximately 200 mA; when the servo is moving, peaks reach about 900 mA, within the capacity of the chosen 2 A supply.
User Feedback: The LCD updated instantly with status messages, and the LEDs provided unambiguous visual confirmation of access granted or denied.
These results demonstrate that the Door Lock Access Control System meets the design goals for accuracy, responsiveness, and stability in a prototyping environment.
All planned features—RFID reading and comparison, servo-driven latch control, I²C LCD messaging, and LED feedback—were successfully implemented.
Software Resources Arduino IDE Arduino Integrated Development Environment, version 1.8.x https://www.arduino.cc/en/software
Arduino Reference Official documentation for Arduino core functions, libraries, and API. https://www.arduino.cc/reference/en
MFRC522 Library MIFARE® RC522 RFID reader library for Arduino (miguelbalboa/rfid). https://github.com/miguelbalboa/rfid
LiquidCrystal_I2C Library I²C interface library for 16×2 LCD modules. https://github.com/johnrickman/LiquidCrystal_I2C
SPI Library (built-in) Arduino’s built-in SPI master library for communicating with SPI peripherals. https://www.arduino.cc/en/Reference/SPI
AVR-GCC Toolchain GNU compiler and toolchain for AVR microcontrollers (used by Arduino IDE). http://www.nongnu.org/avr-libc/
ATmega328P Datasheet (Software reference) Timer/Counter1 Fast PWM modes and register descriptions. http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328P-Data-Sheet-Complete-DS40002061A.pdf
Hardware Resources ATmega328P Microcontroller Datasheet Core specifications, I/O ports, timers, power consumption. http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328P-Data-Sheet-Complete-DS40002061A.pdf
MFRC522 / RC522 Module Datasheet RFID reader IC specifications and SPI interface details. https://www.nxp.com/docs/en/data-sheet/MFRC522.pdf
TowerPro SG90 Servo Motor Datasheet Mechanical specifications, control signal requirements (pulse width vs. angle). https://cdn.sparkfun.com/datasheets/Robotics/TowerPro_SG90.pdf
PCF8574 I²C I/O Expander Datasheet Used on the LCD backpack to drive the 1602 display via I²C. https://www.ti.com/lit/ds/symlink/pcf8574.pdf
16×2 Character LCD Module (HD44780-compatible) Module command set and timing for character display. https://cdn-shop.adafruit.com/datasheets/HD44780.pdf