A small STM32 application written in C that provides card-based user management: reading card IDs, registering users to EEPROM, and handling login via a serial console. The project is focused on the application-level card management logic and a simple interactive flow for embedded devices.
- Read card ID input (via UART) and lookup user records.
- Register new users (ID, name, password, age) into EEPROM.
- Login flow with password verification and simple feedback.
- Basic validation rules for ID, name, password and age.
- Simple integration with peripherals through an AppContext (UART, EEPROM, LCD/sound).
- Minimal dependencies — designed to run on STM32 targets with a small HAL/EEPROM layer.
This repository is intended to demonstrate and provide a lightweight card-based user management system for STM32-based embedded projects. It is useful when you need a simple local authentication & user registry mechanism that stores user records in EEPROM and is operated over a serial console or simple UI.
- Toolchain for STM32 development (e.g., arm-none-eabi GCC, STM32CubeIDE, Keil MDK)
- CMake (optional, the project includes a top-level CMakeLists)
- STM32 board with UART and non-volatile storage (EEPROM or emulated EEPROM)
- Terminal program for serial interaction (minicom, picocom, PuTTY, screen, etc.)
The project supports building with CMake or your preferred STM32 IDE. Example using CMake + arm-none-eabi toolchain:
[STM32]
-
Create a build directory: cd STM mkdir build && cd build
-
Configure: cmake ..
-
Build: make
[ATMEGA]
- Enter Nano folder
- Upload code to Arduino/Atmega board/chip using platform.io API
Side note: you can test EEPROM storage using eeprom_tests.cpp in src folder inside Nano (upload it and start testing according to your needs).
Note: Adjust toolchain files and CMake cache to point at your ARM toolchain and the target MCU. Alternatively, open the provided project in STM32CubeIDE and build from there.
- Flash the produced firmware binary/hex to your STM32 target using your preferred tool (openocd, ST-Link Utility, STM32CubeProgrammer, or the IDE, same goes for Atmega).
- Connect a serial terminal to the UART configured by the project (commonly huart2).
- Reset the board and follow the serial prompts.
Typical login/register flow (example):
-
On boot, the firmware prompts: "enter your card:"
-
Present a card by typing/pasting the card ID string into the serial console and press Enter.
-
If card found in EEPROM:
- Firmware prints: "Welcome ! Enter your password:"
- Type password, press Enter. On success: "Login successful!"
-
If card not found:
- The firmware prompts to register: ask for name, password, age, then writes the user record to EEPROM.
-
Interact with LCD using potention-meter and the button (5 options available at this moment of writing this (NAME,AGE,PASSWORD,DELETE,LOGOUT) ).
- ID: minimum length 10 (and a project-specific prefix check).
- Name: non-empty, max length ~16 characters.
- Password: minimum 6, stored in a 13-byte buffer.
- Age: between 1 and 120.
These rules are implemented in the card handler code and can be adapted to your requirements.
- STM/Core: Holds the source code for STM (along with the includes)
- Nano/src: Source code for Atmega (Used Arduino Nano for this project, don't forget to make the needed changes if needed inside platform.io file for your chip/board).
- Nano/include: Holds all relevant headers for the source code of the Nano
Primary interaction points:
- AppContext structure carries peripheral handles (UART, I2C/SPI pointers) and runtime user state.
- Card handler uses the project's EEPROM (NANO) API: NANO_User_Find, NANO_EEPROM_Read, NANO_EEPROM_Write.
- UART helpers are used for prompt I/O.
MIT License — see STM/LICENSE.

