Overclocking your Raspberry Pi 3

The Raspberry Pi 3 is a great credit-card sized computer which is far more powerful than it’s predecessors, but you know you can squeeze even more power out of it? Here’s how to overclock your Raspberry Pi and push it that little bit further.

Why Overclock your Raspberry Pi 3?

A standard Raspberry Pi 3 boasts a 1.2GHz 64-bit quad-core CPU, 1GB RAM, along with a Broadcom VideoCore IV GPU.

Overlocking the CPU will result in increasing the default Raspberry Pi clock speed from 1.2GHz up to 1.5GHz, depending upon your cooling solution (such as a heat sink with small fan). Note that as the Raspberry Pi uses a SoC, you’ll need to adjust RAM to accommodate overclocking.

What’s the point of overclocking a Raspberry Pi? Well, it’s simple: you want to get the most possible performance out of it. Several popular tools will work better than intended with overclocking. For example:

Retro gaming: If you’ve been struggling with running Sony PlayStation 1, Sega Dreamcast, or Nintendo N64 games on RetroPie or whatever retro gaming solution you’ve chosen to use, overclocking can help considerably.

Kodi: Performance issues with streaming video in Kodi can be overcome by overclocking your Raspberry Pi.

Exagear: If you’re trying to run Windows OS on your Raspberry Pi, you can get a nice performance boost by overclocking.

Desktop: Raspberry Pi 3 can be used as a standard desktop. Why wouldn’t you want a bit of additional performance with a simple overclock?

Overclocking a Raspberry Pi 3 is a practical response to some of its shortcomings. Although, most of these were dealt with in the latest Raspberry Pi 3B+ model.

Is Overclocking your Raspberry Pi 3B Safe?

While overclocking Raspberry Pi is fast and easy, it is not always without risk.

Heat is generated: Cooling solutions are always required if you plan to overclock your Pi. Heat is bad for computer systems, as it slows processing, which in turn generates heat. We strongly recommend a solid cooling setup. Our favourite – a kit with a case, 3 heatsinks and a fan mounted to the case. This will provide the Pi great heat dissipation and airflow required for a great, stable and safer overclock.

Component failure: Increased heat can also result in the failure of components.

Data corruption: Using increased clock speeds more often results in corrupted data compared to a lower clock rate. If you’re using a hard disk drive for your Pi’s operating system, this shouldn’t be a massive issue. However, if your Raspberry Pi relies on a microSD card (most do), then you may find flash media is less reliable.

Reliable power supply: You should already be using a good quality power supply for your Raspberry Pi. Anything less than the recommended 2.5amp power adaptor is unsuitable for overclocking. Data corruption will quickly occur with a low quality power supply.

Changing certain settings during an overclocking attempt on your Raspberry Pi would void the warranty. We will highlight which settings these are in case you do not want to risk voiding the warranty of your device.

How to Overclock your Raspberry Pi 3

Still want to overclock your Raspberry Pi? Although you can overclock on other distros, we’ll be looking at the process on Raspbian Stretch as it’s by far the most popular request. Begin by running a full update and upgrade:

sudo apt update && sudo apt install upgrade

With that done, install the sysbench tool:

sudo apt install sysbench

You’ll need this later for checking how overclocking has improved performance. For now, however, run sysbench to get a baseline:

sysbench --test=cpu --cpu-max-prime=2000 --num-threads=4 run

Make a note of the results, or append a destination file to output the results to for comparison later.

sysbench --test=cpu --cpu-max-prime=2000 --num-threads=4 run > benchmark-before.txt

Next, you’ll need to edit the config.txt file. You’ll find this in the boot directory, which is best accessed via the terminal.

Begin by switching to the boot directory

cd /boot

Confirm you’re in the right location by listing the contents.

ls

You should spot config.txt. At this point it is worth nothing that the boot directory is the only portion of your Raspberry Pi’s operating system that is accessible from Windows. We’ll come back to that later. For now, just make a copy of the file:

sudo cp config.txt config.old

You should now have two config files. The first is the one you can edit, config.txt; the second is your backup, config.old.

To edit config.txt:

sudo nano config.txt

Here, you’ll find a list of settings, in the format “name=value”. Look for “overclock”; you should find a line that reads “#Uncomment to overclock the arm.” Remove the hashtag from the first line beneath, #arm_freq=800.

To overclock your Raspberry Pi 3 significantly, you’ll need to enter values for the following four conditions:

  1. arm_freq
  2. core_freq
  3. sdram_freq
  4. over_voltage

For the Raspberry Pi 3, it’s most common to overclock with the following:

arm_freq=1350
core_freq=500
sdram_freq=500
over_voltage=6
disable_splash=1

These settings are the maximum stable clock speed you’re likely to get. Lower options are available, but somewhat pointless. However, as noted elsewhere, the software you’re running will determine whether or not you’re happy with the overclocked speed. Overclocking at the above stable recommendations will not void your warranty.

If you are using the Raspberry Pi 3 as a gaming emulator, media player or using a desktop environment (LXDE, XFCE, Maynard, etc) then you’ll want to increase gpu_mem to at least 256. On the other hand, if you are using the Raspberry Pi as a web server, to build a drone or simply a console-based project then you should lower gpu_mem to 16. In other words, if your needs are graphical increase GPU’s memory, if not, lower it to the minimum.

If you’re happy to void the warranty on your Pi and have a good cooling solution, you could apply the below configurations for absolute maximum performance:

Webserver:

arm_freq=1350
core_freq=500
sdram_freq=500
over_voltage=6
gpu_mem=16
disable_splash=1
force_turbo=1 #VOIDS WARRANTY - Keeps clock rate at maximum constantly.
boot_delay=1 #helps to avoid sdcard corruption when force_turbo is enabled.

Graphical:

arm_freq=1350
core_freq=500
sdram_freq=500
over_voltage=6
gpu_mem=320
disable_splash=1
force_turbo=1 #VOIDS WARRANTY - Keeps clock rate at maximum constantly.
boot_delay=1 #helps to avoid sdcard corruption when force_turbo is enabled.

Check Overclock Performance Gain with Sysbench

Now the system is overclocked, you should run the sysbench tool again:

sysbench --test=cpu --cpu-max-prime=2000 --num-threads=4 run > benchmark-after.txt

Compare the difference between benchmark-after.txt and benchmark-before.txt. This should highlight the performance improvements you got from overclocking. The lower the total time, the better the performance of the CPU. Feel free to adjust the overclock settings. Do this small steps at a time. We recommend no more than 50Mhz adjustments at a time.

How to Recover a Failed Overclock

If you’ve rebooted your Raspberry Pi with overclocked settings and found that it won’t boot, or it crashes, freezes, of behaves in some other undesirable manner, you’ll need to undo your changes. This is easily done by restoring the backup we created earlier:

  • Power off the Raspberry Pi.
  • Remove the microSD card.
  • Insert the card into your PC’s card reader.
  • Delete \boot\config.txt.
  • Rename \boot\config.old to config.txt.
  • Safely remove the microSD card, replace in your Pi, and boot.

Everything should now be back to normal. You may continue to overclock.

Leave a Comment