Skip to main content
Version: FILS English

Smart Home Devices

This project aims to automate basic home devices, mainly the main front door, based on the presence of the owner.

info

Author: Petre Teodora-Maria
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-dm-2025-730dora

Description​

This main focus of this project is to implement a Secure Access Smart Door system using the STM32 microcontroller and the Rust programming language. The main goal is to provide autonomous entry control: the door system activates when motion is detected and grants access only after a person provides the correct RFID scan. A servo motor manages the lock, and colored LEDs, along with a screen, provide feedback, displaying a personalized welcome message upon successful authentication.

Motivation​

Since I was little I used to make dollhouses out of cardboard, but I’ve always felt like something was missing. I wanted to make them as real as possible – functional lights, doors, almost everything that a real house has – but I didn’t know how to.

Architecture​

the architecture

  • STM32 - used for handling the logic of the project. It receives an interrupt from the PIR detector that a person is at the door which sends the RFID from an idle state to an active one.
  • PIR Motion Detector (HC-SR501) – detects the person approaching the door
  • RFID Reader Module – collects the security credentials for authentication
  • LEDs – provides immediate visual feedback for granted/denied access
  • Servomotor SG90 – mechanically closes and opens the door if the access is granted
  • LCD Screen – displays personalized β€œWelcome, [user’s name]” message upon successful entry
  • Photoresistor - inside the house after entry the photoresistor analyzes the state of the light and turns on a "main light" if necessary.

Week 5 - 11​

Put my idea on paper, drawings of hardware, design, connections to make it easier to follow later. idea

Week 12 - 18​

Bought the materials and started building.

Week 19 - 25​

Connected all the devices, finished and polished the code and finalized the setup (the house).

finalproject finalproject

Hardware​

how the wiring looks like

  • STM32 Microcontroller - the central processing unit, responsible for running the embedded Rust firmware, using PWM for motor control and SPI for the communication with the RFID module and the rest via GPIO pins

  • Servomotor SG90 - acts as the physical lock actuator, controlled via a PWM signal from the STM32 to precisely move the door mechanism between "locked" and "unlocked" positions

  • PIR Motion Detector (HC-SR501) - input device that triggers the security sequence by sending a digital signal to an STM32 GPIO pin when movement is detected

  • RFID Reader Module (RC522) - communicates via SPI to the STM32, reading credential data from passive RFID tags for secure user authentication

  • LEDs (Red/Green) - simple visual output indicators connected to GPIO pins, signaling "Access Granted" (Green) or "Access Denied" (Red)

  • LCD Screen - displays the personalized welcome message

Schematics​

kicadschematics

Bill of Materials​

DeviceUsagePrice
STM32 NUCLEO-U545RE-QThe microcontroller0 RON (borrowed)
SERVOMOTOR SG90The motor for the door20 RON
PIRMotion Sensor15 RON
RFIDReader Module20 RON
LEDsdenied/granted access visualisation & lightfrom an old kit
830 points BreadboardConnectivityalso from an old kit
Photoresistordetects the level of natural light outsidefrom the same old kit
16x2 I2C LCD DisplayThe "Welcome, user!" screenfree from the kit

Software​

LibraryDescriptionUsage
embassy-stm32Hardware Abstraction Layer (HAL) for STM32 microcontrollers. Provides async APIs for chip's peripheralsUsed to initialize the hardware, configure GPIO pins (LEDs, PIR), set up SPI for the RFID, I2C for the LCD, and ADC for the light sensor
embassy-executorAsync runtime for embedded systemsUsed Spawner to run the LDR and servo in the background while the main loop handles the RFID and PIR logic
embassy-timeTimekeeping, delays and timeoutsStop waiting if card isn't scanned fast enough & manage motor to open/close door
mfrc522Driver library for the MFRC522 RFIDGives the device the ability to read and write data from/to the card
lcd-lcm1602-i2cA driver for 16x2 LCD screens using the I2C interfaceTo send text commands like lcd.write_str("Welcome home") and clear the screen
embedded-hal-busembedded-hal provides traits for SPI and I2C buses and devicesUses ExclusiveDevice helper to ensure the RFID uses SPI pins alone
defmt-rttTransmit defmt log messages over the RTT (Real-Time Transfer) protocolUsed info! and error! to print messages to the terminal (via a debugger) while the code is running
panic-probeA panic handler that works with defmtIn case the code crashes, it catches it, print the error to console to avoid freezing
  1. The labs
  2. The Projects
  3. The Beautiful YouTube for PIR, RFID, LDR, LCD I2C 1602 and servo
  4. This man with his project