master
PT1000 Temperature Logger
A Python host-side library and logging utility for a 12-channel PT1000 temperature logger device.
Overview
This project provides:
- ptlogger.py: Host-side library for communicating with a 12-channel PT1000 temperature logger via USB-CDC protocol
- log_to_csv.py: Example logger utility that continuously samples all channels and logs temperatures to CSV files
Features
- 12-channel temperature monitoring
- Real-time temperature readout
- Per-channel state monitoring (OK, open, short, fault, communication error)
- CSV logging with timestamps
- Configurable sampling intervals
- Zero-calibration support
- Reliable serial communication via pyserial
Installation
- Ensure Python 3.6+ is installed
- Install dependencies:
pip install -r requirements.txt
Usage
List Available Serial Ports
python log_to_csv.py --list
Start Logging (Default: 1 second interval)
python log_to_csv.py COM5
Logging with Custom Interval
python log_to_csv.py COM5 -i 5 -o run1.csv
Log every 5 seconds to run1.csv.
Zero-Calibrate Before Logging
python log_to_csv.py COM5 -z
Calibrate all sensors (must be in a homogeneous bath). Per-channel offsets are stored on the device.
Command-Line Options
port: Serial port (e.g., COM5, /dev/ttyACM0)-o, --output: CSV file name (default:pt_log_<date_time>.csv)-i, --interval: Sample interval in seconds (default: 1.0)-z, --zero: Zero-calibrate before logging--list: List available serial ports and exit
Library Usage
from ptlogger import PTLogger
with PTLogger("COM5") as pt:
print(pt.version())
for ch, (temp, state) in enumerate(pt.read_all()):
print(f"Channel {ch}: {temp}°C (state: {pt.state_name(state)})")
CSV Output Format
Logged CSV files contain:
- Timestamp column (ISO format)
- 12 temperature columns (one per channel)
- Empty cells indicate disconnected or faulty channels
Example:
timestamp,ch0,ch1,ch2,...,ch11
2026-06-18T12:29:56.000,25.3,25.4,25.2,...,25.1
2026-06-18T12:29:57.000,25.3,25.4,25.2,...,25.1
Requirements
- Python 3.6+
- pyserial >= 3.5
Notes
- Stop logging by pressing Enter (recommended for reliable exit) or Ctrl+C
- CSV files are flushed after every row, ensuring no data loss on interrupt
- Per-channel state codes match the MAX31865 sensor states
Description
SW for reading and logging temperatures with the MultiPT1000Readoutx12 PCB
31 KiB
Languages
Python
100%