how to overclock your raspberry pi

How to safely overclock your Raspberry Pi?

I have never been a big fan of overclocking on PC because I think the risks are too expensive given the prices of the components.
But on Raspberry Pi, it tempted me well. It was practically designed for that, and at worst we lose what? $35?
That’s why I did the test for you.

I’ll explain what I did step by step and the results I got on a Raspberry Pi 3B +

How to overclock a Raspberry Pi?
You can overclock your Raspberry Pi using the raspi-config tool which offers a menu to change the CPU frequency.
You can also modify the configuration in the /boot/config.txt file with your values.

Let’s see in detail what is overclocking and how to overclock your Raspberry Pi safely

What is overclocking?

Overclocking in computing is a general method to improve the performance of a computer, this applies to all components.

Here we will only talk about the CPU since it is the primary limiting element of the Raspberry Pi
Overclocking the CPU improves its performance by increasing the frequency of the clock

What is a clock?

What we call clock in a computer is the number of pulses per second. It is usually measured in MHz or GHz and is indicated when you buy a PC.
The objective of overclocking is to increase the speed of this clock to look for an improvement in the computer “power”

Limitations

You must understand that overclocking its CPU will only be useful if it is the limiting component
If your computer is slow because your hard drive is slow, it will not change anything to increase the CPU frequency

On a Raspberry Pi, the CPU is often the limiting factor, and the overclocking was planned by the manufacturer, so there is little reason to do without it, we’ll see that right away

The risks of overclocking

Computer and CPU manufacturers, determine an ideal CPU frequency for their hardware to operate at the best speed while guaranteeing the stability and the lifetime of the component

By overclocking your CPU, you will judge that the manufacturer has been too careful and that you can increase this frequency.
So that will have consequences of several types

Let's Build a School Together
Just $75 can create educational opportunities for a child in need.

Stability

The more CPU frequency you increase, the less likely your system is to remain stable

It will, therefore, be necessary to make a compromise between performance and stability
The manufacturer has chosen this limit, but probably you can push a little more the CPU without impact on stability, but do not expect to double the frequency without having a problem at this level 🙂

Power consumption

The CPU is one of the components that consume electricity

Increasing its frequency will slightly increase its power consumption
In the case of the Raspberry Pi the impact is minimal if you stay in the recommended values, but in case of extreme overclocking you must ensure that the power supply is sufficient

Heat production

By default, the Raspberry Pi’s CPU heats up very little and there are no special precautions to take at this level.

From the moment we begin to overclock the CPU, we should think of adding some hardware to keep CPU cool which can be very useful

We talk about it in the next paragraph

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Lifespan

The overclocking of the CPU will increase the use of the components and thus reduce their life expectancy

The CPUs are built to run in general more than 20 years, so even if you divide the life expectancy by two it’s not a very serious problem

And in the case of a Raspberry Pi, replacement costs are still very very low, compared to a conventional PC

Warranty

The warranty of the Raspberry Pi may be lost due to overclocking, you must know it

Here is what the builder says about it:

“We are happy that the combination of only applying turbo when busy, and limiting turbo when the BCM2835’s internal temperature reaches 85°C, means there will be no measurable reduction in the lifetime of your Raspberry Pi.”

If you do the opposite, it will have an impact on your warranty
You should, therefore, use the recommended values if possible, do not force the turbo mode in case of overheating and cool your Raspberry Pi

After I remember that we are talking about a computer at $ 35 and therefore even if the warranty is suspended, it doesn’t matter

Recommended hardware

Raspberry Pi does not require any precaution in the temperature of the components (and this is one of the highlights)
There is a security that triggers at 80 ° C and will decrease the CPU frequency to avoid overheating while letting it run

If you overclock, there is a good chance that this limit will be reached faster, too quickly
It is, therefore, useful to start thinking about the equipment needed to limit this rise in temperature

You must at least install heat sinks that will reduce the overheating of the CPU
And if that’s not enough, you can add one or more fans, or think about setting up water cooling

You will find a list of the materials I use on my resources page

Know the current performance

Now that we have defined overclocking and that you are aware of the precautions to take, let’s get down to the practice

To begin we will measure the performances of Raspberry Pi in two ways, and we will do the same tests at the end of the article to see what has changed

Know that I perform these tests on a Raspberry Pi 3B + running on a fresh Raspbian Strech Lite

Sysbench

Sysbench is the first tool we will use

First of all, install it with apt:

sudo apt-get install sysbench

Then we launch two CPU tests, one in multi-threads, the other in single–thread

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

We note the values to compare them to what will be obtained after overclocking

Phoronix

Another tool that can be used is the Phoronix Test Suite, which has the advantage of making available a web interface for testing and offering a lot of tests possibilities.

To install it you will need some dependencies:

sudo apt-get install php-cli php-gd php7.0-xml php-sqlite3 libxslt1.1

Then download the package for Debian on their site:

wget http://phoronix-test-suite.com/releases/repo/pts.debian/files/phoronix-test-suite_8.0.1_all.deb

(It is present in the repositories, but I have not managed to install it, I think the repository is not compatible with php7)

And finally install it with dpkg:

