As my OctoPi installation was a bit slow on my RPi Zero I wanted to try overclocking it. I found a lot of different reports about overclockability and temperature, so I did some measurements myself.
Make sure your CPU governor is set correctly
Otherwise you CPU will not clock to the maximum clock speed you set. You can check the current governor by:
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
If this shows “ondemand
“, you’re fine, else set it correctly:
sudo sh -c "echo ondemand > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor"
This change is not permanent. If you want this to be permanent, add it to /etc/rc.local:
echo ondemand > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
Measuring RPi temperature and clock frequency
I used this script to run the CPU test from sysbench on all cores of the CPU in a loop and print the ARM frequency and temperature and also the throttle flags:
#!/bin/bash
TIMEFORMAT=%Rs
CORES=$(grep -c '^processor' /proc/cpuinfo 2>/dev/null)
echo "Running sysbench --test=cpu --cpu-max-prime=2000 --num-threads=$CORES (CTRL-C quits)"
for (( ; ; ))
do
# For Rasperry Pi systems
echo "ARM $(vcgencmd measure_clock arm), $(vcgencmd measure_temp), $(vcgencmd get_throttled)"
# For other systems
#echo "$(lscpu | grep MHz), $(sensors | grep 'Core 0')"
echo -n "Sysbench CPU ";
time sysbench --test=cpu --cpu-max-prime=2000 --num-threads=$CORES run >/dev/null 2>&1
# echo -n "Sysbench Memory ";
# time sysbench --test=memory --memory-block-size=1M --memory-total-size=10G --num-threads=$CORES run >/dev/null 2>&1
done
Example output:
Running sysbench --test=cpu --cpu-max-prime=2000 --num-threads=1 (CTRL-C quits)
ARM frequency(45)=700000000, temp=31.5'C, throttled=0x0
Sysbench CPU 22.118s
ARM frequency(45)=1100000000, temp=39.0'C, throttled=0x0
Sysbench CPU 21.961s
...
Additionally I measured power consumption at 5V with a UNI-T UT61B meter. Note that the Pi model was a non-W RPi Zero (no heatsink, board upside down, so not much airflow, ~20°C room temperature) and had an active USB hub with a WiFi adapter (Ralink Technology, Corp. RT5370) attached. The current draw is for the whole system (RPi + hub + WiFi). I was connected the whole time through SSH. Here are some results:
Clock speeds (arm / gpu / sdram) (MHz) | Current idle (mA) | Current load (mA) | Maximum temperature (°C ) | sysbench time (s) | Thermal throttling |
---|---|---|---|---|---|
Stock (1000 / 400 / 450) | 291 | 380 | 44.5 | 24.2 | No |
1100 / 500 / 500 | 292 | 407 | 47.6 | 22.0 | No |
1150 / 550 / 550 | 293 | 418 | 49.2 | 21.0 | No |
1150 / 600 / 600 | 293 | 422 | 49.8 | 21.0 | No |
1200 / 550 / 550 (did not boot) | – | – | – | – | – |
So the takeaway is that you can overclock the Pi Zero by ~10-15%, it will not throttle and you actually have a decent performance gain. Cooling seems to be unnecessary. You have to try what works for your specific hardware though (ymmv). You could take this further by voiding your warranty and using “force_turbo” + “over_voltage” and trying higher frequencies. You can find all config.txt overclocking parameters here and the RetroPie wiki has an extensive entry about overclocking.
Here are the entries I used for /boot/config.txt:
[pi0w]
# Pi Zero W modest overclock. See: https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md for parameters
arm_freq=1100
over_voltage=4
core_freq=500
sdram_freq=500
over_voltage_sdram=2
[pi0w]
# Pi Zero W maximum overclock. See: https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md for parameters
arm_freq=1150
over_voltage=6
core_freq=600
sdram_freq=600
over_voltage_sdram=4
[pi02]
# Pi Zero 2 W modest overclock. See: https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md for parameters
arm_freq=1100
over_voltage=2
core_freq=500
gpu_freq=500
sdram_freq=500
over_voltage_sdram=2
One thought on “Overclocking the Raspberry Pi Zero / Zero 2”