Skip to main content
Version: FILS English

The all-in-one Biometric Hardware Security Key

A fingerprint-authenticated hardware vault that types your passwords and generates live TOTP 2FA codes via USB

info

Author: Micu Bogdan-Cristian
Group: 1221EA
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-2026-bogdanmicu

Description

A standalone embedded security device built on the NUCLEO-U545RE-Q microcontroller. You plug it into your PC via USB and scan your fingerprint to unlock it. A rotary encoder lets you scroll through a menu of accounts on an OLED display. Selecting an account either injects the stored password directly into your PC (acting as a USB HID keyboard) or shows a live, expiring 6-digit TOTP code derived from HMAC-SHA1 cryptography. A hardware real-time clock ensures the TOTP timestamps are always accurate, even after the device has been powered off.

Motivation

The motivation for this project was to create a dedicated, self-contained physical key for passwords and 2FA, bypassing the need for phone-based authenticators. From an engineering standpoint, it offered a compelling system integration challenge: tying together async Rust with Embassy, USB HID communication, and constrained cryptography on the STM32 platform to deliver a responsive, standalone tool.

Architecture

                         +----------------------------------+
+----------------+ | NUCLEO-U545RE-Q | +----------------+
| 9V Li-ion | | (Central Controller) | | Host PC |
| Rechargeable +-->| +-->| (USB HID |
| Battery |VIN| |USB| Keyboard) |
+----------------+ +----+----------+----------+-------+ +----------------+
| | |
UART | I2C | GPIO |
(TX/RX) (SDA/SCK) (CLK/DT/SW)
| | |
v | v
+---------+--+ | +-----+---------+
| AS608 | | | EC11 Rotary |
| Optical | | | Encoder |
| Fingerprint| | | + Push-Button |
| Sensor | | +---------------+
+------------+ |
+--------+--------+
| |
v v
+------+------+ +------+------+
| SH1106 | | DS3231 |
| OLED Display| | RTC Module |
| (addr 0x3C) | | (addr 0x68) |
+-------------+ +------+------+
|
coin-cell backup
(keeps time while
unplugged)

HARDWARE CONNECTIONS:

    +--------------------+          +----------------------------+
| 9V Li-ion Battery | VIN | NUCLEO-U545RE-Q |
| (power source) +--------->| VIN / GND |
+--------------------+ +----------------------------+

+--------------------+ +----------------------------+
| AS608 | VCC -->| 3V3 |
| Fingerprint | VA -->| 3V3 |
| Sensor | GND -->| GND |
| | TX -->| UART RX (PA10) |
| | RX <--+| UART TX (PA9) |
+--------------------+ +----------------------------+
(* sensor arrived with pre-crimped connector; requires adapter before wiring)

+--------------------+ +--------------------+
| SH1106 | SDA +-----------------------------------+| DS3231 |
| OLED Display +---->| I2C Bus - PB7 (SDA) / PB6 (SCL) |<+ RTC Module |
| (addr: 0x3C) | SCL | shared by both devices || (addr: 0x68) |
| +---->| || |
+--------------------+ +------------------+----------------+ +--------------------+
|
v
NUCLEO I2C peripheral

+--------------------+ +----------------------------+
| EC11 Rotary | CLK -->| PA0 - GPIO input |
| Encoder | | |
| + Push-Button | DT -->| PA1 - GPIO input |
| | | |
| | SW -->| PA4 - GPIO input |
+--------------------+ +----------------------------+

+-----------------------------+
| STM32 User USB Port |
| (to Host PC; on-board) |
| No external D+/D− wiring |
+-----------------------------+

Log

Week 4 (Idea Research)

  • Explored the concept of a dedicated hardware security device as the project theme.
  • Initially considered a password manager and a TOTP generator as two separate projects, then decided to merge them into a single integrated device, a biometric hardware key.
  • Researched existing commercial solutions (YubiKey, Nitrokey, Ledger for crypto) for inspiration on scope and feature set.

Week 5 (Component Research & Procurement)

  • Researched all required hardware components: microcontroller, fingerprint sensor, OLED display, RTC module, rotary encoder, and battery.
  • Compared alternatives for each component (e.g. internal RTC vs DS3231 external module, I2C vs SPI display).
  • Placed purchase orders for all components.

Week 6 (Components Arrive - Initial Testing)

  • All components arrived; began a first testing phase powered via USB only (no battery yet).
  • Verified I2C bus connectivity for the SH1106 OLED and DS3231 RTC on PB7 (SDA) and PB6 (SCL).
  • Verified GPIO connectivity for the EC11 rotary encoder on PA0 (CLK), PA1 (DT), and PA4 (SW).

Week 7 (Extended Testing - Known Issues)

  • Continued testing and identified the following issues to address before final integration:
    1. Fingerprint sensor wiring - The AS608 module arrived with a pre-crimped connector head; the wires cannot be inserted directly into a breadboard. A connector adapter or manual re-crimping is required before it can be wired to the MCU.
    2. MCU power source - To run from the 9V Li-ion battery instead of USB, the NUCLEO onboard jumper must be moved from the STLK position to VIN 5V.
    3. External RTC - Switching to the DS3231 external RTC module to ensure accurate timestamps at all times even when the device is switched off or loses power.
    4. (Optional) External USB-C module - Soldering an external USB-C breakout would allow cleaner cable management and a more polished physical build.
    5. External EEPROM Module - Exploring the possibility of not using the internal flash, and instead adding an external EEPROM Module to store the hashed passwords. Link_OptimusDigital

