Skip to main content
Version: FILS English

Smart Lockbox

A Rust-based electronic lockbox with keypad PIN access, servo lock control, local feedback, and ESP32 networking for logs/admin reset.

info

Author: Sergiu Lefter
GitHub Project Link: fils-project-2026-sergiulefter

Description

This project is a smart lockbox controlled by an STM32 Nucleo board. The user enters a PIN on a 3x4 keypad. If the PIN is correct, an SG90 servo unlocks the box. If it is wrong, access is denied and a passive buzzer gives warning feedback.

I also use a mechanical endstop to detect when the lid is closed, so the lock can return automatically to the locked position. For the extended version, I added an ESP32 for network logging and a possible admin reset flow for the PIN.

Motivation

I chose this project because it is practical and also a good embedded Rust challenge. It combines hardware and software in one system: keypad input, control logic, servo actuation, sensor feedback, and communication. I also wanted to build something physical that I can test and improve step by step.

Architecture

Main architecture components:

  • Input: 3x4 keypad, admin button, mechanical endstop.
  • Main control: STM32 Nucleo (rental) running the lock logic and state machine.
  • Output: SG90 servo for lock movement, LCD1602 (I2C) for messages, passive buzzer for alerts.
  • Network side: ESP32 DevKitC for logging and possible admin reset/dashboard.
  • Wiring setup: STM32 connects through a small interface protoboard (female headers), then to the main protoboard where modules are connected.

How components connect:

  • Keypad, button, and endstop send inputs to the STM32.
  • STM32 controls the servo, buzzer, and LCD.
  • ESP32 communicates with STM32 over serial/UART for logging/admin features.
  • Components are assembled on protoboard/PCB prototyping boards using silicone stranded wires.

Software State Machine

The software is organized as a state machine with the following states:

  • LOCKED
  • ENTERING_PIN
  • UNLOCKED
  • WAIT_FOR_CLOSE
  • ADMIN_MODE
  • ALARM

Architecture Diagram

Input Block (3x4 Keypad, Admin Button, Mechanical Endstop)
|
| GPIO
v
STM32 Nucleo (Main Control: PIN + State Machine)
|
| via small interface protoboard (female headers)
v
Main Protoboard (distribution for components)
| | |
| I2C | PWM | GPIO/PWM
v v v
LCD1602 + I2C SG90 Servo Passive Buzzer

STM32 Nucleo
|
| UART / Serial
v
ESP32 DevKitC (Logging + optional Admin PIN reset)

Log

Week 4-5

Researched smart lockbox implementations and decided on the final project direction. Chose the main architecture around STM32 + keypad + servo and started the documentation page.

Week 6-7

Updated the hardware plan and replaced several components: breadboard with protoboard, 4x4 keypad with 3x4 keypad, reed switch with mechanical endstop, and active buzzer with passive buzzer. Ordered all required parts and checked compatibility.

Week 8

Defined the interface-board approach to avoid soldering on the rental STM32 board (female header bridge to the main protoboard). Added ESP32 networking scope for event logging and possible admin PIN reset flow.

Hardware

The lockbox prototype uses a mixed setup with reusable university hardware and purchased modules. The STM32 board is provided by the university as free rental (must be returned after project completion). The rest of the circuit is assembled using protoboard/PCB prototyping boards and silicone stranded wires.

Schematics

TODO: add KiCAD (or similar) schematic SVG in this folder and reference it here.

Bill of Materials

DeviceUsagePrice
STM32 development board (university borrow)Main controller board for firmware development and peripheral control0 RON (borrowed)
Placa dezvoltare ESP32-DevKitC, ESP32-WROOM-32D, 38PNetworking/logging module and potential admin dashboard support42.56 RON
Placa PCB prototipare o fata 5x7Small interface protoboard used between STM32 and the main wiring board2.95 RON
Placa PCB prototipare fata dubla 7x9cmMain (big) protoboard used for the rest of the components5.76 RON
Bara 40 pini 2.54 tataHeader pins for module interconnection2.06 RON
Bara pini 40p mama 2.54mm, pin rotund, segmentabil x3Female headers for detachable wiring/interfaces7.08 RON (total)
Tastatura numerica 4x3, 12 butoanePIN entry keypad (3x4)18.76 RON
Buton 12x12x7.3Local control/input button1.33 RON
Endstop mecanic SS-5GL2Position sensing (replaces reed switch)5.23 RON
Servomotor SG90, 180 grade, cu limitatorMechanical lock actuation9.49 RON
Buzzer pasiv 5VAudio feedback for success/error events1.45 RON
LCD 1602Status display for prompts and lock messages11.18 RON
Modul interfata I2C LCD 1602/2004I2C adapter for LCD communication5.11 RON
Tranzistor NPN BC547 TO-92Driver/transistor stage in auxiliary control circuits1.21 RON

Software

Library/FrameworkDescriptionUsage
EmbassyAsync embedded Rust frameworkMain embedded architecture and task scheduling
embassy-stm32STM32 peripheral support for EmbassyGPIO/I2C/PWM integration on STM32
embassy-executorAsync executorRuns concurrent embedded tasks
embassy-timeTiming, delays, and timeoutsDebounce logic, lock timers, alarm timing
embedded-halHardware abstraction traitsPortable driver interfaces
embedded-hal-asyncAsync HAL traitsAsync peripheral operations
defmtLightweight logging for embedded RustStructured firmware logs during development
defmt-rttRTT transport for defmtReal-time debug output
panic-probePanic reportingPanic handling during debugging
heaplessno_std data structuresFixed-capacity buffers/queues for embedded-safe logic
esp-idf-svcESP32 service layer in RustNetworking/logging and admin-side integration
  1. Project page requirements (FILS EN)
  2. Embassy documentation
  3. Rust Embedded Book
  4. ESP-RS Book