Buying guide · Beginner · 4 min read
Raspberry Pi HATs Explained
Types, Compatibility and How to Stack Them
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
A Raspberry Pi HAT is an add-on board in the standard 65 x 56.5 mm size that plugs onto the 40-pin GPIO header. Common types add PoE power, an M.2 NVMe drive, an AI accelerator, a UPS battery, motor drivers, relays or sensors. Check your Pi model first, because Pi 5 HATs use a PCIe flat cable and a different PoE connector, and watch for GPIO pin conflicts when stacking.
Key specs at a glance
- Size
- 65 x 56.5 mm for a full HAT; pHAT is Zero-sized
- Connector
- 40-pin GPIO header (3.3 V logic)
- Auto-config
- HAT ID EEPROM on GPIO0 and GPIO1 (ID_SD, ID_SC)
- Pi 5 high-speed link
- PCIe 2.0 x1 through a 16-pin flat-cable connector (HAT+ boards)
- Pi 5 PoE
- Dedicated 4-pin PoE header
- Typical power
- Pi 5 officially wants 27 W (5 V, 5 A) USB-C when running HATs
A shorted, over-charged or damaged lithium cell can get very hot and catch fire. Use a protection board or BMS, never short the terminals, charge on a non-flammable surface and do not leave a charging pack alone. Throw away cells that are swollen or dented.
What a HAT is and what it is not
HAT stands for Hardware Attached on Top. The specification fixes the board size, mounting holes and 40-pin connector, and adds a small identification EEPROM so the Pi can load the right drivers automatically. Boards that skip the EEPROM or the size rules are often sold as "HAT-style" or "expansion boards". They usually work fine, but you may have to enable an overlay by hand in /boot/firmware/config.txt.
A half-size version for the Pi Zero is called a pHAT. On the Raspberry Pi 5 the newer HAT+ specification also covers boards that talk over PCIe, such as NVMe drives and AI accelerators.
Popular HAT types
Pick by the job you need done:
| HAT type | What it adds | Pi models | Notes |
|---|---|---|---|
| PoE / PoE+ | Power and network from one Ethernet cable | 3B+ and 4 use the 4-pin PoE header; Pi 5 needs a Pi 5 PoE+ HAT | Needs a PoE switch or injector; includes a small fan |
| M.2 / NVMe | Fast SSD storage over PCIe | Pi 5 only | Official M.2 HAT+ supports 2230 and 2242 drives; boot from NVMe is possible |
| AI accelerator | 13 or 26 TOPS neural network inference | Pi 5 only | Used for object detection and camera pipelines |
| UPS / battery | Keeps the Pi running through power cuts | Most models | Choose cell size (18650 or 21700) and check safe shutdown support |
| Motor / stepper / servo | Drives DC motors, steppers or 16 servos | All 40-pin Pis | Needs its own motor power supply |
| Relay | Switches mains or DC loads | All 40-pin Pis | Use isolated relays for mains |
| Sense / sensor | IMU, temperature, humidity, LED matrix | All 40-pin Pis | Use stacking headers to keep it off the CPU heat |
| RTC / watchdog | Keeps time and resets the Pi if it hangs | Most models | A battery-backed clock helps Pi 5 projects keep time offline |
- PoE / PoE+
- What it adds:
- Power and network from one Ethernet cable
- Pi models:
- 3B+ and 4 use the 4-pin PoE header; Pi 5 needs a Pi 5 PoE+ HAT
- Notes:
- Needs a PoE switch or injector; includes a small fan
- M.2 / NVMe
- What it adds:
- Fast SSD storage over PCIe
- Pi models:
- Pi 5 only
- Notes:
- Official M.2 HAT+ supports 2230 and 2242 drives; boot from NVMe is possible
- AI accelerator
- What it adds:
- 13 or 26 TOPS neural network inference
- Pi models:
- Pi 5 only
- Notes:
- Used for object detection and camera pipelines
- UPS / battery
- What it adds:
- Keeps the Pi running through power cuts
- Pi models:
- Most models
- Notes:
- Choose cell size (18650 or 21700) and check safe shutdown support
- Motor / stepper / servo
- What it adds:
- Drives DC motors, steppers or 16 servos
- Pi models:
- All 40-pin Pis
- Notes:
- Needs its own motor power supply
- Relay
- What it adds:
- Switches mains or DC loads
- Pi models:
- All 40-pin Pis
- Notes:
- Use isolated relays for mains
- Sense / sensor
- What it adds:
- IMU, temperature, humidity, LED matrix
- Pi models:
- All 40-pin Pis
- Notes:
- Use stacking headers to keep it off the CPU heat
- RTC / watchdog
- What it adds:
- Keeps time and resets the Pi if it hangs
- Pi models:
- Most models
- Notes:
- A battery-backed clock helps Pi 5 projects keep time offline
Compatibility checklist
- 1Model. HATs for the Pi 3 and Pi 4 usually fit the Pi 5 mechanically, but PoE, fan and power-button features differ.
- 2Height. A Pi 5 Active Cooler or a tall heatsink can block a HAT. Use a longer stacking header or a HAT with cut-outs.
- 3Power budget. Add the Pi's draw to the HAT's draw and size the supply with 20 to 30% headroom. See Raspberry Pi power supplies.
- 4GPIO and I2C conflicts. Two HATs that use the same pins or the same I2C address cannot share the bus. Read each HAT's pin table and see the GPIO pinout.
- 5Mounting. Fit M2.5 standoffs at all four corners so the board does not flex the header.
Stacking safely
Use a stacking (extra-long) header so signals pass up through the first HAT. Put the board that needs the most current or cooling closest to the Pi. Never power a stack from two sources at once, for example USB-C and a PoE HAT, unless the HAT is designed for it. If a project needs more than two HATs, a GPIO splitter or a bare 40-pin breakout is usually easier.
Try it: Power supply sizing calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Buying a Pi 4 HAT for a Pi 5 and finding the PoE or fan connector does not line up.
- Stacking two boards that both use the same SPI chip-select or I2C address.
- Powering a stack of HATs from a 15 W phone charger.
- Forgetting standoffs, which bends the GPIO header over time.
- Putting a tall cooler under a HAT without checking clearance.
Frequently asked questions
Do all HATs work with the Raspberry Pi 5?
Most 40-pin HATs do, but features that rely on the Pi 4 PoE header, fan header or power button need a Pi 5 version. PCIe HATs only work on the Pi 5.
What is the difference between a HAT and a shield?
A shield is an Arduino add-on. A HAT is the Raspberry Pi equivalent with a standard size and an ID EEPROM.
Can I run two HATs together?
Yes if they use different GPIO pins and I2C addresses and their combined power fits the supply. Use stacking headers.
Do I need a HAT for an SSD?
On a Pi 5, the M.2 HAT+ is the easy way. On older Pis, use a USB 3 SSD enclosure.
Will a HAT void the warranty?
Add-on boards do not void the Pi's warranty, but damage caused by a faulty board may not be covered.
Do HATs need drivers?
Many are detected automatically from their EEPROM. Others need an overlay line in config.txt or a vendor script.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 3 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.




