On 14th May 2024, the Raspberry Pi Foundation announced the M.2 HAT+, a circuit board you can use to add M.2 peripherals such as NVMe storage drives and AI accelerators to the Raspberry Pi 5.

The HAT+ connects to the Raspberry Pi 5 using a flexible flat cable and can transfer data at speeds in excess of 800 MB/s. Priced at $12, it’s a fantastic, cheap upgrade that every Raspberry Pi 5 owner should consider buying.

Photo of a Raspberry Pi 4 with USB to SATA adapter and an SSD

The Need for an M.2 HAT+

Over many generations, the standard storage options for the Raspberry Pi were microSD cards and HDDs/SSDs connected using aUSB to SATA adapter. MicroSD cards are slow and unreliable, and SATA SSDs, although fast and reliable, occupy a USB 3.0 port on the Raspberry Pi.

NVMe SSDs are much faster compared to SATA SSDs. You can connect them using aUSB to M.2 enclosure, but the speed will remain the same as SATA SSDs because the USB will bottleneck it. This is the reason a faster interface was required.

Raspberry Pi 5 connected to a M.2 HAT

A HAT+ (Hardware Attached on Top Plus) is an enhanced version of the standard HAT. The “Plus” in HAT+ signifies enhancements that improve data transfer rates and support a wider range of peripherals. TheRaspberry Pi M.2 HAT+can supply up to 3 amps of current to connected peripherals. It also has the power and activity LEDs.

Connecting the M.2 HAT+ to a Raspberry Pi 5

The Raspberry Pi 5 has a PCIe (PCI Express) connector onboard. Using an FFC (flexible flat cable), you may connect the Pi 5 and the M.2 HAT+. The FFC supplies the power to the board and also transfers the data. There is no need to power the board separately. To meet the additional power demand, I highly recommend you use the official 27W power supply for the Raspberry Pi 5. The FFC is included along with the M.2 HAT+.

you’re able to plug inNVMe drives (M-key edge connector) into M.2 slot. Drives with form factor of 2230 (30mm in length) and 2242 (42mm) fit the board perfectly. Longer SSDs, although compatible, do not fit on the board.M.2 SATA SSDs are not NVMe typeand not compatible.

Raspberry Pi 5 Setting to enable PCIe Gen3

How Fast Is the M.2 NVMe on a Raspberry Pi 5?

The Raspberry Pi 5 uses RP1, a new controller chip that handles I/O. It offers more bandwidth and speeds up peripheral throughput. A fast microSD card can read at 100 MB/s, and a SATA SSD connected using a USB to SATA cable can do around 300 MB/s.

However, the M.2 NVMe on the HAT+ can read in excess of 400 MB/s, making it quite easily the fastest storage option for a Pi 5.

A person holding a Raspberry Pi 5 with installed Heatsink

The M.2 NVMe Can Perform Even Faster

Even budget NVMe drives easily do 3 GB/s. However, the Pi 5 has a single-lane PCIe 2.0 bus, and the speed is limited to 500 MB/s. The number of hardware lanes cannot be increased. However, you can change the bus to the PCIe 3.0 standard, which offers more bandwidth. This is done with a setting inside the config file.

Edit the file in the terminal:

Add a line:

Save the file with “ctrl+o” and reboot the Pi 5 to load the new configuration. This should start your Pi 5’s PCIe in Gen 3 mode. How much speed will the Pi 5 gain? More than double, and it will do in excess of 800 MB/s now. Just a word of caution: Gen 3 is not officially supported yet.

Can You Boot the Pi 5 With an M.2 NVMe SSD?

Yes! But you need to install the OS first. To install the OS on a microSD card, you will use a card reader. To install the OS on an NVMe drive, you need aUSB to M.2 adapter. However, this accessory is not very popular. You can do without it, especially if you do not install the OS frequently.

The trick is to first install Raspberry Pi OS on a microSD card. Boot from it, and then install the OS on the NVMe drive using aRaspberry Pi Imager. Once done, remove the microSD card, and the Pi 5 should boot from the NVMe SSD.

NVMe Speeds on a Raspberry Pi

Standards introduced by Raspberry Pi often become industry benchmarks. But, the delayed launch of the M.2 HAT+ has spurred third-party developments, likePimoroni’s NVMe Base.

The M.2 HAT+ is designed to be mounted over the Pi 5 using 16mm standoffs. This design looks compact, but there is just enough space to house the official Pi 5 cooler. The lack of clearance can impact airflow and increase the noise, particularly when the fan runs at its maximum speed.

Without a cooler, the Pi 5 will throttle in under a minute when the processor is maxed out. The design of the M.2 HAT+ does make it difficult to use anything but heatsinks with dimensions close to the official cooler.

The Pi 5 has a much-improved processor compared to the previous generation of Pis. To get the maximum out of a fast processor, it is essential to feed it quick data, so the M.2 NVMe is the right way ahead, and the future-proofed HAT+ standard is a bonus. Go for it; at $12, it is worth every bit.