Week 8 (Integration Progress)

  • Continued the first integration steps and made the following updates:
    1. Fingerprint sensor wiring - Soldered the AS608 wires.
    2. External EEPROM module - Purchased an EEPROM module, but decided to use the internal flash as the main storage option and keep the EEPROM as a backup.
    3. USB connectivity - Dropped the USB-C breakout board idea and switched to using the STM32 User USB port for PC - MCU communication.
    4. Firmware testing - Extended the component testing code.
    5. New issue - Battery wires need to be soldered before use.

Hardware

The project centres on a NUCLEO-U545RE-Q development board as the microcontroller. An AS608 optical fingerprint sensor handles biometric authentication over UART. A 1.3" SH1106 OLED display and a DS3231 RTC module share the I2C bus, the RTC keeps accurate time for TOTP generation even while unplugged, backed by a coin-cell battery. An EC11 rotary encoder with integrated push-button provides all navigation input via GPIO. A 9V 3700 mWh Li-ion rechargeable battery makes the device fully portable. Everything is wired on a breadboard with jumper wires and supporting passives. An optional future goal is implementing ARM TrustZone to secure cryptographic operations and password storage.

NUCLEO-U545RE-Q (Central Hub) - Runs the async Rust firmware (embassy-stm32). Stores password strings and TOTP secret seeds in flash, orchestrates all peripherals, computes HMAC-SHA1 hashes, and drives the USB HID stack.

AS608 Fingerprint Sensor - Connected over UART. The device stays in a locked idle state until a recognised fingerprint is presented. On a match, it signals the MCU to unlock the vault.

  • Connection: UART TX/RX to USART peripheral on the NUCLEO board.

SH1106 OLED Display (1.3") - Shows the lock screen, the scrollable account list, and live TOTP codes.

  • Connection: I2C (SDA/SCL) shared bus with the RTC module.

DS3231 Real-Time Clock - Provides a precise Unix timestamp at all times, even when the device is unplugged, via its onboard coin-cell backup.

  • Connection: I2C (SDA/SCL) shared bus with the OLED display.

EC11 Rotary Encoder (with push-button) - The sole physical input. Rotating scrolls the account menu; pressing selects an account to either inject a password or display a TOTP code.

  • Connection: Three GPIO pins (CLK, DT, SW).

USB HID (to host PC) - The NUCLEO's USB port enumerates as a composite HID keyboard device. When a password injection is triggered, the firmware sends keystrokes directly to the connected computer.

Pin Assignments

PinSignalPeripheral
PA0GPIO input - CLKEC11 Rotary Encoder
PA1GPIO input - DTEC11 Rotary Encoder
PA4GPIO input - SW (push-button)EC11 Rotary Encoder
-USB (STM32 User USB port)USB HID (to host PC; on-board connector)
PB6I2C SCLSH1106 OLED + DS3231 RTC (shared I2C bus)
PB7I2C SDASH1106 OLED + DS3231 RTC (shared I2C bus)
PA9UART TXAS608 Fingerprint Sensor
PA10UART RXAS608 Fingerprint Sensor

Photos

Hardware setup - NUCLEO-U545RE-Q with OLED display, Rotary Encoder, DS3231 RTC module, and breadboard

Schematics

Schematics

Bill of Materials

DeviceUsagePrice
NUCLEO-U545RE-QMain microcontroller - runs Embassy/Rust firmware, stores credentials, computes TOTP125 RON
AS608 Optical Fingerprint SensorBiometric authentication over UART70 RON
1.3" SH1106 OLED DisplayDisplays lock screen, account menu, and TOTP codes over I2C43 RON
DS3231 Real-Time Clock ModuleProvides accurate Unix timestamps for TOTP over I2C16 RON
EC11 Rotary Encoder with push-buttonScroll and select accounts via GPIO21 RON
9V 3700 mWh Li-ion Rechargeable BatteryPortable power source57 RON
Breadboard, jumper wires, battery cables, resistors, coin-cell batteries, USB-C module & extrasPrototyping and connectivity95 RON
Total427 RON

Software

LibraryDescriptionUsage
embassy-stm32Async HAL for STM32 microcontrollersPeripheral drivers for UART, I2C, GPIO, USB on the NUCLEO-U545RE-Q
embassy-executorAsync task executor for EmbassyRuns concurrent tasks for fingerprint, display, encoder, and USB
embassy-timeAsync timers and delaysTiming for TOTP windows, debounce, and animations
embassy-syncMutexes and channels for shared stateSafely shares I2C bus and vault state between async tasks
embassy-usbAsync USB device stack for EmbassyEnumerates the device as a USB HID composite device
usbd-hidUSB HID descriptor and report typesSends keyboard HID reports to inject passwords into the host PC
sh1106Driver for the SH1106 OLED controllerControls the 1.3" display over I2C
embedded-graphics2D graphics library for embedded displaysRenders the lock screen, account list, and TOTP code UI
ds323xDriver for DS3231/DS3232 RTC chipsReads the current Unix timestamp for TOTP calculation
rotary-encoder-halRotary encoder abstraction over embedded-halDecodes EC11 rotation direction and button presses
embedded-halHardware abstraction traitsCommon interface gluing drivers to the Embassy HAL
hmacHMAC generic implementationComputes HMAC-SHA1 as required by the TOTP (RFC 6238) algorithm
sha1-smolMinimal SHA-1 implementation (no-std)SHA-1 digest used inside HMAC for TOTP
  1. TOTP Algorithm - RFC 6238
  2. HOTP Algorithm - RFC 4226
  3. Embassy - async embedded Rust framework
  4. AS608 Fingerprint Sensor Datasheet
  5. AS608 Example with YT Video
  6. SH1106 Controller Datasheet
  7. DS3231 RTC Module Datasheet
  8. EC11 Rotary Encoder Datasheet
  9. STM32U5 ARM TrustZone -> for C :(