dpkg -i phoronix-test-suite_8.0.1_all.deb

Now you have to start the web server with:

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now
sudo phoronix-test-suite start-phoromatic-server

This command will display the port used to launch the web server (it changes every time)
The interface is accessible either locally (localhost) or by indicating the IP address of the Raspberry Pi from another computer

You have to register to create an account, and then access the web interface

Then add the Raspberry Pi to the systems list with the command given in the interface. It should be something like this :

sudo phoronix-test-suite phoromatic.connect 192.168.1.22:8300/L8MXR5

Now that your system is detected you can create a test suite with the tests of your choice (Tests> Create a new test profile)

In my case, I only left the basic benchmark, and I did it on the Raspberry Pi
It takes about 20min

phoronix test benchmark

And then you will get the results in the web interface
Click the device in the Systems list, and scroll down to see the last ticket

Overclock your Raspberry Pi

Let’s go now to the main subject, i.e., how to overclock your Raspberry Pi, its CPU more precisely

For this you have two methods:
– one with the tool made available by Raspbian (and therefore considered safe)
– the other manually via a configuration file

Safe way: raspi-config

The raspi-config tool allows to manage the overclocking of the Raspberry Pi easily

For that, launch the tool with:

sudo raspi-config

Then go to the Overclock menu

In general, a list of choices will be displayed, with overclocking possibilities depending on your CPU
Choose one, and apply the configuration. Reboot.
It’s a good idea to go slowly and to make levels.
Rather than choosing the highest frequency directly, take an intermediate level and see how your PI behaves for a few hours before attempting the maximum level.

For some recent models, you can’t use Raspi Config because the CPU is already overclocked
The following message is displayed:

This Pi can not be overclocked

In this case, you must follow the second method

Custom method: config.txt

The second possibility, the riskier, is to change the values directly in the boot configuration file

This file is located in /boot/config.txt

Start by making a backup of the file:

sudo cp /boot/config.txt /boot/config.txt.backup

Then open the file:

sudo nano /boot/config.txt

Here you will find some configuration options
By default, they are all commented or almost (the default values apply)

The ones we are interested in are:

  • arm_freq: Frequency of the ARM CPU in MHz
  • core_freq: Frequency of the GPU processor in MHz. It has an impact on CPU performance also
  • over_voltage: CPU/GPU core voltage adjustment

For this test I chose to use the following values:

  • arm_freq: 1600
  • core_freq: 500
  • over_voltage: 4
arm_freq=1450
core_freq=500
over_voltage=4

Be careful, these are the values for a Raspberry Pi 3B + that runs at close values. Do not use this for any model, find out about the default values for your model
The Raspberry Pi 3B + is also the worst model for overclocking since it is already as its maximum. Which is why I can not increase that much the original values

Once you changed the values restart the Raspberry Pi
If all goes well, you can redo a benchmark, but if there is a problem know that there are solutions to go back. I’ll explain how to do it at the end of the article

Impact on performance

The first thing you can do is to check that the maximum frequency you currently have after the reboot is the one you choose :

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

This will return a value in Hz that you have to convert in MHz
In my case: 1450000Hz => 1450MHz
That’s what I wanted

Let’s restart now our two benchmarks

Sysbench

We launch the same commands

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

The results are nearly the same

Despite the slight change in values on the frequency, we don’t note an improvement on this benchmark

💰 Make Money Sharing Your Raspberry Pi Expertise!
Help others navigate the world of Raspberry Pi with your insights.
Become a RaspberryTips Contributor!

Phoronix

In the same way, I relaunched the same benchmark task on Phoronix Test Suite, and got the following results:

phoronix benchmark after overclocking

The results are the same as in sysbench (I had a similar score the first time)
But this is a general test of the overall system, not only the CPU

So I decided to redo a suite with other tests to better see the improvement

It was not very visible either

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.

Diagnostic

As mentioned above, you may experience problems when starting the Raspberry Pi if the configured values are not compatible with your hardware.

In most cases, you can start the Raspberry Pi while holding down the shift key during startup
This will allow you to do a regular start, and to be able to change your values in the config.txt

If you do not succeed, it is always possible to troubleshoot this thanks to the backup that we made previously

  • Recover the SD card in your Raspberry Pi
  • Plug it in on a computer
  • Go to /boot folder
  • Replace the modified file with the backup (copy/paste)
  • Cleanly eject SD card
  • Put the SD card back in your Raspberry Pi and boot

You recover your Raspberry Pi under the original conditions, and you will be able to retry the procedure with the right values this time 🙂

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Conclusion

You learned today what overclocking is and how to set it up on the Raspberry Pi, being careful not to damage it

On my tests, I didn’t notice a significant improvement in performance
I think there are two possible explanations for this :

  • The first is that the Raspberry Pi 3B + I used is already overclocked as soon as you buy it.
    We saw in raspi-config that overclocking is impossible.
    So maybe it’s normal, we can’t achieve concrete results with this machine.
  • The second is that I start in this and I could miss something.
    Maybe my values are incorrect or I made a mistake in measuring results.

If you are looking for other ways to make your Raspberry Pi faster, click on the link to read my other tips about this.


This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Similar Posts