Last Updated on
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 harware 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 mice 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
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:
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:
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. Use Fast MicroSD Card
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 following links: