A simple Python-based tool to log power consumption data from AdPower Wattman measurement devices via serial communication. This utility enables PSU-level power monitoring and logging for energy profiling and diagnostics.
- Collects real-time power usage (in Watts) and power factor (PF) via serial input
- Supports logging at configurable time intervals and durations
- Compatible with AdPower devices using
/dev/ttyUSB0serial interface
- Python 3.6+
- AdPower power measurement device connected via USB serial
- pyserial
Install dependencies:
pip install -r requirements.txtThe monitoring start time is adjusted so that the first measurement aligns with the next full-minute boundary based on the interval.
python powerlog.py [-i INTERVAL] [-t TIMEOUT]- -i: Logging interval in seconds (default: 5 seconds)
- -t: Total monitoring duration in seconds (default: 120 seconds)
Each log entry contains 4 columns:
- Date and time (MM-DD HH:mm:ss)
- Average power (Watt)
- Accumulated energy during the interval (joules)
Example output:
07-17 15:24:54 153.6000 304.8745
07-17 15:24:56 153.2000 306.4358
07-17 15:24:58 153.3861 306.8286
- By default, this script assumes the device is connected to /dev/ttyUSB0. Modify adpower.py if your serial port differs.
- Ensure your user has permission to access the serial device (e.g., add to dialout group on Linux).