Linuxセットアップガイド

Linuxセットアップガイド

Raspberry Pi

I2C確認

ターミナル
i2cdetect -y 1

仮想メモリサイズの変更

ターミナル
sudo swapon --show #現在の仮想メモリサイズを確認
sudo dphys-swapfile swapoff # 仮想メモリの使用を中止
sudo nano /etc/dphys-swapfile

エディタ
CONF_SWAPSIZE=2048

ターミナル
sudo dphys-swapfile setup # 仮想メモリを再生成
sudo dphys-swapfile swapon # 仮想メモリの使用を開始
sudo reboot

RTCの電圧確認

ターミナル
cat /sys/devices/platform/soc@107c000000/soc@107c000000:rpi_rtc/rtc/rtc0/battery_voltage

UIの修復

ターミナル
startx
sudo apt install raspberrypi-ui-mods

EEPROMの書き換え(Raspberry Pi 5用)

ターミナル
sudo rpi-eeprom-config --edit

エディタ
[all]
BOOT_UART=1
POWER_OFF_ON_HALT=0
BOOT_ORDER=0xf164

# USBブート(4) → NVMe(6) → microSD(1) → Restart(f)
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#BOOT_ORDER

ディスククローン (SD Card Copier)

SDCardCopier

pigpio有効化(Raspberry Pi 5を除く)

ターミナル
sudo pigpiod
sudo systemctl enable pigpiod
sudo systemctl restart pigpiod

KDiskMarkのインストール

ターミナル
sudo apt install flatpak -y
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install flathub io.github.jonmagon.kdiskmark
sudo reboot

ピンアサイン

Raspberry Pi

Raspberry Pi ピンアサイン

Raspberry Pi Pico

Raspberry Pi Pico ピンアサイン

Raspberry Pi Pico W

Raspberry Pi Pico W ピンアサイン

サンプルプログラム

Lチカ

Python
import gpiozero
from time import sleep

if __name__ == "__main__":
    led_pin = gpiozero.DigitalOutputDevice(pin=18)
    led_pin.value = 0
    while True:
        led_pin.value = 1 - led_pin.value
        sleep(1)