18 April 2018

Overclocking Raspberry Pi: How to Do It and What You Need to Know


The Raspberry Pi 3 is a great little computer, far more powerful than the models before it. But did you know you can squeeze even more power out of it? Here’s how to overclock your Raspberry Pi, and push it further than you ever imagined!

Why Overclock Your Raspberry Pi?

A standard Raspberry Pi 3 boasts a 1.2GHz 64-bit quad-core CPU, 1GB RAM, along with a Broadcom VideoCore IV GPU as part of the Broadcom System on a Chip (SoC) BCM2837.

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). Note that because 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 out of it. Several popular tools will work better than intended with overclocking.

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

Kodi: Performance issues with streaming video in Kodi can be overcome thanks to overclocking your Raspberry Pi. If you’re also using a VPN, higher clock speed will help here too.

Exagear: Trying to run Windows software on your Raspberry Pi? Even with the right preparation, overclocking can help here.

Desktop: Raspberry Pi 3 can be used as a standard desktop. Who wouldn’t want a bit of additional performance, courtesy of an overclocked processor?

Overclocking a Raspberry Pi 3 is a practical response to some of its shortcomings (albeit ones that are dealt with in the more recent Raspberry Pi 3 B+).

Overclocking Is Always Risky

While overclocking Raspberry Pi is simple to achieve, it is not without risk.

overclock raspberry pi what why and how

Heat is generated: Cooling solutions are required if you plan to overclock your Pi. Heat is bad for computer systems, as it slows processing, which in turn generates heat.

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

Data corruption: Using increased clock speeds often results in corrupted data. 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 increasingly unreliable.

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 power supply.

At one stage, overclocking your Raspberry Pi would void the warranty. However, as of September 19, 2012, this is not the case, thanks to built-in overclocking tools; there is one setting that will affect the device warranty, however, which we’ll cover below.

How to Overclock a 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. 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 root directory

cd /

Next, change directory to boot.

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=1300
core_freq=500
sdram_freq=500
over_voltage=600

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.

Check Overclock Performance 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

Comparing the difference here should highlight the performance improvements you can expect with your Raspberry Pi overclocked.

overclock raspberry pi what why and how

Once you’ve discovered which maximum clock speed you’re happy with, you can carry on as normal… or you might prefer to use the force_turbo setting to keep the Pi running at maximum speeds. While you’re free to do this, it is the one factor in Raspberry Pi overclocking that definitely will void your warranty.

How to Recover a Failed Overclock

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

  • Power off the Raspberry Pi.
  • Remove the microSD card.
  • Insert the card into your PC’s card reader.
  • Rename \boot\config.old to config.txt.
  • Open the \boot\config.txt file.
  • Input the correct clock speed, and save.
  • Safely remove the microSD card, replace in your Pi, and boot.

Everything should now be back to normal.

Can Other Raspberry Pi Models Be Overclocked?

Overclocking is an option for older versions of the Raspberry Pi. As ever, take precautions to ensure the device is efficiently cooled. Use our Raspberry Pi comparison to check the correct clock speed of your model, and be sure not to increase the speed by more than 10 percent.

To overclock older Raspberry Pis, everything you need is built into the Raspbian operating system. Begin by opening the configuration tool, either on the desktop (Preferences > Raspberry Pi Configuration), or from the command line.

sudo raspi-config

After noting the warning, choose Overclock.

overclock raspberry pi what why and how

In the next menu, you’ll find a list of options. The currently-selected overclocking option will be None, but you’ll have a selection of up to five alternatives, depending on your Raspberry Pi model. Pictured below is the overclock screen for the Raspberry Pi 2.

overclock raspberry pi what why and how

While on other devices, overclocking is a case of making a small increase and testing, with preset options, this isn’t really necessary. All you need to do is select the overclocked preset you want to use, then select OK to apply it. However, if you’re trying non-standard overclocking that isn’t available via a preset option (using the config.txt file, as explained earlier), then make small, careful adjustments and test the results.

Note that overclocking can also affect the performance of connected hardware, such as the PiTFT display from Adafruit. As such, you’ll need to take additional precautions (such as manually adjusting the config.txt file after setting a new clock speed in the menu).

Overlocking is never an exact science. As such, you should spend some time assessing its impact on your Raspberry Pi and any regularly-used software. Our general guide to PC overclocking provides plenty of background information.


Read Full Article

No comments:

Post a Comment