Overclock your Raspberry Pi 3

Learn the 3 most up-to-date ways to significantly boost
your Raspberry Pi performance in minutes!

Overclock your Raspberry Pi 2 and /or Raspberry Pi 3

What is Overclocking Raspberry Pi?

How to overclock the Raspberry Pi device? Don’t matter if you are looking for the way to overclock the Raspberry Pi 3 or overclock the Raspberry Pi 2 – the algorithm stays the same.

The only thing should be taken into consideration is that the Raspberry Pi 3 has significantly improved processor performance compared to previous models. Through various techniques such as overclocking and overvoltage, we can get even more power out of the Raspberry Pi 3. While Raspberry Pi 2 device will always be a little bit behind on performance due to basic technical peculiarities.

Overclocking, basically, is the way to boost Raspberry Pi hardware performance by tuning up several device parameters. For that, additional hardware and special skills are required. Also, you’ll need to implement several tests to make sure of changes to take effect as well as keep your device from damage.

As you have already understood, the overclocking of your Raspberry Pi 3 exercises some risks. What are they and how to avoid them, read in this article below

Overclocking Risks and Warnings

WARNING 1

For now, there is no official support for overclocking the Raspberry Pi 3, so you could damage your Pi. We are not responsible for any damage you may do to your Pi. If you follow up any instruction in this document, you do it at your own risk!

WARNING 2

Overclocking may heat up the hardware up to nearly 90 °C. That in turn, can cause programs to crashes or, in the worst case, damage the CPU or memory chip. To prevent this, the most important chips have to be heatsinked. A fan increases the effectiveness of cooling and is therefore highly recommended.

Do not follow up any instruction in this article without cooling!

Additional Hardware for Overclocking

If you want to overclock your Raspberry Pi, you need to equip yourself with three essential hardware accessories:

  • Raspberry Pi. In this documentation, we use a Raspberry Pi 3 Model B V1.2 with Raspbian GNU/Linux 8 (Jessie) running.
  • Power Supply. A good reliable power supply is strongly recommended. An overclocked Pi 3 could draw 1.5A and more. So, a 2A supply should be the minimum.
  • Cooling equipment. To prevent the Raspberry Pi device from overheating we have to provide the most important chips with a heatsink as well as with an additional fan.

Important: upgrade your installed packages to their latest versions with the command:

$ sudo apt-get update && sudo apt-get dist-upgrade

At the very beginning and at the very end of the process, you’ll need to check the system performance. You can easily do that with the “sysbench” tool that can be nstalled with a command:

$ sudo apt-get install sysbench

Wel, the equipment we need for overclocking is represented in the picture below to illustrate the whole set.

Overclock Raspberry Pi

In this picture you can see the following set:

  • Raspberry Pi 3
  • Power supply 5 Volt with 2500 mA
  • A fan for build in the chassis
  • Three heat sinks
  • A chassis with gaps for memory heat skins and fan

And here is this set assembled and prepared for overclocking:

Overclock Raspberry Pi with the assembled set of the hardware

Note, that the large heatsink is under the fan, the copper heat sink is on the bottom in this set in this picture.

Checkup Before Overclocking

Before we start to overclock our Raspberry Pi, we have to prepare and check some conditions.

Monitor the CPU frequency

To learn the current frequency the CPU is setup and running, we have to read out the proc files cpuinfo_min_freq, cpuinfo_max_freq and cpuinfo_cur_freq from the /sys/devices/system/cpu/cpu0/cpufreq/ directory, where:

  • cpuinfo_min_freq – is the minimum frequency for the “idle” mode
  • cpuinfo_max_freq – is the maximum frequency
  • cpuinfo_cur_freq – is the current running frequency of Raspberry Pi
Hardware frequencies awareness

Monitor the CPU temperature

To know the current CPU temperature, we can run the vcgencmd measure_temp command. To watch the temperature every second, we can run it in a “while” loop like this:

$ while true ; do vcgencmd measure_temp ; sleep 1 ; done
Temperature measuring

This loop is running until we terminate it with CTL+C.

Setup the default speed

The default CPU configuration for the Raspberry Pi board, which goes in idle mode with no task is the following:

  • arm_freq=600MHz
  • core_freq=250MHz

If processes are running, the frequency goes up to:

  • arm_freq=1200
  • core_freq=400 (which is the maximum default values for the Raspberry PI 3).

To prevent the idle mode from damaging, we have to set these lines in your /boot/config.txt:

  • force_turbo=1 (Beware! Changing this parameter auto-voids the warranty)
  • boot_delay=1

After that, reboot your Raspberry Pi and check the current running frequency again. It should now be set to 1200000 KHz.

Checking for overclocking the RPi

Performance test without overclocking

For the first performance test, we run the following command.

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

This gives us the following results as an output:

