Skip to content

Instantly share code, notes, and snippets.

@TheRemote
Last active July 23, 2023 14:56
Show Gist options
  • Star 24 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save TheRemote/10bda1ac790f959210db5789f5241436 to your computer and use it in GitHub Desktop.
Save TheRemote/10bda1ac790f959210db5789f5241436 to your computer and use it in GitHub Desktop.
Measure Raspberry Pi CPU / GPU / Core / SD clock speeds and check whether you are undervolted
#!/bin/bash
# This bash script outputs the status of your Pi and checks whether you are being throttled for undervoltage and gives you your temperature
# Article and discussion at https://jamesachambers.com/measure-raspberry-pi-undervoltage-true-clock-speeds/
# Author James A Chambers 6-6-17
# Output current configuration
vcgencmd get_config int | egrep "(arm|core|gpu|sdram)_freq|over_volt"
# Measure clock speeds
for src in arm core h264 isp v3d; do echo -e "$src:\t$(vcgencmd measure_clock $src)"; done
# Measure Volts
for id in core sdram_c sdram_i sdram_p ; do echo -e "$id:\t$(vcgencmd measure_volts $id)"; done
# Measure Temperature
vcgencmd measure_temp
# See if we are being throttled
throttled="$(vcgencmd get_throttled)"
echo -e "$throttled"
if [[ $throttled != "throttled=0x0" ]]; then
echo "WARNING: You are being throttled. This is likely because you are undervoltage. Please connect your PI to a better power supply!"
fi
@mark-cohen-vineti
Copy link

Useful script! I had to add the path to vcgencmd (/opt/vc/bin/) for it to work on my systems. Thanks for the great work.

@tmuka
Copy link

tmuka commented Oct 26, 2021

Thanks for the useful script! I noticed it's reporting potential undervoltage for me, but I found some updated information about my throttling being due to temperature limits reached. I've updated your script with more reason codes. Feel free to incorporate them or use them however you like!
https://gist.github.com/tmuka/3b1c74934e67dd046df6f43aa25711ce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment