DEV Community

Cover image for What is a Raspberry Pi HAT?
IgorIOT
IgorIOT

Posted on

What is a Raspberry Pi HAT?

How’s the lad?

Thanks to their GPIO headers, most Pi computers can connect to devices called HATs, which stands for Hardware Attached on Top. HATs are incredible add-ons to the Raspberry Pi that increase its functionality in a huge number of ways.

In short, it’s an additional card that you plug into your Raspberry Pi to bring new features. Generally, it uses the GPIO ports to connect the two cards together. The Raspberry Pi recognizes the HAT thanks to an EEPROM module on the board that identifies the HAT model.
The Raspberry Pi is an awesome platform for learning and experimentation. We can learn to code, build robots, monitor the location of the International Space Station, and so much more. But to make the most of the Pi, it helps to have the right HAT. There are hundreds of extensions that you can find for your Raspberry and there are several manufacturers for these Hats.

What is the HAT Specification?

The HAT (Hardware Attached on Top) specification was introduced by the Raspberry Pi Foundation in 2014 alongside the Raspberry Pi Model B+. Its goal was to create a standard for expansion boards, ensuring that accessories from different manufacturers would work consistently across Raspberry Pi models.
Before the specification existed, expansion boards often required manual configuration and users had to determine which GPIO pins were being used. The HAT standard simplified this process and improved interoperability.


Picture 1: Raspberry Pi Hat

Compatibility and standard

HATs follow an official specification defined by the Raspberry Pi Foundation, which includes:

  • A fixed GPIO pin layout
  • An EEPROM chip for automatic identification

This allows many HATs to work in a true “plug and play” manner.

The EEPROM stores information such as:

  • Manufacturer name
  • Product name
  • Product version
  • GPIO configuration
  • Device Tree overlays

When the Raspberry Pi boots, it can read this information and automatically configure the hardware.

This enables a much more plug-and-play experience compared to generic GPIO add-ons.


Picture 2: Place the hat on the GPIO pins

Standardized Physical Design

The specification defines:

  • The location of the 40-pin GPIO connector
  • Board dimensions
  • Mounting hole positions
  • Mechanical clearances

This ensures that HATs fit correctly on compatible Raspberry Pi models.

Hat VS pHat

In the ecosystem of the Raspberry Pi, the difference between a HAT (Hardware Attached on Top) and a pHAT (“partial HAT”) mainly comes down to size and compliance with the official standard. A HAT is a full-sized expansion board that follows the specifications defined by the Raspberry Pi Foundation, including the use of an EEPROM chip for automatic identification and configuration, ensuring plug-and-play compatibility. In contrast, a pHAT is a smaller, more compact board that still connects to the GPIO pins but does not necessarily follow all the official requirements—especially the EEPROM feature. While HATs are typically more standardized and robust for complex applications, pHATs are often simpler, cheaper, and ideal for lightweight or space-constrained projects.


Picture 3: Hat formats

GPIO Usage Declaration

A HAT should clearly declare which GPIO pins it uses.

This helps:

  • Prevent hardware conflicts
  • Enable automatic configuration
  • Improve compatibility with other add-ons

Device Tree Integration

Modern Raspberry Pi systems use Device Tree overlays to describe attached hardware.

A compliant HAT can provide overlay information through its EEPROM, allowing the operating system to automatically load the correct drivers and configuration settings.

For the user, this often means:

  • Attach the HAT.
  • Boot the Raspberry Pi.
  • Start using the hardware.

Without manually editing configuration files.

Power requirements

Not all HATs use the same amount of power:

  • Some are powered directly by the Raspberry Pi
  • Others require an external power supply (e.g., motor drivers or large displays)

Software and drivers

  • Many HATs need specific libraries or drivers
  • Some are auto-detected, while others require manual setup and configuration

Difference between HATs and generic add-ons

Not every board that fits on top is a true HAT:

  • A real HAT follows the official standard
  • Other boards may be referred to as add-ons or expansion boards

Physical limitations

  • Stacking HATs can block access to ports or connectors
  • Some projects use stacking headers to allow multiple boards to be used together

Although multiple HATs can sometimes be stacked together using extended headers, conflicts may occur when two boards attempt to use the same GPIO pins, I²C addresses, SPI buses, or power resources. Always check the documentation before combining multiple expansion boards.

Interesting Fact

The EEPROM does not contain the software driver itself. Instead, it stores metadata and configuration information that tells the Raspberry Pi which Device Tree overlay should be loaded and how the GPIO resources should be configured.

Manufacturer list

This is not an exhaustive list.

4tronix
Adafruit
Pimoroni
SparkFun
The Pi Hut
Waveshare

Links

Raspberry Pi HAT+ Specification

Hats

eeptools

The 10 best Raspberry Pi HATs

pinout

Remember to use the hashtag #JavaOnRaspberryPi on Twitter to show the world Raspberry Pi with Java.

Top comments (0)