Check If Raspberry Pi is Undervolted Or Throttled

Raspberry Pi eeprom

I uploaded a quick gist that will measure your Raspberry Pi’s true clock speeds using the vcgencmd. Don’t believe what other tools like cpufreq tell you that your Raspberry Pi is running at because they are lying to you!  Raspberry Pi Undervoltage is also a very big issue and this script will detect it and notify you.

The true clock speeds of the Raspberry Pi are controlled by the firmware.  The vcgencmd is the official way to interact with the Raspberry Pi’s firmware and are the only readings you can really trust!  Available at Gist – TheRemote or click read more to view it directly.

Hardware

Raspberry Pi 4
Raspberry Pi 4

The Raspberry Pi 4 is available in different memory configurations all the way up to 8 GB. It’s about the size of a credit card and uses an extremely low amount of power making it ideal for all sorts of projects and ideas!

Links: Amazon.com*, AliExpress*, Amazon.ca*, Amazon.com.au*, Amazon*.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*, Amazon.sg*

Measure Raspberry Pi Undervoltage – Script Code

#!/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

Raspberry Pi Undervoltage Prevention

When I wrote this script I noticed when I was trying to overclock using cpufreq-utils it was reporting totally different numbers than what vcgencmd was giving me. That’s when I did some research and learned that the true speeds are controlled by the firmware. That is why the best way to overclock your Pi is definitely by using /boot/config.txt and putting the parameters there.

I also learned writing this that my Raspberry Pi was undervolted and throttled.  This was despite the fact that it was connected to a powered USB hub.  After that I bought a better power supply and have not have any problems since.  The cheap but very reliable CanaKit 3.5A power supply* on Amazon is the one I chose.

Benchmarking / Testing Storage

If you want to verify your drive’s performance you may want to run my storage benchmark with:

sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash

If you search for the model of your drive on Pi Benchmarks you can compare your score with others and make sure the drive is performing correctly!

Other Resources

If you want to learn how to update your firmware or suspect it may be causing issues check out my Raspberry Pi bootloader firmware update / troubleshooting guide

To learn how to set up your Pi to boot with a SSD check out my Raspberry Pi Pi native bootloader USB booting guide

7 thoughts on “Check If Raspberry Pi is Undervolted Or Throttled”

  1. Avatar for RadicalxEdward

    If I comment out line 7 it says invalid syntax for all the “for” lines and then line 16. So basically every line it’s saying is invalid. Tried running with python 2 and 3.

  2. Avatar for RadicalxEdward

    When I try running this on a Raspberry Pi 4 (running OctoPi) it says invalid syntax for line 7, yet when i tried copy/pasting that line to bash to run manually it works just fine. So idk why it’s not working in the script (i’m not very experienced with linux)

Leave a Comment

Your email address will not be published. Required fields are marked *

Type here..

Exit mobile version