Retailing at around $40, Raspberry Pi 4 already gives you plenty of bang for your buck, but you can get even more out of this powerful single-board computer by overclocking it.
Overclocking the CPU and GPU can often deliver a noticeable performance boost, which is particularly useful if you’re performing resource-intensive tasks, such as playing games, streaming high-resolution media, or using your Raspberry Pi as a mini laptop.
Regardless of how you plan to use all of that extra power, by the end of this article you’ll have successfully boosted your Raspberry Pi 4’s CPU and GPU.
Before we begin: everything you need to know about overclocking
Overclocking means setting your CPU and memory to run at speeds higher than their official speed grade.
Despite the performance benefits, many people avoid overclocking for fear of voiding their warranty. Unlike some organizations, the Raspberry Pi Foundation supports overclocking, so you can follow this tutorial without having to worry about your warranty. However, just be aware that there are some modifications that will void your warranty, such as “overvaulting.” If this article leaves you eager to explore other ways to boost your device’s performance, then you should review the Raspberry Pi Foundation’s guidelines carefully to ensure you don’t accidentally void your warranty!
What you’ll need
To complete this tutorial, you’ll need:
- A Raspberry Pi 4
- A keyboard and a way to attach this keyboard to your Raspberry Pi
- A monitor
- A micro HDMI cable
- An SD card that’s compatible with your model of Raspberry Pi. You’ll be wiping this SD card, so make sure it doesn’t contain anything that you want to keep.
- A good-quality power supply. When you’re running Raspberry Pi 4 at stock speeds, you can use pretty much any compatible third party power supply, but if you’re going to overclock Raspberry Pi, then you should opt for the official Raspberry Pi Universal Power Supply. By using the official power supply you can be confident that your Raspberry Pi has enough power to run at overclocked speeds.
- A way to cool your Raspberry Pi. When the processor works harder, it gets hotter. If you don’t reduce the heat produced by your Raspberry Pi, then it’ll hit its thermal throttling point pretty quickly, and you won’t get the full benefits of overclocking. There are various options for cooling your Raspberry Pi, including heat sinks, a standalone fan or a case with a fan included, or you may even want to get adventurous and build your own water cooling setup!
When you have these tools, you’re ready to boost your CPU and GPU.
Install the official Raspberry Pi OS
For the purposes of this tutorial, we’ll be writing the Raspbian operating system to our SD card, using Etcher. If you don’t already have Etcher installed, then you can download it for free from the Balena website.
- Head over to the Raspbian website and download the latest version.
- Insert the SD card into your laptop or computer.
- Launch the Etcher app.
- In Etcher, click “Select imagem” and then choose the Rasbian system image you just downloaded.
- Click “Select target” and choose your target boot medium, which in this instance is our SD card.
Etcher will now flash the Raspbian system image to your SD card.
Boot into Raspbian
Once Raspbian is installed:
- Remove the SD card from your laptop or computer and insert it into your Raspberry Pi.
- Attach your monitor to the Raspberry Pi using the micro HDMI cable.
- Attach your keyboard to the Raspberry Pi device.
- Plug your Raspberry Pi in to a power source.
Raspbian should now boot automatically.
Consider updating to the latest release
If you want to experience the latest and greatest overclocking capabilities, then you’ll need to upgrade Raspbian to the latest experimental firmware build. Note that experimental releases have a higher chance of containing bugs, flaws and other errors, so you shouldn’t use them in a production environment.
To update your firmware, select the little Terminal application in the toolbar and run each of the following commands in turn:
When prompted, press “y” for “yes.” Now, run the next command:
When prompted, type “y” again.
You’ll need to reboot your system in order to activate this new firmware, so click the little Raspberry Pi icon in the upper-left corner and then select “Shutdown …. -> Reboot.”
Benchmarking Raspberry Pi
Before you overclock your device, you may want to record some information about its current performance so you can compare notes later!
There are plenty of benchmarking tools on the market, but I’ll be using Sysbench. Alternatively, you can skip this step entirely and move straight to overclocking.
In Raspbian’s toolbar, select the Terminal icon. Type the following command into the Terminal:
Once Sysbench is installed, you can get a baseline of your Raspberry Pi’s performance by typing the following command into the Terminal:
This will create a “pre-benchmark” text file containing information about your Raspberry Pi’s current performance.
Overclocking the CPU
When you overclock the CPU, you’re increasing the clock speed of the central processing unit which gives you a performance boost. Most workloads on a Raspberry Pi are influenced by the clock speed rather than the graphics processing unit. After overclocking the CPU you should experience a noticeable performance improvement, regardless of how you’re using your Raspberry Pi.
To edit your Raspberry Pi’s config.txt file, we require elevated privileges, so run the following Terminal command:
The config.txt file will now open in Raspbian’s Nano text editor with root-level privileges.
You can overclock the CPU by making some changes to these core configuration settings:
1. Scroll to the bottom of the file and find the section marked [pi4].
2. On a new line directly beneath [pi4], add the following:
Alternatively, if you installed the latest experimental firmware, then you can try these values instead:
3. Save your changes with Ctrl + O and exit the file with the Ctrl + X keyboard shortcut.
You’ll need to reboot the Raspberry Pi 4 before these new configuration settings are loaded, so run the following command in the Terminal window:
If your overclocking is successful, then Raspbian will start using your new configuration settings.
Test your results!
If you took the time to create a report before overclocking, then now’s the time to generate a second report and compare the results.
Launch a Terminal window by clicking the little icon in the toolbar, then run the following command:
This will create a “post-benchmark” report. To view your reports, select the file icon in the Raspbian toolbar and open both the “pre-benchmark” and “post-benchmark” files; you can now compare these reports to see exactly how much of a CPU boost you’ve gained!
Overclocking the GPU
Now let’s move onto GPU:
1. Open the Terminal and run the following command:
2. Scroll to the [pi4] section and add the following on a new line:
If you have the latest experimental firmware, then you can try boosting this number to 750.
3. If you’re overclocking both the CPU and GPU, then it’s possible this may be too stressful for your overvoltage setting, so find the line that reads
over_voltage=2 and change it to the following:
4. Save your changes with the Ctrl + O shortcut, and exit the Nano application using the Ctrl + X shortcut.
Now, all you need to do is reboot your Raspberry Pi and your changes will come into effect!
With a faster Raspberry Pi, you can now put it to good use. Have you tried overclocking your device? Let us know your experiences in the comments below!