Clock, Temperature Monitor, and Passcode Doorlock
This project implements a multi-functional embedded system using the STM32F103RB microcontroller. The system integrates a keypad interface, dual dot-matrix display, temperature sensor, and passcode-based doorlock functionality.
The project demonstrates practical usage of multiple STM32 peripherals including:
- GPIO
- Timers
- Interrupts
- USART communication
- ADC with DMA
- Flash memory
The firmware is implemented using an interrupt-driven architecture, enabling real-time coordination between input handling, display control, sensor sampling, and communication.
The system consists of two STM32 boards connceted via USART communication.
Transmitter Board
- scans keypad input
- performs key debouncing
- sends key commands through USART
Receiver Board
- processes user input
- controls the dot matrix display
- maintains system time
- samples temperature
- manages passcode authentication
- stores passcode in flash memory
| Component | Description |
|---|---|
| STM32 Nucleo-F103RB | Main microcontroller platform |
| 4×4 Key Matrix | User input interface |
| 8×8 Dot Matrix ×2 | Combined as 8×16 display |
| TMP36 | Temperature sensor |
| USART | Communication between boards |
The system operates using a state-driven user interface.
The system displays a blinking LED on the dot matrix display.
When a numeric key is pressed, the system displays the current time in:
HH:MM:SS
The clock runs continuously using timer interrupts.
After displaying the time, the system scrolls and displays the measured temperature
Temperature format:
NN.N °C
Temperature is sampled periodically using ADC with DMA.
The system supports passcode-based authentication.
Password format:
#1234#
Possible outcomes:
| Result | Display |
|---|---|
| Correct password | O |
| Wrong password | X |
| Three failures | D (doorlock disabled) |
Users can configure a password with 4-8 digits.
Configuration procedure:
- Long press '#'
- Enter digits
- Press '#' to save
The system dynamically determines password length.
The password is stored in STM32 internal flash memory.
Flash address used:
0x08008000
This allows password persistence even after power loss.
The keypad is implemented on a separate STM32 board acting as a transmitter.
Key values are transmitted using a simple command protocol:
| Value | Meaning |
|---|---|
| 0–9 | Numeric key |
| 0xA | * key |
| 0xB | # key |
| 0xC | Long press # |
| 0xD | Timeout event |
The firmware uses multiple timers and interrupts to coordinate system tasks.
| Timer | Function |
|---|---|
| TIM1 | Keypad scanning and debouncing |
| TIM2 | Dot matrix display refresh |
| TIM3 | User input timeout |
| TIM4 | Clock update and temperature sampling |
This interrupt-based design ensures responsive user interaction while maintaining real-time system behavior.
firmware
├── main.c
├── receiver.c
├── transmitter.c
└── flash.c
System initialization and high-level control logic.
Keypad scanning and USART transmission.
Display control, system logic, and doorlock mangement.
Flash memory read/write functions for password storage.
Default state:
- blinking LED indicator
User interaction:
Press numeric key:
Display clock → Display temperature → Return to default
Enter passcode:
#1234#
Correct password → O
Wrong password → X
Three failures → D
- STM32F103RB
- Embedded C
- Interrupt-driven firmware
- USART communication
- ADC + DMA
- Flash memory programming

