
This is an RFID-based attendance logging system built using the STM32F407G-DISC1 microcontroller and an RFID-RC522 module. It enables reading, saving, and logging attendance of RFID cards through UART serial communication with a Python-based Serial Server.
Self project for COME412 - Embedded Systems class.
AUTHORS: Mert Eldemir & Ahsen Yenisey
- Reads RFID cards using the MFRC522 module.
- Sends UID to the Serial Server via UART (for READ or SAVE).
- Displays the received user information (user_name and user_id) on the LCD.
- Plays buzzer tones for feedback.
- Listens for a heartbeat signal every 2 seconds to maintain serial connection health.
- Receives UIDs from STM32 as either READ or SAVE requests.
- For READ: Looks up the UID in a local CSV database and responds with user information.
- For SAVE: Appends the UID to the database (if it's not already stored).
- Logs all READ operations in a date-based
.csv
file in theattendance_lists/
folder.
Serial Status define in which stage the serial communication between STM32 and Serial-Server. STM32 listens for the Hearbeat (special heartbeat code) signals from the Serial-Server to maintain connection during the operation.
While the Serial connection is stable we configured the the built-in STM32 Blue Button to switch between RFID modes and process the wanted operation.
Here is the example of saving new user to the database, getting same user from database and logging attendance information. Also some error and duplicate responce examples shown below.
Local CSV based database where we store main user information in uid.csv and the attendance_lists folder where we have date by date attendance logs.
The stats.ipynb notebook includes basic data visualizations. Those bar, line, and column charts that display various user statistics and attendance metrics based on dates, counts, and distributions.
-
Hardware Used:
- STM32F407G-DISC1 microcontroller
- RFID-RC522 module (13,56 MHz)
- LCD with I2C interface (PCF8574T)
- Buzzer
- USB to TTL converter (FT232RL)
-
Libraries & Drivers Used:
- Default
HAL Drivers
(STM32f4xx) - MFRC522 Library - This is Standard Peripheral Library (SPL) which some parts we rewrite for converting it to HAL-compatible code
I2C-LCD
library to dislay messages on 16x2 LCD (PCF8574T)
- Default
-
Libraries Used:
pyserial
numpy
pandas
matplotlib
pytz
six
python-dateutil
tzdata
IMPORTANT NOTE: Unlike the Nucleo boards, the STM32F407G-DISC1 microcontroller not has a virtual COM port to ST-LINK for UART communication. That's why our messages transmits via external USB to TTL converter (FT232RL) from connected TX and RX pins.
Baud Rate: 115200 bits/s
We have created our own communication protocol between STM32 and Serial-Server for: heartbeat signals, save & read requests and responses, error handling.
We shown below the Communication Protocol between two separated parts of our project:
String Format: "{CODE}|{MSG}"
CODE: Type of response
H
: Heartbeat (every 2 seconds to keep communication)R
: Read responseS
: Save response
MSG: Response message
-
For
R
(Read):ERR
: User not found in database{USER_INFO}
: user_name and user_id from database- e.g.
Mert Eldemir-220201019
- e.g.
-
For
S
(Save):OK
: UID saved successfulyDUP
: Duplicate UIDERR
: Saving failed
Examples:
H|STM32PY
(HEARBEAT_CODE used as code for Handshake Mechanism)R|Ahsen Yenisey-220201019
(user_name-user_id)R|ERR
S|OK
S|DUP
String Format: "{CODE} {UID}"
CODE: Type of request rather read or save
0
: Read (check user and response the info & log the attendance data)1
: Save (add UID to the database)
UID: 4-byte UID (space separated in HEX format)
Examples:
0 D6 97 71 AF
1 D6 97 71 AF