Raspberry Pi

Installation

Raspberry Pi Installation

USB to Ethernet Adapter

https://elinux.org/RPi_USB_Ethernet_adapters

Cases

For RPi 1 B : https://www.thingiverse.com/thing:4384009

Operating System

# Increase swap file
sudo dphys-swapfile swapoff
CONF_SWAPSIZE=1024 # in file /etc/dphys-swapfile
sudo dphys-swapfile setup
sudo dphys-swapfile swapon

# Disable HDMI
/usr/bin/tvservice -o
# Doesn't work with latest version which uses `DRM VC4 V3D driver`
# Modify the line of the driver to disbale HDMI :
dtoverlay=vc4-kms-v3d,nohdmi
# ref : https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README#L4571C13-L4571C13

# /boot/config.txt tweaks
# https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README

## Disable splash screen
disable_splash=1

## Disable Bluetooth
# https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README#L921
dtoverlay=disable-bt

## Disable WIFI if not used
# https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README#L938
dtoverlay=disable-wifi

## Disable HDMI
dtparam=hdmi=off
## SD card working freq (default 50MHz)
dtparam=sd_overclock=100
## Disable SD card check
dtparam=sd_poll_once=on
## Disable audio
dtparam=audio=off

# then disable services
sudo systemctl disable hciuart.service
sudo systemctl disable bluealsa.service
sudo systemctl disable bluetooth.service

https://haydenjames.io/raspberry-pi-performance-add-zram-kernel-parameters/

Overclocking

Display frequencies

sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq # max
sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq # min
sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq # current

# Get live metrics
watch -n1 vcgencmd measure_clock arm
watch -n1 vcgencmd measure_temp

https://picockpit.com/raspberry-pi/overclock-raspberry-pi/
https://www.tomshardware.com/how-to/overclock-any-raspberry-pi
https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md

Model config.txt settings
Raspberry Pi 1 Model A & B arm_freq=1000
core_freq=450
over_voltage=6
sdram_freq=450
Raspberry Pi 3 & Compute Module 3 arm_freq=1300
source: picockpit (heatsink compatible) core_freq=500
over_voltage=4
sdram_freq=450

Default configuration file

# Personal /boot/config.txt

# Presets RPI1 - Use at least a heatsink !!
# =======
# TYPE : ARM ; CORE ; RAM ; VOLT
# None :   700 ; 250 ; 400 ; 0
# Modest : 800 ; 250 ; 400 ; 0
# Medium : 900 ; 250 ; 450 ; 2
# High :   950 ; 250 ; 450 ; 6
# Tubro : 1000 ; 500 ; 600 ; 6

[pi1]
arm_freq=900 # CPU (default 700)
core_freq=250 # GPU (default 250) - Helps with L2 cache, better for RPI1
sdram_freq=450 # RAM (default 400)
over_voltage=2 # Overall voltage (default 0)

[pi3]
arm_freq=1200 # CPU (default 1200)
core_freq=400 # GPU (default 400) - Helps with L2 cache, better for RPI1
sdram_freq=450 # RAM (default 450)
over_voltage=0 # Overall voltage (default 0)

[all]
# Disable splash screen
disable_splash=1
# Disable serial
enable_uart=0
# Set GPU RAM to minimum (headless)
gpu_mem=16
# Give a small delay for the boot (better safe than sorry)
boot_delay=1
# Disable Bluetooth
dtoverlay=disable-bt
# Disable audio
dtparam=audio=off
# Disable HDMI
dtparam=hdmi=off
dtoverlay=vc4-kms-v3d,nohdmi
# Overclock SD Card controller in MHz - Enable this only if not booting on USB
# dtparam=sd_overclock=100 # default 50
# Disable SD Card polling once started
dtparam=sd_poll_once=on
## Disable WIFI if not used
# dtoverlay=disable-wifi

More optimizations

https://picockpit.com/raspberry-pi/raspberry-pi-zero-2-battery/

Resources

https://feriman.com/raspberry-pi-optimization-hardware-and-software/
https://di-marco.net/blog/it/2020-04-18-tips-disabling_bluetooth_on_raspberry_pi/
https://pibenchmarks.com/latest/

Docker Installation

Docker INstalltion

https://docs.docker.com/engine/install/raspbian/#install-using-the-repository

sudo su -
apt-get install ca-certificates curl gnupg

# Install Docker repository
curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/raspbian \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

apt-get update


# Install Docker engine
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Check it works
docker run hello-world

groupadd docker

Tips, tricks and hacks

https://www.dzombak.com/blog/tag/raspberry-pi/