5 Commits

Author SHA1 Message Date
797876eeac update logger README to include detailed usage instructions and examples
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
2025-12-10 09:49:24 +09:00
f73c2668e3 csv_2_plot: update title margin
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
2025-12-10 09:22:30 +09:00
55b5296d16 csv_2_plot: update y-axis gridline colors
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
2025-12-09 18:19:26 +09:00
a8faa6a441 csv_2_plot: improve plot configuration and add average voltage/interval calculations
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
2025-12-09 18:19:26 +09:00
c7188df159 logger: save time on UTC
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
2025-12-09 16:49:12 +09:00
3 changed files with 6 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
# Odroid PowerMate Logger and Plotter
This directory contains two Python scripts to log power data from an Odroid PowerMate device and visualize it.
This directory contains two Python scripts to log power data from an Odroid Smart Power device and visualize it.
1. `logger.py`: Connects to the device's web server, authenticates, and logs real-time power data from its WebSocket to a CSV file.
2. `csv_2_plot.py`: Reads the generated CSV file and creates a plot image of the power, voltage, and current data over time.
@@ -42,7 +42,7 @@ Ensure you have Python 3 installed.
With the virtual environment activated, install the necessary Python packages:
```bash
pip3 install requests websockets protobuf pandas matplotlib python-dateutil
pip33 install requests websockets protobuf pandas matplotlib python-dateutil
```
### 4. Protobuf Generated File

View File

@@ -1,4 +1,5 @@
import argparse
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import pandas as pd

View File

@@ -113,9 +113,9 @@ class OdroidPowerLogger:
ts_iso_csv = ts_dt.isoformat(timespec='milliseconds').replace('+00:00', 'Z')
row = [
ts_iso_csv, sensor_data.uptime_ms,
f"{sensor_data.vin.voltage:.3f}", f"{sensor_data.vin.current:.3f}", f"{sensor_data.vin.power:.3f}",
f"{sensor_data.main.voltage:.3f}", f"{sensor_data.main.current:.3f}", f"{sensor_data.main.power:.3f}",
f"{sensor_data.usb.voltage:.3f}", f"{sensor_data.usb.current:.3f}", f"{sensor_data.usb.power:.3f}"
sensor_data.vin.voltage, sensor_data.vin.current, sensor_data.vin.power,
sensor_data.main.voltage, sensor_data.main.current, sensor_data.main.power,
sensor_data.usb.voltage, sensor_data.usb.current, sensor_data.usb.power
]
csv_writer.writerow(row)