Door Security System
A smart door lock system that detects intruders using a camera module and secures access with a passcode.
Author: Bumbacea Nicoleta-Alexandra
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-NicoletaBumbacea
Description
The project is a door security system built using a Raspberry Pi Pico 2, programmed in Rust. The system locks the door and requires a 4-digit code to unlock. When the correct code is entered, a green LED turns on, a confirmation sound is played, and the door unlocks. If the wrong code is entered, a red LED turns on, a warning sound is played, and a photo is taken using an Adafruit OV5640 Camera Module. This image is then stored for security purposes.
Motivation
I chose this project because it combines embedded systems, security, and real-world problem-solving. Door security is a practical application, and building a smart lock system allows me to explore key concepts such as keypad input handling, device control with GPIO, audio/visual feedback, and basic image capture using a camera module.
Architecture
The project includes the following main components:
Input Handler: Captures the 4-digit PIN via a matrix keypad.
PIN Validator: Compares the input against a stored code.
Control Logic: Determines if the door should unlock or log an intruder.
Feedback System: Uses LEDs and buzzer to provide visual and audio feedback.
Communication Module: Sends a UART signal to ESP32-CAM to take a picture.
Image Handler: Receives image data over UART or forwards it to a connected device.
Log
Week 5 - 11 May
Week 12 - 18 May
Week 19 - 25 May
Hardware
Raspberry Pi Pico 2W - Acts as the central microcontroller running the embedded Rust program.Handles keypad scanning, logic processing, UART communication, GPIO control for LEDs, buzzer, relay.
4x4 Matrix Keypad - Used for user input; allows the user to enter the 4-digit access code.
Green LED-Indicates successful code entry and that the door is being unlocked.
Red LED-Indicates failed code entry or unauthorized access attempt.
Piezo Buzzer - Provides audio feedback.
Relay Module (1 Channel, 5V) - Switches high-current 5V to drive the solenoid.
Solenoid Lock - Mechanically controls the locking/unlocking of the door.
Camera Module - Captures an image when an incorrect code is entered.
Power Supply (USB or 5V external) -Powers the Raspberry Pi Pico and all connected peripherals.
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2W | The microcontroller | 40 RON |
SC0889 Raspberry Pi Debug Probe | Programs/debugs the Pico 2W | 74 RON |
4x4 Matrix Keypad | Used to input the 4-digit unlock code | 7 RON |
ESP32-CAM Development Board with OV2640 2MP Camera Module | Camera Module-Captures intruder images on failed attempts | 61 RON |
Solenoid - 5v | Locks/unlocks the door | 37 RON |
Relay module | Controls the solenoid safely from Pico | 5 RON |
Breadboard kit | For circuit prototyping (includes breadboard, wires, LEDs, resistors,etc.) | 70 RON |
Software
Library | Description | Usage |
---|---|---|
embassy | Async framework for embedded Rust | Run async tasks like input, delays |
embassy-rp | Embassy HAL for Raspberry Pi Pico 2W | Control GPIO, PWM, I2C, SPI |
cortex-m | Low-level support for ARM Cortex-M chips | Set up interrupt handling, registers |
cortex-m-rt | Runtime and entry point for ARM Cortex-M | Required for running code on Pico |
defmt | Lightweight logging crate for embedded | Rust Debug messages over USB/debug probe |
probe-rs | Flash and debug embedded devices | Upload firmware and debug over USB |