There are a lot of situations when you need your hardware with better performance than it actually offers. This is when overclocking your Raspberry Pi may have a great influence on your project. But this process contains a lot of risks, such as warranty voidance, for example. How to deal with them and how to safely overclock your Raspberry Pi 3 in minutes - learn in this ultimate guide.
Project Based Learning (A.I).pptx detail explanation
Overclocking Raspberry Pi 3 Ulimate Guide
1. 3 Ways to Significantly
Overclock your Raspberry Pi
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.
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 document
without cooling!
2. Additional Hardware
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.
Important: upgrade your installed packages to their latest versions with the
command:
sudo apt-get update && sudo apt-get dist-upgrade
To check the system performance, you have to install the “sysbench” tool with
sudo apt-get install sysbench
• 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.
3. The equipment we need for overclocking is represented in the picture below.
1.) Raspberry Pi
2.) Power supply 5 Volt with 2500 mA
3.) A fan for build in the chassis
4.) Three heat sinks
5.) A chassis with gaps for memory heat skins and fan
4. Here is the Raspberry Pi assembled and prepared for overclocking.
The large heatsink is under the fan, the copper heat sink is on the bottom.
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
5. cpuinfo_cur_freq is the current running frequency for Raspberry Pi
Monitor the CPU temperature
To know the current temperature of CPU, 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
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
• boot_delay=1
6. After that, reboot your Raspberry Pi and check the current running frequency
again. It should now be set to 1200000 KHz.
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:
pi@raspberrypi:~ $ sysbench --test=cpu --cpu-max-prime=2000 --num-threads=4 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 4
Doing CPU performance benchmark
Threads started!
Done.
Maximum prime number checked in CPU test: 2000
Test execution summary:
total time: 4.9497s
total number of events: 10000
total time taken by event execution: 19.7724
per-request statistics:
min: 1.96ms
avg: 1.98ms
max: 21.36ms
approx. 95 percentile: 1.98ms
Threads fairness:
events (avg/stddev): 2500.0000/7.31
execution time (avg/stddev): 4.9431/0.00
pi@raspberrypi:~ $
Keep that in mind for the test at the end with the overclocked Raspberry Pi.
7. Overclocking your Raspberry Pi
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 means changing the “arm_freq” parameter -
Frequency of ARM, measured in MHz.
2. Overclocking the RPi GPU means 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 means 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” - ARM/GPU core
voltage adjust. Values above 6 are only allowed when the “force_turbo”
or “current_limit_override” parameters are specified (which set the
warranty bit).
6. Additional overclocking parameter: “force_turbo” - Disables dynamic
cpufreq driver and 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.
8. Overclocking Algorithm
Note: After each change to the /boot/config.txt you have to reboot
the system.
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
With that in mind, write to /boot/config.txt file the following
configurations (then reboot the Pi):
arm_freq=1300
core_freq=500
sdram_freq=500
over_voltage_sdram=0
If not, you have to reduce the arm_freq value down until the Pi
is running again
1
2
5
If your Pi does not boot or running unstable, count up the values
for the over_voltage_sdram until the Pi is running fine.
4
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
3
9. 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 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.
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.
10. Now, let’s see the memory information before we activate ZRAM.
The free -h and swap -s command shows that we have just 100MB swap-space
activated in our Raspberry Pi.
Now we can run ZRAM with the command sudo zram.sh.
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.
By running swap -s again we can see that we have four additional swap space
partitions created and running.
11. 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.
See the end of the /etc/rc.local file.
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.
12. 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:
pi@raspberrypi:~ $ sysbench --test=cpu --cpu-max-prime=2000 --num-threads=4 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 4
Doing CPU performance benchmark
Threads started!
Done.
Maximum prime number checked in CPU test: 2000
Test execution summary:
total time: 4.0150s (4.9497s)
total number of events: 10000
total time taken by event execution: 16.0324 (19.7724)
per-request statistics:
min: 1.57ms (1.96ms)
avg: 1.60ms (1.98ms)
max: 23.99ms (21.36ms)
approx. 95 percentile: 1.58ms (1.98ms)
Threads fairness:
events (avg/stddev): 2500.0000/6.96 (2500.0000/7.31)
execution time (avg/stddev): 4.0081/0.00 (4.9431/0.00)
pi@raspberrypi:~ $
As we can see, all the values are better than before without overclocking. The
green values are the ones from the first run.
Remove 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.
13. 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.
Don’t know what to start from?
Get inspired by our TOP-10 Projects for Raspberry Pi!
Make up your own Retropie gaming machine >>>
Play PC games on Raspberry Pi >>>
Need Windows applications? Install Wine and reach any goal! >>>
Run a Remote Desktop on Raspberry Pi for different purposes >>>
Create your own MetaTrader Bot for Automated Forex Trading >>>
Run TeamViewer On Raspberry Pi >>>
Setup Spotify on Raspberry Pi for Music Library Control>>>
Run Plex Media Server on RPi >>>
Dropbox on Raspbian for Backup and Storage >>>
Set up a TeamSpeak 3 Server on Raspberry Pi >>>