To power a Raspberry Pi 5, you must use a 27W (5V/5A) USB-C Power Delivery (PD) power supply. For a Raspberry Pi 4, a 15W (5V/3A) USB-C supply is required. Never rely on standard smartphone chargers or generic USB cables; they often lack the wire gauge or PD negotiation chips required to sustain voltage under load, leading to kernel panics, SD card corruption, and silent data loss.

Powering these boards is not just about plugging in a cable. The Pi 5 features a Renesas DA9098 Power Management IC (PMIC) that actively negotiates with the power supply. If the supply cannot provide 5A, the Pi 5 deliberately restricts downstream USB current to protect the board. Below is the exact hardware matrix, wiring methods, and debugging code you need to keep your embedded projects running without brownouts.

Project BOM (Bill of Materials):
  • Compute: Raspberry Pi 5 (8GB variant) or Raspberry Pi 4 Model B (4GB)
  • Power Supply: Official Raspberry Pi 27W USB-C PD Supply (for Pi 5) or 15W Supply (for Pi 4)
  • Cable: USB-C to USB-C cable with an e-marker chip rated for 5A (e.g., C2G or Cable Matters 100W/5A rated)
  • Monitoring: Standard 5mm Red LED with a 330Ω current-limiting resistor for GPIO warning indicator

Board-by-Board Power Specifications

Different Pi generations have vastly different power envelopes. The transition from micro-USB to USB-C brought Power Delivery negotiation, but the Pi 5 pushed those limits further by demanding 5A at 5V—a relatively rare PD profile that many off-the-shelf laptop chargers do not support (they typically jump from 5V/3A straight to 9V or 12V).

Board Variant Nominal Voltage Max Current Draw Recommended PSU Wattage Connector Type Behavior if PSU is Undersized
Raspberry Pi 5 5.0V DC 5.0A 27W (5V/5A) USB-C (PD 3.1) Limits USB ports to 600mA; logs PD warning
Raspberry Pi 4 Model B 5.0V DC 3.0A 15W (5V/3A) USB-C (PD 3.0) Throttles CPU; triggers under-voltage icon
Raspberry Pi 3B+ 5.1V DC 2.5A 12.5W (5.1V/2.5A) Micro-USB Throttles CPU; drops WiFi/BT stability
Raspberry Pi Zero 2 W 5.0V DC 2.0A (Peak) 10W (5V/2A) Micro-USB Brownouts during multi-core compilation

Source: Raspberry Pi Official Hardware Documentation

The Three Ways to Inject Power

While USB-C is the standard, embedded deployments often require alternative power injection methods. Here is how the three primary methods compare in terms of safety and implementation.

1. USB-C Power Delivery (Recommended)

The USB-C port on the Pi 4 and Pi 5 contains a PD controller that negotiates with the charger. The Pi 5 specifically requests the 5V/5A PDO (Power Data Object). If the charger only offers 5V/3A, the Pi 5 accepts it but engages a software current limit on the USB host controller to prevent the board from pulling more than 15W total. Always use a cable with an e-marker chip; without it, the PD controller will not negotiate currents above 3A due to USB-IF safety specifications.

2. GPIO 5V Injection (Advanced / Risky)

You can bypass the USB-C circuitry entirely by injecting 5V directly into the GPIO header. This is common in custom PCBs or robotics where a central 5V buck converter powers the Pi and peripherals simultaneously.

Safety Warning: GPIO power injection completely bypasses the Pi's onboard polyfuse and USB-C PD protection. If your external 5V regulator drifts to 5.5V or drops to 4.2V, you will instantly fry the PMIC or corrupt the filesystem. Only use high-quality, locked-feedback buck converters (like the RECOM R-78E5.0-1.0) for this method.
Function GPIO Pin (Physical) GPIO Pin (BCM) Notes
5V Power In Pin 2 N/A (Power) Main 5V rail injection point
5V Power In Pin 4 N/A (Power) Parallel to Pin 2 for redundancy
Ground Pin 6 N/A (Ground) Primary ground return
Ground Pin 9 N/A (Ground) Secondary ground return

3. Power over Ethernet (PoE)

Using an official PoE+ HAT (or the newer PoE+ HAT for Pi 5) allows you to deliver up to 25W over standard Cat5e/Cat6 ethernet cabling. The HAT contains an isolated flyback converter that steps down the 48V PoE line to 5V. This is the cleanest method for remote IoT deployments, though it adds roughly $15-$25 to the BOM cost and requires a PoE+ managed switch or injector.

Debugging Power Failures: Exact Errors and Fixes

When a Pi starves for current, the voltage on the 5V rail drops below 4.63V. The onboard voltage supervisor flags this, and the kernel logs a highly specific error string. If you are SSH'd into the machine and run dmesg | grep -i voltage, you will see:

[ 14.234567] Under-voltage detected! (0x00050005)

The hex code 0x00050005 is the throttled state register. Bit 0 indicates active under-voltage, and Bit 16 indicates under-voltage has occurred since boot. When this happens, the ARM CPU frequency is capped, and the little lightning bolt icon appears on connected HDMI displays.

The First Three Things to Check When It Fails

