Skip to main content
Version: ACS CC

Smart Access Control System

info

Author: Popescu Carla-Indira
GitHub Project Link: https://github.com/UPB-PMRust-Students/acs-project-2026-indira1505

Description

A laser-based smart access control system built on the Nucleo-STM32U545RE-Q board, programmed in Rust using the Embassy async framework. The system uses a KY-008 laser module aimed at an LDR photoresistor to detect intrusions. When the beam is interrupted, a red LED and an active buzzer are triggered as an alarm. Access control is handled via an RC522 RFID module — scanning a valid MIFARE card grants a 5–10 second window during which the laser can be interrupted without triggering the alarm. Scanning an invalid card three consecutive times locks the system and activates a continuous alarm, which can only be silenced by an admin-level card. All status messages (cardholder name, "Access Granted", "Access Denied") are displayed on an SSD1306 OLED screen.

Motivation

I was inspired by a YouTube video of an analog laser alarm circuit and wanted to recreate it in a more modern, complex, and functional way using embedded Rust. The project gave me the opportunity to explore real-time embedded programming with Rust and Embassy, while building something visually striking for a live presentation. Unlike a simple PIR motion sensor, the laser beam creates a clear, visible security barrier that makes the demo immediately understandable and impressive. The added RFID access control layer transforms a simple alarm into a complete, realistic security system.

Architecture

Arhitectura sistemului

The Nucleo-STM32U545RE-Q is the central control unit, coordinating all components through an async state machine implemented in Embassy:

  • The KY-008 laser module emits a continuous red beam (650nm, 5V) aimed at the LDR photoresistor. The LDR value is read via ADC and compared against a baseline calibrated at startup. A sudden drop in value signals beam interruption.
  • The RC522 RFID module communicates via SPI at 3.3V. It reads MIFARE Classic 1K card UIDs, which are matched against a hardcoded list of authorized users and admin cards.
  • The SSD1306 OLED display (128x64px) communicates via I2C and shows real-time system status: idle, access granted/denied, alarm active, or system locked.
  • The red LED signals an active alarm; the green LED signals a successful access grant or system idle state.
  • The active buzzer, driven by a BC547 NPN transistor (controlled via GPIO at 3.3V, powered at 5V), sounds the alarm when triggered.

The system operates as a state machine with the following states:

  • IDLE — laser active, monitoring
  • ACCESS_GRANTED — valid card scanned, grace period active (5–10s)
  • ALARM — beam interrupted without valid access
  • LOCKED — 3 consecutive invalid card scans, continuous alarm until admin card scanned

Log

Week 5 - 11 May

Week 12 - 18 May

Week 19 - 25 May

Hardware

ComponentQuantityUsage
Nucleo-STM32U545RE-Q1Main microcontroller
KY-008 Laser Module1Emits the laser beam (650nm, 5V)
LDR Photoresistor (5528)1Detects laser beam interruption via ADC
RC522 RFID Module1Reads MIFARE cards via SPI
MIFARE Classic 1K Cards51 admin + 3 users + 1 invalid test card
SSD1306 OLED Display (0.96")1Displays system status via I2C
Active Buzzer (5V)1Sounds the alarm
BC547 NPN Transistor1Drives the buzzer from 3.3V GPIO
Red LED (5mm)1Alarm indicator
Green LED (5mm)1Access granted / system OK indicator
Tactile Push Buttons (6x6mm)3Manual reset during testing
Resistor 220Ω2LED current limiting
Resistor 1kΩ1BC547 base protection
Resistor 10kΩ2LDR voltage divider + button pull-down
Breadboard (830 points)1Prototyping
Jumper wires (M-M, M-F)~50Connections

Schematics

Bill of Materials

DeviceUsagePrice
Nucleo-STM32U545RE-QMicrocontroller(owned)
KY-008 Laser ModuleLaser emitter3.15 RON
LDR Photoresistor 5528 (set of 5)Light sensor14.14 RON
RC522 RFID Module + card + tagAccess control20.75 RON
MIFARE Classic 1K Cards (x3)Access cards15.00 RON
SSD1306 OLED 0.96" I2CStatus display31.99 RON
Active Buzzer 5VAlarm sound14.96 RON
BC547 NPN Transistor (x3)Buzzer driver11.10 RON
LED Kit 200 pcs (red + green)Visual indicators30.25 RON
Tactile Push Buttons (set of 25)Manual reset37.50 RON
220Ω Resistors (set of 10)LED protection~5.00 RON
1kΩ Resistors (set of 10)Transistor base~5.00 RON
10kΩ Resistors (set of 20)LDR voltage divider~5.00 RON
Breadboard 830 pointsPrototyping10.00 RON
Jumper wires 65 pcsConnections10.16 RON
Cable set 40x10cmConnections24.90 RON

Software

LibraryDescriptionUsage
embassy-stm32STM32 async HALGPIO, SPI, I2C, ADC peripheral access
embassy-executorAsync executorConcurrent task management
embassy-timeAsync timersGrace period timing, debounce
embedded-halHardware Abstraction LayerPortable hardware interface traits
ssd1306OLED display driverRendering text and status messages
mfrc522RFID driverReading MIFARE Classic 1K card UIDs
embedded-graphics2D graphics libraryText rendering on OLED display
  1. Embassy Framework Documentation
  2. STM32U545RE Reference Manual
  3. ssd1306 crate documentation
  4. mfrc522 crate documentation
  5. Inspiration: Analog Laser Security Alarm (YouTube)