Using the Raspberry Pi GPIOs with the Hailo AI HAT

Using the Raspberry Pi GPIOs with the Hailo AI HAT

The Hailo AI HAT brings powerful AI acceleration to the Raspberry Pi 5 via the PCIe M.2 interface. However, many users wonder whether they can still use the Raspberry Pi’s GPIO pins when the AI HAT is attached.

In this post, I’ll clarify the role of the GPIO header in the Hailo AI HAT setup, explain why some pins are used, and suggest ways to access GPIOs for additional hardware.


:electric_plug: Why Does the Hailo AI HAT Use the Raspberry Pi’s GPIO?

The 40-pin GPIO header on the Raspberry Pi is often used to connect sensors, displays, and other peripherals. However, when you install the Hailo AI HAT, it covers this header. Does this mean you lose access to all the GPIOs? Not necessarily.

The HAT Uses the GPIO Header for Two Main Purposes:

:one: EEPROM Identification

  • The Hailo AI HAT includes an EEPROM chip, which is connected via the I2C0 pins (pins 3 and 5, GPIO 2 and 3).
  • This EEPROM allows Raspberry Pi OS to automatically detect the HAT and configure the necessary settings, such as setting PCIe to Gen3.
    :warning: If this is not connected, the PCIe will operate in Gen2 mode, leading to significantly reduced performance.
  • More on HAT EEPROMs: Raspberry Pi HAT+ Specification

:two: Power and Ground

  • While the AI HAT receives power from the PCIe slot, it also connects to 5V (pins 2 & 4) and GND (pins 6, 9, 14, etc.) via the GPIO header.
  • These additional connections ensure stable power delivery, and are required to make sure the HAT can get enough power, preventing issues when running AI inference.

Should I use the GPIO header? (TL;DR: Yes!)

While you might be able to get things working without the GPIO header connected, you may encounter performance and power issues, especially under high loads. The AI HAT is designed to work optimally with the GPIO header connected.


:arrows_counterclockwise: Can I Still Use the Raspberry Pi GPIOs?

Yes, you can definitely use them!

The GPIO header included in the Raspberry Pi AI Kit physically blocks access to the pins, but this is just a physical limitation—not a functional one. The Hailo AI HAT follows the RPi HAT+ specification, and it is Raspberry Pi’s decision which GPIO header is included in the kit.

So, what can you do?

:small_blue_diamond: Option 1: Use an Extra-Long GPIO Header

You can purchase an extra-long GPIO header or a GPIO extension header to regain access to the pins underneath.

:small_blue_diamond: Option 2: Quick & Dirty Solution

If you need a fast workaround, you can:

  1. Remove the standoffs on the GPIO header side of the AI HAT.
  2. Push the HAT slightly to expose the necessary pins.
  3. Use jumper wires to connect your peripherals.

:warning: Important Note:

The I2C pins (GPIO 2 & 3) used as part of the HAT+ standard should be used with caution, as they are required during boot to read the EEPROM. Be sure to check Raspberry Pi’s documentation before using these pins for other purposes.

:speech_balloon: Have you tried accessing GPIOs with the AI HAT? Share your setup, mods, or solutions in the comments below! :rocket:

I’m wanting to attach extra I2C devices to my Pi 5 while running an Ai HAT, but I’m apprehensive because of this guide. When I look at other documentation it says that I2C0 and EEPROM processes run over GPIO pins 0 & 1, not the regular I2C pins (GPIO 2 & 3).

Can you clarify if the Ai HAT is connected to the I2C0 pins (0, 1) or the regular I2C pins (2, 3)?

:loudspeaker: Using I2C with Raspberry Pi HAT+

When using a HAT+, the EEPROM is connected to I2C-1 (GPIO 2 & 3, pins 3 & 5).
This bus is used during boot by the Raspberry Pi to read the EEPROM data (device info, overlays, etc.), and the EEPROM sits at address 0x50.

:hammer_and_wrench: You can reuse I2C-1 for your own devices after boot, but:

  • Make sure your devices don’t use address 0x50.
  • Ensure they do not interfere with I2C communication during boot, or the EEPROM read may fail.

Looking for more I2C buses? You can use a software-based I2C bus with overlays on other GPIOs.

:warning: While GPIO 0 & 1 (I2C-0) are physically available, using them depends on your system configuration and should be avoided unless you know exactly what you’re doing.

:blue_book: For full GPIO usage guidelines and safe I2C setup, check the official documentation:
:link: Raspberry Pi GPIO Documentation

The documentation you link to specifically states that EEPROM data is sent over GPIO0 and GPIO1:

  • I2C

    • Data: (GPIO2); Clock (GPIO3)
    • EEPROM Data: (GPIO0); EEPROM Clock (GPIO1)

Hence my confusion.

I know it also prints it out as a warning when you run setup_env.sh and it but It is also critical that your projects directory (hailo rpi 5 examples) will have writing permissions set for all users and not just root otherwise you cant actually access the GPIO pins within a pipeline without causing a runtime error because you cant use sudo from within the virtual environment (“RuntimeError: Cannot determine SOC peripheral base address”). There are probably more proper by the book solutions for this problem but i haven’t found it pointed out elsewhere, if that information was documented in the installation guide in the git it would make it way more accessible for the small subset of people who already know how to work with computer vision models but are new to raspberry pi\Linux.