Skip to content

Hobby project that lets you manage your cards (125KHz/13.56MHz...) with a card reader through USART!

License

Notifications You must be signed in to change notification settings

Paran-oid/STM32-125k_13.56MHz-Card-Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STM32 Card Manager

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.

20250914_135648 20250914_135654

Features

  • 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.

Why this project?

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.

Getting Started

Prerequisites

  • 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.)

Build

The project supports building with CMake or your preferred STM32 IDE. Example using CMake + arm-none-eabi toolchain:

[STM32]

  1. Create a build directory: cd STM mkdir build && cd build

  2. Configure: cmake ..

  3. Build: make

[ATMEGA]

  1. Enter Nano folder
  2. 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 / Run

  • 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.

Basic Usage (serial interaction)

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) ).

Validation Rules (default)

  • 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.

Project Structure (relevant files)

  • 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.

License

MIT License — see STM/LICENSE.

About

Hobby project that lets you manage your cards (125KHz/13.56MHz...) with a card reader through USART!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages