Question 1.14: Maximizing Performance Your Raspberry Pi seems to be very sl......

Maximizing Performance

Your Raspberry Pi seems to be very slow, so you want to overclock it to make it run faster.

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

You can increase the clock frequency of a Raspberry Pi to make it run a little faster. This will make it use a bit more power and run a little hotter (see the Discussion next).

The method of overclocking described here is called dynamic overclocking because it automatically monitors the temperature of the Raspberry Pi and drops the clock speed back down if things start to get too hot.

To make your Pi overclock, run the raspi_config utility by issuing the following command in a Terminal:

$ sudo raspi-config

Select the overclock option in the menu, and you are presented with the options in Figure 1-12.

Select an option. If you find that your Raspberry Pi starts to become unstable and hangs unexpectedly, then you may need to choose a more conservative option or turn overclocking off by setting it back to None.

Discussion

The performance improvements from overclocking can be quite dramatic. To measure these, I used a Raspberry Pi model B, revision 2, without a case at an ambient room temperature of 15 degrees C.

The test program was the following Python script. This just hammers the processor and is not really representative of the other things that go on in a computer, such as writing to the SD card, graphics, and so on. But it does give a good indication of raw CPU performance if you want to test the effect of overclocking on your Raspberry Pi.

import time
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
before_time = time.clock()
for i in range(1, 10000):
factorial(200)
after_time = time.clock()
print(after_time – before_time)

Check out the results of the test in Table 1-2.

As you can see, the performance has increased by 33%, but at a cost of drawing more current and a slightly higher temperature.

You can now buy self-adhesive heatsinks that fit onto the big chip at the center of the Raspberry Pi to help keep it cool. Some of these do not actually connect the heatsink to the chip with a thermally conductive compound and are therefore mostly for show. A well-ventilated enclosure (Recipe 1.2) may well be more effective. There have also been some efforts to add water-cooling to the Raspberry Pi. Frankly, this is just silly.

See Also

You can find much more information about the raspi-config tool at http://elinux.org/RPi_raspi-config.

Table 1-2. Overclocking
Speed test Current Temperature (degrees C)
700 MHz 15.8 seconds 360 mA 27
1 GHz 10.5 seconds 420 mA 30
1.12

Related Answered Questions

Question: 1.18

Verified Answer:

The Raspberry Pi camera module (Figure 1-17) is at...
Question: 1.17

Verified Answer:

Click on the red Logout button in the bottom-right...
Question: 1.15

Verified Answer:

You can use the raspi-config tool to change your p...
Question: 1.10

Verified Answer:

Many people have been caught out by this problem. ...
Question: 1.9

Verified Answer:

Unless you are embedding your Raspberry Pi in a pr...