nox.im · All Posts · All in Embedded · All in Ubuntu

Raspberry Pi 4 SBC Projects

Since I have a few use cases for small footprint, isolated computers, I bought myself a few Raspberry Pi single board computers (SBC) recently. Having last toyed with the SBC in 2012, it was about time to catch up on how the ecosystem has evolved. The following specs cost currently the equivalent of $75.

Raspberry Pi 4, Model 4b, B 8GB

Chipsets and data sheet:

Model:      RPi 4B, 2020
RAM:        8GB LPDDR4-3200 SDRAM
CPU:        Broadcom BCM2711, ARM Cortex-A72 ARMv8 64bit, quad-core, 1.5 GHz
            28 GPIO pins
            I2C, PWM, SPI, UART
Ethernet:   Broadcom BCM54210PE
            IEEE 1588-2008 compliant
            supporting POE (power over ethernet)
Wireless:   Cypress CYW43455
            2.4 GHz, 5.0 GHz IEEE 802.11 b/g/n/ac wireless
            Bluetooth 5.0, BLE.
PCIe:       Gen2 x1, Via Labs VLI805 USB 3 host controller
Video:      Dual HDMI 2.0
            single 4kp60 or dual 4kp30
            CSI-2 (MIPI Serial Camera), e.g. for Sony IMX219 / IMX477
Thermal:    Operating temperature range: -20°C - +85°C
Power:      USB-C

I’m adding and listing the projects I’m using the Pi for.

General Purpose Ubuntu Server 2021.10

A convenient way to flash Ubuntu Server is using a microSD card reader with the official Raspberry Pi imager util on MacOS:

Raspberry Pi Imager to flash micoSD cards from MacOS

Sign in with ubuntu:ubuntu and change the password.

How to setup Raspberry Pi as a WiFI client for Ubuntu Server

We edit

sudo vi /etc/netplan/50-cloud-init.yaml

setup the wifi AP and password and add Quad9/Cloudflare DNS:

network:
    ethernets:
            eth0:
                    dhcp4: true
                    optional: true
    version: 2
    wifis:
            wlan0:
                    optional: true
                    dhcp4: true
                    nameservers:
                            addresses: [9.9.9.9,1.0.0.1]
                    access-points:
                            "<SSID>":
                                    password: "<SSID Password>"

test this

sudo netplan --debug try

and if ok

sudo netplan --debug generate
sudo netplan --debug apply
reboot

Connect from MacOS to the servers by finding its IP

ip a
3: wlan0:
    inet 192.168.1.168/24

then ssh into our server as usual ssh ubuntu@192.168.1.168. I would continue by installing software as needed, e.g.

apt-get update -y
apt-get upgrade -y

apt-get install net-tools go docker julia wireguard tmux

I’m also connecting Ubuntu as a client to my WireGuard VPN server.

Troubleshooting Notes

I should mention that I was constantly getting an error when using sudo on Ubuntu:

sudo: unable to resolve host ubuntu: Name or service not known

runinning hostname yielded “ubuntu” so this could be resolved by adding 127.0.0.1 ubuntu to /etc/hosts.

Raspberry Pi as a Solana Validator

I’ve added a dedicated article on the subject of running the above general purpose Ubuntu Solana Validator.

Raspberry Pi as a Router and Wifi Access Point

I use one Raspberry Pi 4 now as a home router. Installing Raspberry Pi OS and RaspAP, first setting the location with:

sudo raspi-config

then invoke RaspAP’s installer:

curl -sL https://install.raspap.com | bash

The defaults are as follows:

IP address: 10.3.141.1
Username: admin
Password: secret
DHCP range: 10.3.141.50 — 10.3.141.255
SSID: raspi-webgui
Password: ChangeMe

I then go to http://10.3.141.1/ and configure the AP country for 5G AC on channel 31, enable adblock and set up Quad9 DNS servers. Make sure to change all the passwords, also ssh into the box and do a passwd shell password change.

At this point I have my pi sitting on the floor and I’m uneasy with it idling at ~60-70°C. So I purchased a casing at a shop nearby. They had the Argon One v2 Pi 4 case which is partially aluminium and connects to the SOC for heat dissipation. The the partially assembled Argon One with one of my Pi 4s:

Argon One v2 Pi 4 Case - Disassembled

After assembly, my new wifi access point looks pretty neat and idles at ~40°C without using the fan of the case.

Argon One v2 Pi 4 Case - Assembled

Control Wifi tx power

The default transmit power of the Raspberry Pi is set to an insane 31dbm (1300mw). Typical mobile devices max out at 12dBm (15mW). Remember the dBm value raised by 10 means a multiplication of the mW value by 10:

0dBm = 1mW
10dBm = 10mW
20dBm = 100mW
30dBm = 1000mW

I assume the driver dynamically adjusts the actual tx power for what is required for a reliable connection, while not exceeding txpower. Nevertheless I feel more comfortable limiting tx power to 10 dbm (10mW) by adding the following line to:

sudo vi /etc/rc.local
iwconfig wlan0 txpower 10

I’ve also disabled disassoc_low_ack from the UI.

Raspberry Pi on the Road: Uninterruptible power supply

I like to power some devices with an uninterruptible power supply (UPS). Raspberry Pi’s can be powered easily from power banks that can be hooked to a charging outlet and the device at the same time. Assuming a medium to high power draw from some online sources I can assume the 4B will draw around 600mA. We can easily compute how many hours a 10,000mAh power bank can bridge power outages:

Time(H) = Capacity(Ah)/Current(A)
        = 10,000/600 ≈ 16h

To be continued …

I’ll update this with more projects soon.


Published on Saturday, Oct 30, 2021. Last modified on Sunday, Mar 13, 2022.
Go back

If you’d like to support me, follow me on Twitter or buy me a coffee. Use Bitcoin
BTC address: bc1q6zjzekdjhp44aws36hdavzc5hhf9p9xnx9j7cv