Skip to content

WeegeeNumbuh1/rpi5-telemetry-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python script to measure and log Raspberry Pi 5 telemetry

The original script (not this fork) mentioned in:

This fork's changes

  • Up to 10Hz* sampling
  • Proper psutil CPU monitoring (was disabled)
  • Fan speed and RP1 temperature monitoring
  • Power consumption estimation from the PMIC based on RPi5-power
  • Runtime tracking and more consistent polling intervals during stress tests/benchmarking
  • Cleaner console text output and print optimizations
    • No process spawning overhead (original script used OS-level clear calls)
    • Throttling reasons and undervoltage are now highlighted
  • Clean exit when using ctrl+C or clean system shutdown
  • Hardware checking to make sure the script is really running on a RPi5
  • Other manual cleanups

Features not mentioned in the original repo

  • Uses <1% CPU
  • No process spawning overhead (reads directly from device tree)
    • Even more efficient than the vcgencmd bindings (that module calls a subprocess to get data)

For the original README and what this script monitors, refer to the original repo,
or, look at this screenshot:

Expand/Collapse Screenshot of the terminal output

How to use

Run rpi5_telemetry_monlog.py on the Pi itself. Without any options, it will automatically create a CSV in the same directory.

Example:

python3 rpi5_telemetry_monlog.py 0.5 -m
#                                ^^^----- optional polling time in seconds

Pass -m to disable logging and only use the script for monitoring.

Other stuff

Footnotes

* = Calls to vcgencmd are limited to sequential access, likely at both the kernel and firmware level (from testing).
If the refresh rate is < 1 sec, clocks for less important busses are sampled less often (around every second or so).
A full poll on a RPi5 takes about 130 ms, most of it due to the fact that each clock speed takes about 10ms to poll.
So realistically, the fastest polling rate for this script is a little less than 10Hz.

Future ideas

  • Refresh rate config
  • Run time limiting
  • Improve polling speed (up to 10Hz)
  • Choose which data to poll/log?
    • Could improve polling speed
  • Add back missing ring oscillator monitoring? (referenced in one of the screenshots in the original article)
  • Integration with other monitoring setups? (not just CSV export)

Contributing

This repo welcomes issues, suggestions, and PRs. Feel free to reach out.

About

Python script to monitor and log Raspberry Pi 5 telemetry and internal sensors

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages

  • Python 100.0%