Skip to main content
Version: FILS English

Smart Door

A Raspberry Pi Pico 2 W based door security system.

info

Author: Octavian Mihai Cretu
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-octavian2411

Description

This project aim is to develop a smart door lock system powered by a Raspberry Pi Pico 2 W. It uses a fingerprint sensor to authenticate users, a servo motor to simulate locking and unlocking the door, and a buzzer to signal access. An LED display shows real-time status messages, while an ultrasonic sensor monitors the door's open or closed state. The system combines biometric security with sensor-based monitoring to create an interactive and responsive door locking simulation.

Motivation

I chose this project because I’ve always found fingerprint matching really interesting. The idea that you can use something as unique as a fingerprint to unlock a door seemed like a fun and useful concept to explore. I wanted to learn how to use a fingerprint sensor with a microcontroller and see how everything works together. This project also lets me combine different parts like a servo motor, buzzer, LED display, and ultrasonic sensor to create a full system. By using the Raspberry Pi Pico 2 W programmed in Rust, I’m gaining a better understanding of how Rust works in embedded systems, especially with its concurrency features, and async behavior for handling multiple tasks efficiently.

Architecture

Architecture photo

  1. Authentication Module

    • Handles fingerprint scanning and matching.
    • Communicates with the fingerprint sensor over UART.
    • Sends authentication results (success/failure) to the Control Module.
  2. Control Module

    • Core decision-making unit of the system.
    • Receives input from the Authentication Module and Sensor Interface.
    • Controls actuators (servo, buzzer) and updates the display.
    • Manages system states such as Locked, Unlocked.
  3. Sensor Interface

    • Reads distance data from the ultrasonic sensor using GPIO.
    • Determines if the door is open or closed.
    • Sends door state updates to the Control Module.
  4. Actuator Interface

    • Controls output devices.
    • Servo Motor via PWM for locking/unlocking.
    • Buzzer via GPIO or PWM for alerts.
  5. Display Interface

    • Updates the LED display with system status messages (e.g., "Locked", "Access Granted").
    • Communicates with the display using I2C.

Log

Week 10 - 28 April - 4 May

Assembeled componenets on a breadboard and tested how they all work separately.
Started working on interfacing with the R503 fingerprint sensor.

Made the fingerprint sensor work with three basic operations. Register fingerprint, verify fingerprint and remove fingerprint.
Added led color changing as well.

Week 11 - 5 May - 11 May

Added the other devices one by one to the project and programmed them depending on the locks state (such as Locked, Unlocked or Register Fingerprint).
Switched to async tasks for every device, coordinated through a pubsub channel, which transmits the current door state. Found out I need an aditional power source for the devices.

Week 12 - 12 May - 18 May

Remade the kicad schematic.
Set up a cardboard box mock-up to simulate the Smart Lock in a real-world scenario. Integrated all components into the enclosure and tested system functionality, including fingerprint authentication, locking mechanism, and status display.
Rewrote some of the logic for the fingerprint sensor.

Week 13 - 19 May - 25 May

Added wifi connection to enable opening and closing the door from a basic website.
Added a button that can be pressed once inside that lets you reset the current registered fingerprint and register a diffrent one.
Tested and fixed small bugs, moved the project out of the cardboard box and into a better looking setup.

Hardware

Raspberry Pi Pico 2 W:

  • Central microcontroller that manages all inputs, outputs, and logic.
  • Runs the program written in Rust.

Fingerprint Sensor (R503):

  • Authenticates users by matching scanned fingerprints with stored data.
  • Communicates with the Pico via UART.

Servo Motor:

  • Simulates the physical locking and unlocking of the door.
  • Controlled via a PWM signal from the Pico.

Ultrasonic Distance Sensor (HC-SR04):

  • Detects if the door is open or closed by measuring distance.
  • Uses GPIO pins for trigger and echo.

LED Display (LCD 1602 - I2C):

  • Shows system status messages like "Locked", "Access Granted", or "Register Fingerprint".
  • Communicates with the Pico via I2C.

Buzzer:

  • Sounds a short alert when the door is unlocked or about to be locked.
  • Controlled via PWM.

Breadboard Power source:

  • Supplies power to components with higher current requirements, ensuring stable operation of the project.

All components connected on breadboard

img1 img2

Project assembeled inside a carboard box

img3 img4

Schematics

Schematic

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2 WThe microcontroller with Wi-Fi for phone notification39.50 lei
R503 - Fingerprint SensorFor fingerprint detection132 lei
LCD1602 - I2CDisplays system messages16 lei
HC-SR04 Ultrasonic Distance SensorFor measuring distances to door6.50 lei
SG90 Micro Servo MotorFor simulating locking mechanism14 lei
Passive Buzzer ModuleFor audible alerts1.50 lei
Power sourcePowering devices4.50 lei
Wires + BreadboardFor connections15 lei

Software

LibraryDescriptionUsage
embassy-rpHardware Abstraction LayerInterfaces with Raspberry Pi Pico 2 W hardware
embassy-netNetwork stackUsed to link to the website that allows opening and closing the door
embassy-executorTask executorHandles asynchronous tasks
embassy-timeTiming moduleProvides timing functions for operations
i2c-character-displayLCD1602 InterfaceCommunication with the display
pwmPWM ModuleFor buzzer and servo
uartUART ModuleFor fingerprint sensor
r503-driverFingerprint sensor driverForked and modified for use inside my own project
  1. YouTube video of fingerprint sensor
  2. Github R503 example wtih RP2040