Checking for overclocking the RPi

Keep that in mind for the test at the end with the overclocked Raspberry Pi 3.

How to Overclock you Raspberry Pi 3

Raspberry Pi Overclocking Options

The configuration for the overclocking is set up in the /boot/config.txt file. And to do the overclocking, you simply need to set various system configuration parameters in this file. There are several ways you can do the overclocking.

  1. Overclocking the RPi CPU. It means changing the “arm_freq” parameter – Frequency of ARM, measured in MHz.
  2. Overclocking the RPi GPU. Changing the “core_freq” parameter – Frequency of GPU processor core, measured in MHz. It has an impact on ARM performance since it drives L2 cache
  3. Overclocking the RPi Memory. Changing the “sdram_freq” parameter – Frequency of SDRAM, measured in MHz.
  4. Additional extension for the RPi Memory. Using ZRAM by compressing the memory. (Additional way to p.3, see below).
  5. Additional overclocking parameter “Over_voltage”. It is ARM/GPU core voltage adjust. Values above 6 are only allowed when the “force_turbo” or “current_limit_override” parameters are specified (which is set in the warranty bit).
  6. An additional overclocking parameter “Force_turbo”. This parameter disables dynamic cpufreq driver and requires the minimum settings below. Voids Warranty!

Before you start to change any parameter, be sure you have made a backup of the /boot/config.txt file.

Different Raspberry Pi models have different manufacturing tolerances. So, the correct values can only be determined by trying out the widest variety of parameters. Optimal values can only be found by testing them on every Raspberry Pi board individually.

Overclocking problems

Most overclocking issues show up immediately with a failure to boot. If this occurs, hold down the “shift” key during the next boot. This will temporarily disable all overclocking, allowing you to boot and then edit your settings.

Overclocking Algorithm

This algorithm shows how to adjust the values of CPU, GPU and memory frequencies and thus achieve the better performance. This also comprehends adjusting the “over_voltage” parameter to let the overclocked hardware work stably. And as an additional way to overclock your Raspberry Pi 3 with memory frequency adjusting, we are going to look through the way with ZRAM. So, simply do the following:

1. These are the default values for the Raspberry Pi 3

arm_freq=1200
gpu_freq=400
core_freq=400
sdram_freq=450
over_voltage_sdram=0

2. With that in mind, write to /boot/config.txt file the following configurations (then reboot the Pi):

arm_freq=1300
gpu_freq=500
sdram_freq=500
over_voltage_sdram=0

3. If the Pi comes up and running we can go one step further and try out the next configuration: step up the arm_freq value until 1500. Save it and reboot again

4. If your Pi does not boot or running unstable, count up the values for the over_voltage_sdram until the Pi is running fine.

5. If adjusting the over_voltage_sdram doesn’t help to stabilize the work of your Pi (or even boot), you have to reduce the arm_freq value down until the Pi is running again. Also, note that you have to reboot the system after each change of the /boot/config.txt file.

Overclocking with ZRAM

This is an additional option to increase the performance of your Raspberry Pi device. This way involves expansion the internal memory. It can be done by using ZRAM, which compresses the internal memory.

ZRAM uses the compression algorithms LZ4 and LZO, where LZO is the default one. It creates a block device which can be used for swap or as a general-purpose RAM disk.

How to load ZRAM? Because ZRAM is integrated into the Linux Kernel, we just have to load the module with the command sudo modprobe zram. To check if ZRAM module is running, fulfill the command sudo lsmod | grep zram as shown below.

Overclock RPi with ZRAM

If we want to setup ZRAM optimized for RPi, we can get the script zram.sh from GitHub – https://raw.githubusercontent.com/novaspirit/rpi_zram. This script creates an additional compressed RAM swap disk for each CPU core and activates it. No further configuration action is necessary.

You can download the script with this command:

sudo wget -O /usr/bin/zram.sh https://raw.githubusercontent.com/novaspirit/rpi_zram/master/\zram.sh 

Then, make it executable with as shown below.

Overclock RPi with ZRAM - make the file executable

Now, let’s see the memory information before we activate ZRAM. The free -h and swap -s commands show that we have just 100MB swap-space activated in our Raspberry Pi.

Overclock RPi with ZRAM - free -h command

Overclock RPi with ZRAM - swap -s command

Now we can run ZRAM with the command:

sudo zram.sh
Overclock RPi with ZRAM - running the command

This script will generate a swap space for each CPU core with a size of about 232 MB. Together we got an additional swap space from about 1 GB.

If we check again with the free -h command, it shows us that the swap space is increased to 1GB RAM.

Overclock RPi with ZRAM - the free -h command

By running swap -s again we can see that we have four additional swap space partitions created and running.

Overclock RPi with ZRAM - checking the additional partitions