If you encounter the 0x00050005 error or the lightning bolt icon, do not immediately blame the power supply. Follow this ranked diagnostic path:

  1. Check the Cable's e-Marker and Gauge: This is the #1 cause of Pi 5 power issues. A standard USB-C phone cable is usually 28AWG or 24AWG on the VBUS line, which causes massive voltage droop at 5A. You must verify your cable is rated for 100W/5A (which guarantees an e-marker chip and thicker wire). Swap the cable first.
  2. Verify PSU PD Negotiation Profiles: Plug your PSU into a USB-C PD sniffer tool (like the FNIRSI FNB58 or a cheap inline PD tester). Verify it actually advertises a 5V/5A PDO. Many 65W laptop chargers advertise 5V/3A, 9V/3A, 15V/3A, and 20V/3.25A. The Pi 5 will reject the 9V+ profiles and choke on the 5V/3A profile.
  3. Isolate Downstream Peripheral Draw: Disconnect all USB devices (drives, hubs, SDR dongles). A spinning mechanical USB hard drive can pull 1.2A on startup. If the error stops when peripherals are unplugged, your PSU is adequate but your total system draw exceeds the 5A limit. You must use a powered USB hub for those peripherals.

Python Power Monitor: Catching Brownouts in Code

For headless embedded projects, you need a software watchdog that logs power events and triggers a physical warning indicator before the system locks up. The following Python script queries the Pi's VideoCore firmware using vcgencmd and illuminates an LED on GPIO 17 if a brownout is detected.

Target Board Variant: This code is written for Raspberry Pi 4B and Raspberry Pi 5 running Raspberry Pi OS (Bookworm or later) with the gpiozero library installed.

import subprocess
import time
import logging
import signal
import sys
from gpiozero import LED

# --- PIN DEFINITIONS ---
WARNING_LED_PIN = 17  # Physical Pin 11, BCM 17

# --- SETUP ---
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(levelname)s - %(message)s'
)
warning_led = LED(WARNING_LED_PIN)

def get_throttled_status():
    """Queries the VC firmware for the current throttled state hex code."""
    try:
        result = subprocess.run(
            ['vcgencmd', 'get_throttled'],
            capture_output=True, text=True, check=True
        )
        # Output format is typically: throttled=0x50005
        hex_val = result.stdout.strip().split('=')[1]
        return int(hex_val, 16)
    except subprocess.CalledProcessError as e:
        logging.error(f"vcgencmd failed: {e}")
        return None
    except Exception as e:
        logging.error(f"Unexpected error reading power state: {e}")
        return None

def check_power_integrity():
    """Parses the hex register to detect active or past under-voltage."""
    status = get_throttled_status()
    if status is None:
        return

    # Bit 0: Active under-voltage
    # Bit 16: Under-voltage has occurred since last boot
    active_undervolt = bool(status & (1 << 0))
    past_undervolt = bool(status & (1 << 16))

    if active_undervolt:
        logging.critical("ACTIVE UNDER-VOLTAGE: System is currently browning out!")
        warning_led.blink(0.2, 0.2)  # Fast blink for critical state
    elif past_undervolt:
        logging.warning("PAST UNDER-VOLTAGE: A brownout occurred since boot.")
        warning_led.on()  # Solid on to indicate past fault
    else:
        logging.info("Power status nominal.")
        warning_led.off()

def graceful_exit(sig, frame):
    """Ensures GPIO pins are cleaned up on Ctrl+C."""
    logging.info("Shutting down power monitor...")
    warning_led.off()
    sys.exit(0)

if __name__ == "__main__":
    signal.signal(signal.SIGINT, graceful_exit)
    logging.info("Starting Pi Power Integrity Monitor...")
    
    while True:
        check_power_integrity()
        time.sleep(5)  # Poll every 5 seconds to minimize CPU overhead

Source: Raspberry Pi Configuration & Firmware Documentation

Extending and Simplifying Your Power Build

Depending on your deployment environment, you will either need to strip your power system down to the bare minimum or build in redundant fail-safes.

How to Simplify the Build

If you are building a simple desktop tool or a media center, stop over-engineering the power delivery. Buy the official Raspberry Pi 27W USB-C power supply. It is a fixed 5.1V/5A supply that does not rely on complex PD negotiation handshakes—it simply outputs 5.1V immediately upon connection. The slight 0.1V over-voltage compensates for cable droop, entirely eliminating the 0x00050005 error without requiring you to source specialized 5A e-marker cables. For 90% of hobbyist builds, the official PSU is the ultimate simplification.

How to Extend the Build (Adding UPS and Telemetry)

For remote IoT gateways or critical data logging, a simple PSU is insufficient. You must extend the build with an Uninterruptible Power Supply (UPS) HAT.

  1. Select a UPS HAT: Modules like the Geekworm X1202 or PiJuice Base sit on the GPIO header and manage a 18650 lithium-ion cell or LiPo battery.
  2. Wire the I2C Telemetry: These HATs communicate via I2C (Pins 3 and 5). They expose battery State of Charge (SoC) and input voltage to the Pi via a Python API.
  3. Implement Safe Shutdown: Extend the Python script above to read the UPS battery level. If the main power drops (detected via the UPS I2C chip) and the battery falls below 15%, trigger a software sudo shutdown -h now command. This prevents the filesystem corruption that occurs when a Pi loses power while writing to the SD card.

Powering a Raspberry Pi reliably is an exercise in respecting the physical limits of copper wire and USB-C negotiation protocols. By matching the exact PD profile to your board variant, using properly gauged cables, and monitoring the kernel's throttle registers, you can ensure your embedded projects run indefinitely without silent brownout failures.