Skip to content

vlsi-lab/power-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Power Logger for Xilinx ZCU102 / ZCU106

A lightweight hardware + software toolkit for high-resolution power monitoring on Xilinx Zynq UltraScale+ evaluation boards.
The system pairs a tiny Arduino® Nano 33 BLE (or a compatible 3 V MCU) with TI INA226 current/voltage monitors—multiplexed through a PCA9544A—to capture rail-power data and stream it as CSV to a host PC.

Why? When benchmarking FPGA workloads you often need a cheap, non-intrusive way to correlate board power with software events.
This project lets you do that with off-the-shelf parts and a single Python command.


Hardware Requirements

Item Notes
Xilinx ZCU102 / ZCU106 Other boards may work with minor register tweaks.
Arduino Nano 33 BLE Any 3 V MCU supported by arduino-cli should work.
Misc. cabling SDA/SCL + External Trigger + GND from Nano to mux / sensors.

Wiring Overview

Nano 33 BLE              ZCU10x Pmod I²C                   Notes
---------------------    -------------------------------   ------------------------------
GND      ─────────────►  GND 
SDA (A4) ─────────────►  SDA
SCL (A5) ─────────────►  SCL
D2       ─────────────►  EXT_TRIG (optional)               Align logs with PS/PL events

Software Requirements

  • arduino-cli ≥ 0.35 in your $PATH
  • Arduino core for your board (e.g. arduino:mbed:nano33ble)
  • Python ≥ 3.8 with:
pip install pyserial

Getting Started

Clone

git clone https://github.com/vlsi-lab/power-logger.git
cd power-logger

Build & Upload the Firmware

python power_log.py --target-board ZCU106 --arduino-board arduino:mbed:nano33ble

Use --port to override auto-detection, and --ext-trigger if you wired D2 to an external 3 V-logic source.

Start Logging

# Continuous logging to power_log_<timestamp>.csv
python power_log.py

When --ext-trigger is active the logger works only if pin D2 is HIGH.

Visualise

import pandas as pd, matplotlib.pyplot as plt
df = pd.read_csv("power_log_2025-06-07_12-15-42.csv")
df.plot()
plt.show()

External Trigger Functionality

When running the script with the --ext-trigger flag, the logger listens on a dedicated input pin and manages log files as follows:

  1. Signal goes HIGH (#START)
    As soon as the trigger pin is detected as HIGH, the script creates a new CSV file in the output directory. The filename format is:
power_log_<YYYY-MM-DD_HH-MM-SS.mmm>.csv

where <YYYY-MM-DD_HH-MM-SS.mmm> is the timestamp of the rising edge.

  1. Data recording
    All non-empty lines received from the serial port are written to the active CSV file while the trigger remains HIGH.

  2. Signal goes LOW (#STOP)
    When the trigger pin returns to LOW, the script closes the current CSV file.

  3. Subsequent HIGH pulses
    If the pin goes HIGH again later, the script opens a new CSV file with an updated timestamp and repeats the process.

Each HIGH pulse on the external pin therefore corresponds to a separate log file, making it easy to analyze individual events.


Data Format

  • The sketch prints tab-separated values (\t).
  • Headers (value1 … valueN) are autogenerated and grow if later rows get wider.

Calibration & Boards

Default calibration words and LSBs for each rail/board live in INA226.h.
Adjust them if you replace the shunt resistors.


Contributing

  1. Fork the repo and create your branch (git checkout -b feature/foo).
  2. Commit changes with meaningful messages.
  3. Open a pull request – tests and log snippets are welcome!

License

  • GNU GPL v3 or later.

Authors


Acknowledgements

  • Texas Instruments INA226 data-sheet
  • Xilinx SCUI calibration values

About

High-resolution power logger for Xilinx ZCU102/ZCU106 via Arduino Nano BLE & on-board INA226

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published