Stop writing boilerplate serial code. This is a production-ready, multi-threaded Serial/Modbus data logger built with Python Tkinter. Designed for Automation Engineers to debug RS485/Serial devices without freezing UI.
I built this tool because most free scripts lack stability. This V2.0 release includes features requested by senior engineers:
- ✅ Adjustable Baud Rate: Support for 9600, 19200, 38400, 57600, 115200 bps.
- ✅ Raw Hex Logging: Records the raw byte response (RX) alongside parsed values. Essential for debugging unknown protocols.
- ✅ Auto-Timestamped Files: Automatically generates unique CSV files (e.g.,
datalog_20231102.csv) to prevent data overwriting. - ✅ Smart Hex Input: Accurately parses commands with or without spaces (e.g.,
01 03or0103).
- GUI Interface: Built with
tkinter(Standard Library), no heavy Qt/Electron dependencies. - Non-Blocking: Uses
threadingto keep the UI responsive while polling data at high speeds. - Auto CRC-16: Automatically calculates and appends Modbus RTU CRC (Little-Endian).
- Cross-Platform: Works natively on Windows, Linux, and macOS.
Only one external library is required:
pip install pyserial📥 Download Full Source Code You can get the Complete Source Code (main.py) which includes the full GUI implementation, threading logic, and CRC algorithms.
It is fully commented and ready to be customized for your own proprietary protocols.
👉 Get the Source Code here: Download on Gumroad ($29) (Includes: main.py, requirements.txt, and Setup Guide)
📖 Code Sneak Peek (Threading Logic) The core logic uses a separate thread to handle the serial loop without freezing the UI:
Python
# The UI will NEVER freeze because we run this in a separate thread
def loop(self):
while self.is_running:
# ... (Serial Read Logic)
response = self.ser.read(100)
if response:
# Log Raw Hex + Parsed Data to CSV
writer.writerow([current_time, hex_resp, val1, val2])
# ...
👨💻 About the Author Phil Yeh - Senior Automation Engineer
My Gumroad Store (More Engineering Tools)
Keywords: Python, Modbus RTU, RS485, Serial Communication, Data Logger, Tkinter GUI, Scada, Automation, Source Code, CRC16