To setup the Raspberry Pi for automatic running ZRAM at boot time, we have to edit the /etc/rc.local file and insert the line /usr/bin/zram.sh & at the end but before the exit 0 line of the file.

Then, you can check the end of the /etc/rc.local file.

Overclock RPi with ZRAM - final step

After rebooting the Raspberry Pi, it comes up with the configured ZRAM memory. Check it again with the free -h and swap -s commands to make sure that ZRAM is up and running.

Performance test with overclocking

Now, after we have finished the overclocking of our Raspberry Pi, we want to see the results of the performance test again. For that, we should run the following command again.

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

The results are the following:

Overclock your Raspberry Pi 3 - results

As we can see, all the values are better than before without overclocking. The green values are the ones from the first run.

How to Remove the overclocking

If you want to remove the overclocking from your Raspberry Pi, you just need to remove the changes from the /boot/config.txt file. If you have made a backup file, just copy it back to the /boot directory and overwrite the config.txt file.

Also, you must remove the line /usr/bin/zram.sh & from the /etc/rc.local file.

Reboot your Raspberry Pi after that and all overclocking configurations will be disabled.

Final notes

Well, now you have successfully overclocked your Raspberry Pi device and you are ready to start doing different projects on this marvelous and accelerated ARM device.

Also, a lot of people actually wonder how can they use their overclocked Raspberry Pi 3. If your Raspberry Pi is working stably after the overclocking, you will probably notice much better performance, speed and possibilities. For, instance, you can try to run x86 applications with higher technical requirements and expect better speed and quality of work. To run x86 apps on Raspberry Pi (and other ARM devices) you’ll need additional software – Exagear Desktop in combination with Wine.

You can find a lot of examples of such projects on our blog:

  • Plex Media server on Raspberry Pi. In this project, we install and start Plex to manage the media collection on RPi.
  • Run Spotify on Raspberry Pi. The project covers the case of storing, transferring and managing music (and other audio) files on RPi as a stable and economy music storage hosting.
  • Run Dropbox on RPi. Learn the way of making up your own file storage and smart backup system for your project files using Dropbox on Raspberry.
  • TeamSpeak 3 Server on Raspberry Pi. Are you a gamer (or a team of gamers)? So, this project will meet your need in a good and dirt cheap team audio communication device.
  • Google Chrome on Raspberry Pi. In this project, a very complicated task of installing and running Google Chrome browser on Raspbian is described. This browser may be used for tasks that can’t be solved by the other open source browsers. (see the next project!)
  • Netflix on Raspberry Pi device. This is a good example of the Google Chrome Browser usage. Netflix can be better run via this browser. But both are quite technically “demanding”, so overclocking adds better perspective for the successful implementation of this project. In fact, without overclocking, running such apps as Netflix on RPi is quite hard…
  • Retropie Project. This is when the overclocking Raspberry Pi is highly appreciated. Try to compile it with OpenGL activation and 3D hardware graphics acceleration, which ExaGear supports and enjoy a great variety of retro games on Raspberry Pi with Retropie, including old and medium age x86 PC games!

Also, note that Exagear Desktop can run almost any x86 app on Raspberry Pi and other ARM-based devices, including but not limited to Odroid, Banana Pi, Beagleboard, Cubox, Jetson, Cubieboard etc.

Get my ExaGear Desktop

Also on Eltechs

Virtual machine for Rasberry Pi - ExaGear Desktop

Virtual machines for Raspberry Pi

Choose the best virtual machine for your Raspberry Pi or any other ARM device comparing ExaGear and its alternatives

TeamSpeak 3 Server on Raspberry Pi

Build a TeamSpeak 3 Server on Raspberry Pi

In this post, we will tell you how to setup TeamSpeak 3 Server on Raspberry Pi with ExaGear Desktop which allows running any x86 apps on ARM mini PCs.

Microsoft Dotnet Framework on Raspberry Pi

Run MS .NET Framework 4.5 on Raspberry Pi

Set and run .NET Framework on Raspberry Pi for any specific reason. Step-by-step detailed guide.

Run Wine on Raspberry Pi

Wine on Raspberry Pi

Detailed instruction on running a Wine app on any Raspberry Pi (or other ARM) to port different x86 apps on Raspbian

Get you gaming experience beyond RetroPie level

Gaming Beyond RetroPie

Run iconic PC games like Arcanum, Disciples II and Fallout on RPi with Exagear and improve your device gaming level beyond Retropie.

How to turn Raspberry Pi into gaming emulator device

Raspberry Pi Gaming emulator

A detailed guide on how to make your Raspberry Pi a powerful gaming emulator and run any iconic and nostalgic PC games on Raspbian (or any other ARM).

ExaGear is registered trademark of Eltechs, Inc. Raspberry Pi is a trademark of the Raspberry Pi Foundation. Other trademarks and product names are the property of their respective owners.