The Raspberry Pi 4 single-board computer is, as our review demonstrates, something of a beast relative to its predecessors. But there’s a way to get even more performance out of it -- or any other model of Raspberry Pi, for that matter: boosting the CPU and GPU clock speeds through overclocking.
Overclocking a Raspberry Pi: What You Need to Know
While overclocking a Raspberry Pi 4 is, on the face of it, as simple as editing a configuration file -- and doesn’t even void your warranty, unless you take it to extremes -- there are a few things you need to know before you get started.
You’ll need a good-quality power supply. A third-party supply which works fine on a Raspberry Pi 4 running at stock clock speeds won’t necessarily keep up with the demands of an overclocked unit. Either pick up the official Raspberry Pi Power Supply or a quality unit from a trusted third-party manufacturer, and keep a close eye out for a lightning-bolt symbol at the top-left of the screen: That’s a warning your Raspberry Pi is being starved of power.
You’ll likely need active cooling. While it’s not completely necessary, especially if you’re only experimenting, the Raspberry Pi 4 runs hot. A small passive heatsink, available from almost any Raspberry Pi stockist you care to name, is better than nothing, but adding a fan for active cooling is better still. Teeny-tiny fans powered by the GPIO header are a good option, especially the Pimoroni Fan Shim. You should also consider third-party cases which include mounts for a larger fan, or the official Raspberry Pi Power-over-Ethernet (PoE) HAT accessory which has its own PCB-mounted fan. If you don’t cool the Raspberry Pi 4, you won’t damage it but it will hit its thermal throttle point quickly, negating the point of overclocking it in the first place.
You don’t need to worry about your warranty. Every Raspberry Pi comes with a software-set ‘fuse’ in its system-on-chip (SoC) which trips only when two key features are set: One sets the core voltage above recognized-safe levels, the other forces the CPU to run at its maximum speed at all times. Avoid the use of the latter -- the force_turbo option -- and your warranty is safe.
Updating Your Firmware: At Your Own Risk
Depending on what firmware your Raspberry Pi 4 has, you'll be able to hit clock speeds that are higher than 2.1 GHz for the processor and 700 MHz for the GPU. However, the original launch firmware for the Pi 4 could only reach 1.75 GHz on the CPU and 600 MHz on the GPU.
If you want the latest and greatest overclocking ability on the Pi 4, you'll need to upgrade to the latest experimental firmware build, which could possibly have bugs. To update your firmware, enter these three commands in a terminal window.
sudo apt updatesudo apt dist-upgradesudo rpi-update
As of publication time, the highest speeds we had achieved were 2.147 GHz for the CPU and 750 MHz for the GPU, but newer firmware may let you push it even farther. Also, because not all processors are identical, your mileage may vary.
Overclocking the CPU
Most workloads on the Raspberry Pi are tied to the clock speed of the central processing unit (rather than the graphics processing unit) of the SoC, making it the obvious place to start experimenting. To begin, you’ll need your Raspberry Pi 4 and accessories plus a microSD card with a copy of NOOBS - the New Out Of Box Software - compatible with the Raspberry Pi 4. If in doubt -- and particularly if you’ve used older models before -- download a fresh copy of NOOBS from the Raspberry Pi website.
The reason for using NOOBS, rather than a straight Raspbian installation, is simple: NOOBS includes the ability to edit the configuration files in the /boot directory even if Raspbian can’t load. If something gets messed up and your Pi won’t boot, just hold down the Shift key on startup to go into the NOOBS Recovery Mode and edit the configuration file from there.
The majority of the core configuration settings for a Raspberry Pi can be found in a file helpfully called config.txt in the /boot directory. It’s a standard text file, and you can open it in a variety of ways: Double-clicking on it in Raspbian is enough to show you its contents, but not to let you save any changes you make. For that, you’ll need elevated privileges. Open a Terminal with Control, Alt, and T, then type:
sudo nano /boot/config.txt
This opens the file in the Nano text editor with root-level privileges -- equivalent to the Administrator account in Windows. Using the cursor keys, scroll to the bottom and find the section marked [pi4], which contains settings loaded only when the microSD is running in a Raspberry Pi 4. If you’re overclocking a different model of Raspberry Pi, just head to the bottom of the file.
On a new line under [pi4], type the following:
The first of these settings, over_voltage=2,increases the voltage provided to the SoC by around 0.05V; it’s not much, but without this extra little boost it’s unlikely you’ll be able to boot your Raspberry Pi 4 at its new, higher clock speed. Each point here is worth about .025V.Th
The second setting, arm_freq=1750, sets the clock speed of the SoC’s four Arm Cortex-A72 processor cores to 1,750MHz or 1.75GHz, an increase of 250MHz over the stock 1.5GHz setting. If your Raspberry Pi 4 has the original launch firmware, 1.75 GHz is as fast as you can go. If you have the latest experimental firmware, you can try these values:
Save the changes with Control and O, then exit Nano with Control and X. You’ll need to reboot the Raspberry Pi 4 to reload the new configuration file, which you can do by typing:
If all has gone well, Raspbian will load as normal; if not, hold Shift to load the NOOBS Recovery Mode and try increasing the over_voltage setting or decreasing the arm_freq setting. Note you can’t increase over_voltage above a value of 6 -- equivalent to a 0.15V increase to core voltage -- without using the force_turbo setting and voiding your warranty.
Benchmarking a CPU Overclock
Overclocking the Raspberry Pi 4 isn’t just about tweaking a configuration file; it has a real impact on actual workloads and synthetic benchmarks alike.
The Linpack benchmark offers a look at floating-point performance: Both the single-precision and double-precision modes see a 16-18 percent performance boost with the overclock active, while a single-precision version which makes use of the Arm cores’ NEON acceleration instructions is lifted by roughly 15 percent.
After installing the latest experimental firmware on a different board, we ran Linpack (SP only) at stock speeds, 2 GHz and 2.147 GHz. In this run, the stock speed got a slightly lower score, but we saw a boost of 46 percent going to the highest possible clock.
When compressing video using the FFmpeg benchmark, we saw huge differences in performance. The stock speed took 49.3 seconds to complete this task while the 2.147 GHz clock managed to do it 37.3 seconds, an improvement of 24 percent.
A real-world file-compression test, in which a large file containing random data is compressed using the single-threaded bzip2 and multi-threaded lbzip2 compression utilities, shows a gain of around 9 percent faster single- and 7 percent faster multi-threaded for the 1.75 GHz speed.
An image editing benchmark, built using the popular open-source GIMP software, benefits more from the boosted, 1.75 GHz CPU clock speed: finishing in 39.2 seconds compared to 47.35 seconds on a stock-clocked Raspberry Pi 4, it shows an impressive 17.2 percent gain.
Even web browsing is improved: The Speedometer 2.0 benchmark, which measures web-app responsiveness, is boosted by around 11 percent with the jump to 1.75 GHz. Moving up to 2.147 GHz increased it to 21.7, an improvement of 28 percent.
Not everything benefits from a new clock speed, though. The OpenArena first-person shooter, based on id Software’s Quake III Arena, sees only a margin-of-error difference in framerate at 1.75 GHz. Applications like this are typically GPU-limited, rather than CPU-limited; to improve the performance here, the GPU needs some attention.
Overclocking the GPU
Overclocking the Raspberry Pi 4’s GPU is no more difficult than overclocking its CPU, and is controlled using the same configuration file as before. Open a Terminal with Control, Alt, and T, and type:
sudo nano /boot/config.txt
Scroll down to the [pi4] section, as before, and add the following line:
If you have the latest experimental firmware, you can try boosting this number to 750. Where the arm_freq setting controls the CPU clock speed, the gpu_freq setting unsurprisingly does the same for the GPU clock speed. The default is 500MHz; 600MHz offers a modest performance boost without much risk while 750 MHz gives you a bit more.
You’re likely to find overclocking both the CPU and GPU is too much for your overvoltage setting: find line which reads over_voltage=2 and change it:
Save the file with Control and O and exit Nano with Control and X. Reboot the Raspberry Pi 4, and all should be fine; if Raspbian doesn’t load, hold Shift to go into the NOOBS Recovery Mode and edit the configuration file to increase over_voltage to 6.
Don’t try to increase the over_voltage setting any further than 6; values above this are ignored unless you also set the force_turbo setting, and doing so toggles a fuse in the SoC which invalidates your warranty.
Benchmarking a GPU Overclock
You’d think there’s little point in running any of the CPU-based benchmarks again to see how the GPU overclock affects them, in much the same way as running the GPU-based OpenArena benchmark was pointless following the CPU overclock. You’d be wrong, however: the Raspberry Pi’s GPU enjoys considerably more control over the system than you might expect, thanks to the SoC’s origins as a multimedia chip for set-top boxes and entertainment systems.
The Linpack benchmark demonstrates this well: The single-precision performance has increased yet again, boosted to nearly 20 percent over the stock Raspberry Pi 4 compared to just 17 percent on a CPU-only overclock. The double-precision gains are somewhat lower, but the NEON-accelerated performance is again almost 20 percent higher compared to the 15 percent uplift of the CPU-only overclock.
There’s no such thing as a free lunch, of course, and the real-world file compression test tells a different story: The single-threaded benchmark shows no change over the CPU-only overclock, while the multi-threaded version has dropped from the previous 6.7 percent gain to just 1.3 percent.
For image editing there has again been a loss of performance: the 17.2 percent uplift obtained from the CPU-only overclock has dropped to 6.6 percent, adding a full three seconds on to the completion time.
When it comes to web browsing, the story is somewhat happier: the 11.2 percent performance gain measured on the CPU-only overclock is boosted slightly to 12.4 percent, and while that’s only a minor gain, it is at least not the losses seen in other tests.
Where the GPU overclock shines is, unsurprisingly, in the OpenArena gaming benchmark. Switching the GPU clock to 600MHz from its stock 500MHz boosts the game’s framerate 16.4 percent from 41.4 frames per second to 48.2 frames per second.
The Raspberry Pi 4 is already a powerful device, easily beating its predecessors and its similarly-priced competition in a range of benchmarks. For those who need still more, though, overclocking is a quick and easy way to wring a little extra performance for both CPU and GPU workloads - though you’ll have to decide which of the two is most important to you in order to realize the biggest gains, and additional cooling is highly recommended.
Image Credits: Tom's Hardware