Tricks to improve Raspberry Pi performance and power consuption

3
(24)

Last Updated on 15th September 2020 by peppe8o

Raspberry PI 4 model B image

Raspberry Pi is an extraordinary board, useful for several home and educational projects. Even if it has an excellent operating system with Raspberry PI OS Lite, there are some ways to get the best from your board, expecially if you plan to use it as server.

Below you can find a list of tricks to improve Raspberry PI performances and reduce power consuption.

These tricks don’t include overclock (both CPU and RAM) because this could lead to hardware damages hardly repairable.

1. Using the correct input power

Even if Raspberry Pi can use a common smartphone power supply, it is vital to check the power offered from different power supply available. Some charger can only provide low ampere, so these power supply may appear correctly working but they could strongly afflict performances.

Below, what is reported in Raspberry Pi official docs:

“The Raspberry Pi 3 is powered by a +5.1V micro USB supply. Exactly how much current (mA) the Raspberry Pi requires is dependent on what you connect to it. We have found that purchasing a 2.5A power supply from a reputable retailer will provide you with ample power to run your Raspberry Pi. You can purchase the official Raspberry Pi Power Supply from our website, and you can learn more about the differing power requirements of the various models of the Raspberry Pi on our FAQ page.

Typically, the model B uses between 700-1000mA depending on what peripherals are connected; the model A can use as little as 500mA with no peripherals attached. The maximum power the Raspberry Pi can use is 1 Amp. If you need to connect a USB device that will take the power requirements above 1 Amp, then you must connect it to an externally-powered USB hub.

The power requirements of the Raspberry Pi increase as you make use of the various interfaces on the Raspberry Pi. The GPIO pins can draw 50mA safely, distributed across all the pins; an individual GPIO pin can only safely draw 16mA. The HDMI port uses 50mA, the camera module requires 250mA, and keyboards and mouse can take as little as 100mA or over 1000mA! Check the power rating of the devices you plan to connect to the Pi and purchase a power supply accordingly.”

So, be carefull on using correct Power Supply, expecially if you are going to run power consuming services.

2. Installing ZRAM

zram, formerly called compcache, is a useful module for creating a compressed block device in RAM, like well known RAM-Disks, but with on-the-fly “disk” compression. The block device created with zram can then be used for swap or as general-purpose RAM disk.

The RPI ZRAM from novaspirit improves this feature automatically detecting the number of CPU cores to allocate to ZRAM computation, disabling existing swap and enabling ZRAM swap.

You can find more info in ZRAM project GitHub page. Below the instructions to install RPI_ZRAM:

Download the script and copy to /usr/bin/ folder

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

make file executable

sudo chmod +x /usr/bin/zram.sh

edit /etc/rc.local file to run script on boot

sudo nano /etc/rc.local

add line before exit 0

/usr/bin/zram.sh &

3. Reduce GPU RAM

Raspberry PI shares RAM with its graphical card. So, if you plan to use your Raspberry as server then you probably prefer to assign the lowest RAM amount to GPU. Below the instructions to manage this:

Enter the Raspberry Pi Software configuration tool:

sudo raspi-config

Go to Advanced Options -> Memory Split and set this value to the minimum (16).

4. Disable HDMI

Leaving HDMI circuit on in a board that we can manage by ssh connection (so, without display and/or keyboards) is power wasting. Raspberry Pi foundation refers that HDMI circuits can consume up to 25mA.

As we said before, power management can be crucial for our boards. So you can turn it off with a simple command:

/usr/bin/tvservice -o

If you want this to be applied also at boot time, add this command to the end of you /etc/rc.local (before the line “exit 0”).

4. Disable Bluetooth Module

One more module unused in headless installations. This is really rare that you will need bluetooth on when using your RPI in headless mode. You can disable bluetooth module by editing config.txt file:

sudo nano /boot/config.txt

and appending at the end:

dtoverlay=disable-bt

This should save addictional 60 mA to your RPI power consumption.

5. Use Fast MicroSD Card

SANDISK Ultra 16GB MicroSD

SD card for Raspberry PI are something similar to Hard Disks for Personal Computers. SD cards differs each from others in Read/Write speed. A faster SD card means something like when you change your PC Hard Drive with a SDD: it is similar to a generation jump.

Prefer at least class 10 micro SD cards.

Let me know if you want to suggest other tricks!

Check hardware prices with the following links:

Amazon raspberry pi boards box
Amazon raspberry pi Zero W box
Amazon Micro SD box

What’s Next

If you are interested in more Raspberry PI projects, take a look at my Raspberry PI tutorials.

Enjoy!

How useful was this post?

Click on a star to rate it anonymously!

Average rating 3 / 5. Vote count: 24

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?