Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

STM32 Keypad-Based Embedded System

Clock, Temperature Monitor, and Passcode Doorlock

Project Overview

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.


System Architecture

System Architecture

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

Hardware components

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

System Operation

State Machine

The system operates using a state-driven user interface.

Default Mode

The system displays a blinking LED on the dot matrix display.

Clock Display

When a numeric key is pressed, the system displays the current time in:

HH:MM:SS

The clock runs continuously using timer interrupts.

Temperature Display

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.


Pascscode Doorlock

The system supports passcode-based authentication.

Password format:

#1234#

Possible outcomes:

Result Display
Correct password O
Wrong password X
Three failures D (doorlock disabled)

Password Configuration

Users can configure a password with 4-8 digits.

Configuration procedure:

  1. Long press '#'
  2. Enter digits
  3. Press '#' to save

The system dynamically determines password length.


FLash Memory Storage

The password is stored in STM32 internal flash memory.

Flash address used:

0x08008000

This allows password persistence even after power loss.


USART Communication

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

Firmware Architecture

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.


Project Structure

firmware
├── main.c
├── receiver.c
├── transmitter.c
└── flash.c

main.c

System initialization and high-level control logic.

transmitter.c

Keypad scanning and USART transmission.

receiver.c

Display control, system logic, and doorlock mangement.

flash.c

Flash memory read/write functions for password storage.


Demonstration Scenario

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


Technologies Used

  • STM32F103RB
  • Embedded C
  • Interrupt-driven firmware
  • USART communication
  • ADC + DMA
  • Flash memory programming

About

STM32 embedded firmware implementing keypad interface, doorlock authentication, and sensor integration.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages