diff --git a/collect.sh b/collect.sh new file mode 100644 index 0000000..b7e3e15 --- /dev/null +++ b/collect.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +output_file="sensors_log.csv" + +if [ ! -f "$output_file" ]; then + echo "timestamp,CPU (°C),Vcore (V),VSOC (V),VDDP (mV),DRAM (V)" > "$output_file" +fi + +while true; do + timestamp=$(date +"%Y-%m-%d %H:%M:%S") + + values=$(sensors it8686-isa-0a40 | grep -E 'CPU:|Vcore:|VSOC:|VDDP:|DRAM:') + + CPU_temp=$(echo "$values" | grep "CPU:" | grep -oE '[+-]?[0-9]+\.[0-9]+' | head -n 1) + Vcore=$(echo "$values" | grep "Vcore:" | grep -oE '[+-]?[0-9]+\.[0-9]+' | head -n 1) + VSOC=$(echo "$values" | grep "VSOC:" | grep -oE '[+-]?[0-9]+\.[0-9]+' | head -n 1) + VDDP=$(echo "$values" | grep "VDDP:" | grep -oE '[+-]?[0-9]+' | head -n 1) + DRAM=$(echo "$values" | grep "DRAM:" | grep -oE '[+-]?[0-9]+\.[0-9]+' | head -n 1) + + echo "$timestamp,$CPU_temp,$Vcore,$VSOC,$VDDP,$DRAM" >> "$output_file" + + sleep 1 +done + diff --git a/graph.py b/graph.py new file mode 100644 index 0000000..552e30e --- /dev/null +++ b/graph.py @@ -0,0 +1,39 @@ +import pandas as pd +import matplotlib.pyplot as plt +import numpy as np + +data = pd.read_csv("sensors_log.csv") + +data['timestamp'] = pd.to_datetime(data['timestamp']) + +data.set_index('timestamp', inplace=True) + +plt.style.use('dark_background') + +columns_to_plot = { + 'CPU (°C)': 1, + 'Vcore (V)': 0.01, + 'VSOC (V)': 0.01, + 'VDDP (mV)': 5, + 'DRAM (V)': 0.01, +} + +for column, threshold in columns_to_plot.items(): + plt.figure(figsize=(12, 6)) + plt.plot(data.index, data[column], label=column, color='cyan', linewidth=2) + + last_labeled_value = None + for x, y in zip(data.index, data[column]): + if last_labeled_value is None or abs(y - last_labeled_value) > threshold: + plt.text(x, y, f"{y:.2f}", fontsize=9, ha='center', va='bottom', color='white') + last_labeled_value = y + + plt.xlabel("Timestamp", fontsize=12, color='white') + plt.ylabel("Value", fontsize=12, color='white') + plt.title(f"{column} Over Time", fontsize=14, color='white') + plt.legend(loc='upper left') + plt.grid(visible=True, color='gray', linestyle='--', alpha=0.7) + plt.tight_layout() + + plt.savefig(f"{column}_graph_no_points_dark.png", dpi=300) + plt.show()