Raspberry Pi
Family of single-board Linux computers, widely used as IoT gateways, controllers and home-automation hubs.
hardware
also known as Raspberry Pi 5, Raspberry Pi 4, RPi, Raspi
Knowledge about Raspberry Pi
- A Raspberry Pi-style GPIO header does not make Pi HATs and GPIO libraries workwarning · unverified · Alternative boards may copy the 40-pin layout, use a different header (Orange Pi 5 has 26 pins) or map pins differently. Pi-specific libraries, HAT drivers and camera/display connectors generally don't carry over; use the vendor's library (e.g. wiringOP) or the generic Linux GPIO interfaces.
- Banana Pi BPI-M4 Zero: a Pi Zero W-sized board with eMMC, and the K016 Wi-Fi module that has no 5 GHzguide · unverified · The BPI-M4 Zero has the form factor and 40-pin connector of the Raspberry Pi Zero W, an Allwinner H618, 2 or 4 GB LPDDR4 and 8 or 32 GB eMMC. Banana Pi notes that boards with the K016 Wi-Fi module don't support 5 GHz Wi-Fi. Armbian shows Standard support.
- Boot a Raspberry Pi 4/5 from NVMe, USB or the network: the BOOT_ORDER settingguide · unverified · BOOT_ORDER in the bootloader EEPROM config decides which media the Pi tries and in which order. It is read right to left, one hex digit per boot mode, e.g. 0xf46 for NVMe first, then USB.
- Debug GPIO from the shell with pinctrl: see pin modes, set levels, watch signalscode · unverified · pinctrl from raspberrypi/utils replaces raspi-gpio. It shows every GPIO's function and level, sets pins, lists alternate functions, and can poll pins as a basic logic analyser for slow signals.
- Designing your own Raspberry Pi add-on board or HAT: reserved ID pins, back-powering and the ID EEPROMguide · unverified · Raspberry Pi's add-on board rules: leave ID_SC/ID_SD for the ID EEPROM only, make back-powering safe, and protect against GPIO 6/14/16 being driven at boot. HAT EEPROMs are built and flashed with eeptools from raspberrypi/utils (the old hats repo is deprecated).
- Diagnose Raspberry Pi throttling and undervoltage with vcgencmd get_throttledprocedure · unverified · Decode vcgencmd get_throttled to tell undervoltage from overheating, read the SoC temperature, and know when the Pi throttles (80–85 °C) and how the Pi 5 fan responds.
- Don't run rpi-update on production devices: it installs bleeding-edge firmware and kernelswarning · unverified · rpi-update installs pre-release kernel and firmware builds that may contain regressions. Raspberry Pi's own README says to use it only for testing or to get a specific pending fix; normal updates come through apt.
- Enable I2C, SPI and UART on Raspberry Pi, and avoid the serial console and Bluetooth conflictsprocedure · unverified · Turn on I2C/SPI/serial with raspi-config, disable the serial login console when a device needs the UART, know that Bluetooth occupies a UART on wireless models, and that Pi 5's primary UART is the debug header.
- Flash a Compute Module's eMMC (or any Pi 4/5) over USB with rpibootprocedure · unverified · rpiboot from raspberrypi/usbboot boots a connected Pi into a USB mass-storage gadget so its eMMC, SD or NVMe appears as a drive on the host. Compute Modules need the nRPIBOOT jumper; Pi 5 needs the power button held while connecting.
- GPIO on Raspberry Pi 5: RPi.GPIO-based code stops working, use gpiozero with lgpiowarning · unverified · On Raspberry Pi 5 only the lgpio pin factory works in gpiozero; the RPi.GPIO, pigpio and native factories do not support Pi 5. Write GPIO code with gpiozero and keep within the 3.3 V and current limits.
- Headless Raspberry Pi setup: there is no default 'pi' user anymoreprocedure · unverified · Since the April 2022 Raspberry Pi OS release there is no default pi user. For headless IoT devices, preconfigure user, Wi-Fi and SSH in Raspberry Pi Imager's customisation, or use userconf.txt and the ssh file on the boot partition.
- Home Assistant database growing and SD card wearing out: tune the recorderwarning · unverified · The recorder writes every state change to home-assistant_v2.db and keeps 10 days by default. Exclude noisy entities, raise commit_interval, and keep the database off SD cards to save disk space and storage life.
- Home Assistant installation: OS or Container (Core and Supervised are deprecated)guide · unverified · Home Assistant OS and Home Assistant Container are the supported installation methods. Core and Supervised, and 32-bit systems, lost support with release 2025.12. Container installs have no apps (add-ons).
- Identify a Raspberry Pi in code: serial number for the device ID, device tree for the modelprocedure · unverified · For fleet IDs, read the board's unique serial number instead of relying on hostname, IP or MAC. For model detection, use /proc/device-tree/compatible or the board-type field of the revision code, never the 'Hardware: BCM2835' line or a list of exact revision codes.
- IoT projects: when a Raspberry Pi alternative makes sense and when to stay with the Pirecommendation · unverified · Choose an alternative for a concrete hardware need the Pi lacks (onboard eMMC, fast NVMe, 2.5G/dual Ethernet, NPU, lots of RAM, x86). Stay with Raspberry Pi when you depend on HATs, Pi-specific libraries, tutorials or long-term OS support.
- Let a frozen Raspberry Pi reboot itself: the hardware watchdog via systemd (max 15 s)procedure · unverified · Remote Pis occasionally hang. systemd can drive the built-in hardware watchdog with RuntimeWatchdogSec in /etc/systemd/system.conf, with no extra daemon. The bcm2835 watchdog can't time out after more than 15 seconds, so keep the value at or below that.
- Prevent SD card corruption on Raspberry Pi IoT devicesguide · unverified · Sudden power loss and bad supplies corrupt SD cards. Combine a good power supply, fewer writes, a read-only root with overlayfs (raspi-config), a UPS where possible, and SSD/NVMe boot on Pi 5.
- RPi.GPIO edge detection broke with kernel 6.6 (not only on Pi 5): switch to rpi-lgpio or gpiozerowarning · unverified · Since Raspberry Pi's 6.6 kernel, global GPIO numbers start at 512 instead of 0, and RPi.GPIO calls such as add_event_detect fail even on a Pi 4. Raspberry Pi engineers point to rpi-lgpio (same API, apt package python3-rpi-lgpio) or gpiozero. On Pi 5 the header GPIOs moved from gpiochip4 to gpiochip0.
- Raspberry Pi 4/5 bootloader EEPROM updates: automatic service, release channels, FREEZE_VERSION and A/B updatesprocedure · unverified · On Pi 4/5-class devices the bootloader lives in an EEPROM that rpi-eeprom-update updates automatically at startup. Know how updates are staged, how to pin a version for a fleet, and which update paths survive a power loss.
- Raspberry Pi 5 RTC: keep time without NTP and wake from a low-power halt on a scheduleprocedure · unverified · The Pi 5 has a built-in RTC with a J5 battery connector. With POWER_OFF_ON_HALT=1 and WAKE_ON_GPIO=0 in the bootloader config, an RTC wake alarm lets the board sleep in a very low-power state (about 3 mA) between periodic jobs.
- Raspberry Pi alternatives compared: Banana Pi, Orange Pi, ROCK64 / Radxa ROCK, ODROIDcomparison · unverified · What actually differs between Raspberry Pi and its alternatives: SoC vendor, OS and kernel support, GPIO/software compatibility, storage and networking. No universal winner: pick by the software you need first, hardware second.
- Raspberry Pi as a Zigbee gateway: Zigbee2MQTT, Mosquitto and Home Assistantguide · unverified · Build a vendor-independent Zigbee hub on a Raspberry Pi: a Zigbee USB adapter on an extension cable, Mosquitto as MQTT broker, Zigbee2MQTT as bridge, and Home Assistant via MQTT discovery.
- Raspberry Pi cameras today: rpicam-apps and Picamera2 on libcamera (raspistill and picamera are legacy)guide · unverified · Current Raspberry Pi OS drives cameras through libcamera: rpicam-apps for the command line (renamed from libcamera-*), Picamera2 for Python (install via apt, not pip). Many 'camera not working' reports are the cable in the DSI instead of the CSI port, or power.
- Raspberry Pi pin numbering: GPIO (BCM) numbers vs physical header pinsguide · unverified · 'Pin 17' means different things: BCM/GPIO numbering names the SoC signal, BOARD numbering counts header positions. gpiozero always works in BCM numbering and accepts 'BOARD11' or 'J8:11' as translations. Mixing the two is a classic wiring bug.
- Raspberry Pi secure boot is permanent: plan keys before using rpi-sb-provisionerwarning · unverified · Enabling secure boot programs OTP fuses: it can't be disabled and the key can't be changed afterwards. rpi-sb-provisioner automates secure boot, full-disk encryption and OS deployment for fleets, with a no-security mode for development.
- Raspberry Pi undervoltage: use the right power supply, especially on Pi 5warning · unverified · Weak power supplies and thin cables cause undervoltage, throttling and storage corruption. Pi 5 needs a 5 A (27 W) supply for full USB current; with any other supply it limits USB peripherals to 600 mA.
- Reach a headless Raspberry Pi over one USB cable: the rpi-usb-gadget Ethernet gadgetprocedure · unverified · rpi-usb-gadget makes the Pi appear as a USB network adapter to the host (CDC-ECM on Linux/macOS, RNDIS on Windows). It switches automatically between using the host's connection sharing and serving DHCP/NAT itself at 10.12.194.1/28.
- Run a Python IoT script as a systemd service that restarts on failurecode · unverified · A minimal systemd unit for a Raspberry Pi gateway script: starts at boot after the network, runs as its own user from a venv, restarts on failure, logs to the journal.
- Shut down a headless Raspberry Pi safely: a button instead of pulling the plugprocedure · unverified · Pulling the power risks SD card and file system damage. Give headless devices a shutdown button: the onboard power button (or J2 pads) on Pi 5, the gpio-shutdown overlay on earlier models. The default GPIO3 button also powers the board back on, but GPIO3 is the I2C clock pin.
- Wired-only Raspberry Pi: disable onboard Wi-Fi and Bluetooth in config.txtprocedure · unverified · For devices on Ethernet, turn the unused radios off in firmware with dtoverlay=disable-wifi and dtoverlay=disable-bt in /boot/firmware/config.txt. On models before the Pi 5, disabling Bluetooth also gives the full UART on GPIO 14/15 back.
Related
- alternative to (from): Banana Pi – Many SoC choices; some models add SATA/NVMe, eMMC, 2.5G Ethernet. Software support varies per model.
- alternative to (from): Banana Pi BPI-M4 Zero – Same form factor and 40-pin connector as the Raspberry Pi Zero W, per Banana Pi's documentation.
- alternative to (from): ODROID – Hardkernel boards including low-power RK3566 and x86 (Intel) options.
- alternative to (from): Orange Pi – Often more RAM/NPU per board; vendor images and a wiringPi port (wiringOP) instead of the Pi ecosystem.
- alternative to (from): ROCK64 – Older RK3328 board with USB 3.0 and gigabit Ethernet.
- alternative to (from): Radxa ROCK – RK3588-based ROCK 5B with PCIe 3.0 x4 NVMe, 2.5G Ethernet and NPU.
- part of (from): Raspberry Pi Compute Module
- part of (from): Raspberry Pi OS – Official OS for the hardware.