← How-Tos
raspberry-pi Aug 23, 2026 ◑ 4 views ◯ 5 min read

The Raspberry Pi HAT and pHAT Ecosystem Explained: Choosing and Stacking Add-On Boards

raspberry piHATpHATGPIOadd-on boardsexpansion boards

The Raspberry Pi's 40-pin GPIO header is the reason the platform has such a deep add-on ecosystem, but "just wire it up yourself" isn't always the best answer — a well-designed add-on board handles power regulation, connector strain relief, and mechanical fit in ways a breadboard and jumper wires never will. This guide explains the HAT specification and its variants, how to tell them apart, and how to choose the right add-on board instead of accidentally buying one that doesn't fit your Pi or conflicts with another board you're already using.

What Makes a Board a "HAT"

HAT stands for Hardware Attached on Top, and it's an actual specification, not just a marketing term for "any GPIO board." A board that's genuinely HAT-compliant must meet several requirements the Raspberry Pi Foundation defined specifically to make add-on boards safely auto-configurable:

Many popular "HAT" boards on the market are HAT-shaped (correct outline and header) but skip the ID EEPROM — these work fine but require manual driver setup rather than being auto-detected. That's a meaningful practical difference even though the physical board looks identical.

HAT, pHAT, and the Size Variants

Form factorFitsNotes HATFull-size Pi (3, 4, 5, and full-size Zero-compatible headers)Full 65mm x 56mm outline, standard mounting holes pHATPi Zero and Zero 2 W primarily, also fits full-size PisHalf-size — 65mm x 30mm — designed to keep a Zero-based build compact BonnetAny Pi with a 40-pin headerAdafruit's naming for their HAT-shaped boards; functionally the same idea, not an official spec term Zero HAT / Zero pHATPi Zero form factor specificallySome vendors explicitly size boards to match the Zero's smaller footprint even when electrically identical to a full HAT

The practical rule: a full-size HAT will physically fit on any 40-pin Pi, but a Pi Zero build with a full-size HAT stacked on top loses the whole point of using a Zero in the first place — check for a pHAT-sized version if board footprint matters for your enclosure.

Stacking Multiple HATs

This is where most HAT-related problems actually happen. Two HATs that each use I2C, or that both claim the same GPIO pin for something like a chip-select or reset line, will conflict the moment you try to stack them. Before combining boards:

Common HAT Categories and What to Look For

CategoryExamplesWhat to check before buying Power (PoE, UPS)Official PoE+ HAT, UPS HATs with 18650 cellsFan compatibility with your Pi's case, and whether it passes GPIO through for further stacking DisplaysOfficial touchscreen, small SPI TFT HATs, e-ink HATsWhether it needs the full header or leaves pins free for other HATs underneath AudioDAC HATs (HiFiBerry, IQaudio), I2S microphone HATsWhether it disables onboard audio/HDMI audio, and driver support for your OS version Motor/relay controlMotor driver HATs, relay HATsWhether it needs a separate motor supply — most motor HATs should not run motors off the Pi's own 5V rail Sensor/GPIO expansionADC HATs, environmental sensor HATs, breakout HATs with prototyping areaBus type (I2C vs SPI) and whether addresses are configurable if you'll want more than one Real-time clockRTC HATs with coin-cell backupPhysical height — coin cell holders often prevent flush stacking of a second board

When to Build Your Own Instead of Buying a HAT

A generic prototyping HAT (a bare board with a breadboard-style GPIO breakout and open row) is often the better answer when your needs are simple and specific — it costs less than a purpose-built HAT and avoids paying for features you won't use. For anything more involved, a custom HAT is a natural extension of the PCB design skills already covered in this site's KiCad and JLCPCB ordering guides — designing your own gives you the exact pin mapping, mounting, and power handling your project needs, and following the official HAT EEPROM spec means your board gets the same auto-configuration convenience as a commercial one.

Choosing an Approach

Buy a purpose-built HAT when a well-supported one already exists for your exact need — PoE, a display, audio, an RTC — since the driver support and documentation save real setup time over a from-scratch build. Reach for a generic prototyping HAT plus your own wiring when your need is narrow enough that a full purpose-built board is overkill. Design a custom HAT when you're combining several functions that no single commercial board covers, or building something meant to be reproduced and shared with others.