Skip to main content
Version: ACS CC

Secured electronic safe system

Creating a Secured electronic safe system in Rust using a Raspberry Pi Pico 2.

info

Author: Suga Serban-Ionut
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-serbansuga

Description

The project focuses on building a secure electronic safe system using a Raspberry Pi Pico 2W. Users interact with the system through an external numpad keyboard to input a secret PIN code. The input is displayed real-time on an LCD screen using masked characters (e.g., ****) for security. If the correct PIN is entered, a servomotor automatically unlocks and opens the safe’s door. A red LED remains lighted while the safe is locked, and a green LED indicates when the safe is successfully opened. If the wrong PIN is entered three times consecutively, a buzzer alarm is triggered to simulate a security alert. Following a lockout, the safe can only be unlocked using an RFID contact card for authorized access.

All components, including the display, numpad, LEDs, buzzer, and servo, are integrated inside the safe box and connected through a breadboard hidden inside the box. Only the necessary interfaces (keyboard, display, RFID card, LEDs) are accessible externally for user interaction.

Motivation

I chose this project because it allows me to apply what I have learned about working with hardware and software in a real example. Creating a safe with a PIN code, RFID access, LEDs, a buzzer, and a servo motor helps me better understand how to connect and control different components. It is a good way to practice reading input from a keypad, showing messages on a display, and controlling a motor to open and close the door. Also, I like that the project has a real-world use, security playing an important role in this case, and it makes the learning process more interesting and practical.

Architecture

The project has the following architecture:

  • Raspberry Pi Pico 2W
    • Role: Acts as the central controller for the entire system.
    • Connections: Interfaces with the LCD display, numpad, RFID card module, LEDs, buzzer, and servomotor.
  • LCD Display (I2C)
    • Interface: I2C
    • Connections:
      • SDA to GPIO pin of Raspberry Pi Pico 2W
      • SCL to GPIO pin of Raspberry Pi Pico 2W
    • Role: Displays the PIN entered and system messages (success, error, lock status).
  • Numpad (Keypad Matrix)
    • Interface: GPIO (scanning rows and columns)
    • Connections: Connected to multiple GPIO pins on the Pico.
    • Role: Allows the user to enter the PIN code to unlock the safe.
  • RFID Card Module (RC522)
    • Interface: SPI
    • Connections:
      • MOSI, MISO, SDA connected to SPI GPIO pins.
    • Role: Provides secondary, authorized access after multiple incorrect PIN entries.
  • Green/Red LEDs
    • Interface: GPIO
    • Connections: Connected to separate GPIO pins on the Pico.
    • Role:
      • Red LED ON when the safe is locked.
      • Green LED ON when the safe is unlocked.
  • Passive Buzzer
    • Interface: GPIO
    • Connections: Connected to a GPIO pin.
    • Role: Sounds an alarm after three consecutive incorrect PIN entries.
  • Servomotor
    • Interface: PWM
    • Connections: Connected to a PWM GPIO pin on the Pico.
    • Role: Controls the door locking mechanism, opening or closing the safe when authorized access is granted.

alt text

Log

Week 5 - 11 May

Week 12 - 18 May

Week 19 - 25 May

Hardware

  • Raspberry Pi Pico 2W: Used as the main controller that connects and manages all components in the system.
  • LCD Display (I2C): Displays the code entered from the numpad, system messages like "Access Granted" or "Wrong Code".
  • Numpad: Used for PIN code input. It lets the user unlock the safe by entering the correct code.
  • RFID RC522 Module: Provides a second way to unlock the safe when 3 consecutive wrong PINs are introduced, using RFID cards. Only registered cards are accepted.
  • Active Buzzer: Sounds an alarm if multiple wrong PINs are entered, alerting about possible unauthorized access.
  • Green and Red LEDs: Green LED lights up when access is granted and the safe is unlocked. Red LED stays ON when the safe is locked or if access is denied.
  • Servomotor: Controls the physical locking mechanism of the safe. It rotates to open or lock the door based on access status.

Schematics

alt text

Bill of materials

DeviceUsagePrice
Raspberry Pi PicoThe microcontroller40 RON
LCD I2CLCD Display where PIN is displayed16 RON
RFID RC522 ModuleAuthorized card module10 RON
4X4 KeypadNumpad where PIN is introduced7 RON
Servo MotorMotor that opens the door14 RON
BreadboardConnects the components10 RON
BuzzerThe alarm sound1.5 RON
Female to male wiresConnections6 RON
Male to male wiresConnections8 RON
Green LEDAcces permitted1 RON
Red LEDAcces refused1 RON
100 Ohm resistorConnecting the LED0.5 RON

Software

LIbraryDescriptionUsage
embassy-rpPeripheral access libraryUsed for initializing and interacting with peripherals
embassy-timeTime management libraryUsed for time-based operations such as timers, delays
pwmPulse-width modulationUsed for controlling the servo motor and buzzer
embassy-executorAsynchronous executor for Rust embedded systemsUsed for task scheduling and asynchronous programming
gpioGPIO manipulationUsed for interacting with GPIO pins