The Official Raspberry Pi AI Kit is a hardware add-on that combines an M.2 HAT+ board with an Hailo-8 AI accelerator, giving a Raspberry Pi 5 the ability to run neural networks locally at high speed. You plug it into the Pi’s PCIe port, install the software stack, and then use it to accelerate tasks like object detection, image classification, and pose estimation without sending data to the cloud. The kit is designed for the Raspberry Pi 5 only, and it works with the Pi’s camera or any video source to deliver real-time AI inference.
Background: Why a Dedicated AI Accelerator?
Raspberry Pi boards are general-purpose computers, but their CPU and GPU are not optimized for the heavy matrix math that neural networks require. Running a modern object-detection model like YOLOv8 on a Pi 5’s CPU alone might give you a few frames per second at low resolution, which is too slow for real-time use. The AI Kit offloads that work to a dedicated neural processing unit (NPU), the Hailo-8, which can perform 26 tera-operations per second (TOPS). That’s roughly 26 trillion operations per second, a figure that dwarfs what the Pi’s CPU can handle. The result is that a Pi 5 with the AI Kit can run complex models at 30 frames per second or higher, making it practical for projects like smart security cameras, wildlife monitoring, or industrial inspection.
What’s in the Kit and How It Connects
The kit contains two main components:
- M.2 HAT+ board: a small PCB that attaches to the Raspberry Pi 5’s 40-pin GPIO header and its dedicated PCIe connector. It provides an M.2 socket for the accelerator card and includes a small fan to keep the chip cool.
- Hailo-8 M.2 module: a compact card that plugs into the M.2 socket. It is a single-chip NPU with 26 TOPS of computing power, and it draws less than 2.5 W under typical load.
You connect the HAT+ to the Pi 5 using the included ribbon cable that goes from the HAT’s PCIe connector to the Pi’s PCIe port. The HAT+ also needs power from the GPIO header, which it gets automatically when you press it onto the pins. After that, you enable the PCIe port in the Raspberry Pi configuration tool and reboot, and the system should recognize the Hailo-8 as a PCIe device.
How the Software Stack Works
Once the hardware is connected, the AI Kit relies on a set of software tools to run models. The core components are:
- Hailo-8 driver: a kernel module that lets the operating system communicate with the NPU. You install it via a script provided by Raspberry Pi, and it loads automatically at boot.
- HailoRT runtime: a software library that provides a programming interface for the NPU. It handles loading compiled models and managing inference requests.
- Raspberry Pi AI Kit examples: a collection of ready-to-run Python scripts that use the HailoRT API to perform tasks like object detection, segmentation, and pose estimation. These are available on the official Raspberry Pi GitHub repository.
The workflow is straightforward: you download a pre-compiled model (in Hailo’s .hef format), load it with HailoRT, and then feed it images or video frames. The NPU processes the data and returns results like bounding boxes and class labels. The Pi’s CPU handles the camera input, display, and any other logic, while the NPU does the heavy inference work.
Setting Up the AI Kit Step by Step
Here is the general setup process, which applies to Raspberry Pi OS (Bookworm or later):
- Power off the Pi, attach the HAT+ to the GPIO pins, and connect the PCIe ribbon cable between the HAT and the Pi’s PCIe slot.
- Insert the Hailo-8 M.2 module into the HAT’s M.2 slot and secure it with the screw.
- Power on the Pi and open a terminal. Run
sudo raspi-config, go to Advanced Options, and enable PCIe. - Reboot, then check that the device appears by running
lspci– you should see a Hailo device listed. - Clone the Raspberry Pi AI Kit repository:
git clone https://github.com/raspberrypi/ai-kit.git. - Run the installation script:
cd ai-kit && sudo ./install.sh. This installs the driver and HailoRT. - Reboot again, then run one of the example scripts, e.g.,
python3 basic_object_detection.py, to verify the setup.
If the installation script fails, check that you have the latest Raspberry Pi OS and that the PCIe port is enabled. A common issue is not having enough power – the Pi 5 should be powered with the official 27 W USB-C power supply, as the AI Kit adds a few watts of draw.
Common Problems and How to Fix Them
- Device not detected: If
lspcidoesn’t show the Hailo, re-seat the ribbon cable and ensure it’s fully inserted. Also verify that PCIe is enabled in raspi-config. - Install script fails: This often happens with an outdated OS. Run
sudo apt update && sudo apt full-upgradeand try again. - Low frame rate: The default examples use a high-resolution camera stream. Reduce the resolution or use a smaller model to speed things up.
- Overheating: The HAT+ includes a fan, but ensure it’s spinning and that the heatsink is properly attached. If the Pi throttles, performance drops.
Performance: What to Expect
With the AI Kit, a Raspberry Pi 5 can run YOLOv8s (a medium-sized object detection model) at around 30 frames per second on a 1080p video stream, according to benchmarks shared by Raspberry Pi. Smaller models like YOLOv8n can go faster, while larger models like YOLOv8m will be slower. The exact performance depends on the model complexity, input resolution, and whether you’re using the camera or a pre-recorded video. The NPU is the bottleneck in most cases, but the Pi’s CPU can also become a limiting factor when you add post-processing like drawing bounding boxes.
Alternatives and Comparisons
Before buying the AI Kit, consider other options:
- Google Coral USB Accelerator: a USB stick with an Edge TPU that works on any Pi model with USB 3.0. It’s cheaper but slower (4 TOPS) and has less software support.
- Intel Neural Compute Stick 2: discontinued, but still found used. It offers similar performance to the Coral but requires older software.
- Pure CPU inference: using only the Pi’s CPU with TensorFlow Lite or ONNX Runtime. This works but is much slower, often below 5 fps for modern models.
- Cloud inference: sending images to a cloud service. This avoids hardware cost but requires internet and introduces latency and privacy concerns.
The AI Kit is the best choice for Raspberry Pi 5 users who need high-speed local inference without the complexity of a separate GPU or cloud dependency. Its main drawback is that it only works with the Pi 5, so owners of older Pi models must look elsewhere.
Frequently Asked Questions
Does the AI Kit work with Raspberry Pi 4?
No, the AI Kit is designed exclusively for the Raspberry Pi 5. The Pi 4 lacks the PCIe connector that the HAT+ uses, so it cannot physically connect. If you have a Pi 4, consider a USB accelerator like the Coral instead.
What models can I run with the AI Kit?
You can run any model compiled for the Hailo-8, which includes common architectures like YOLO for object detection, ResNet for classification, and HRNet for pose estimation. Raspberry Pi provides pre-compiled models, and you can also compile your own using Hailo’s model zoo, though that requires a separate compilation toolchain.
Do I need to train my own model?
No, you can start with the pre-trained models included in the examples. If you have a custom model, you need to convert it to Hailo’s format using the Hailo Dataflow Compiler, which runs on a PC. That process is more advanced and requires some familiarity with neural network frameworks.
Can I use the AI Kit with a non-Raspberry Pi camera?
Yes, the AI Kit works with any video source that the Pi can access, including USB webcams, network streams, or pre-recorded video files. The examples typically use the Pi Camera Module, but you can modify the scripts to read from a file or a USB camera.
Is the AI Kit safe to leave running 24/7?
Yes, the kit is designed for continuous operation. The fan keeps the Hailo-8 cool, and the Pi 5 has good thermal management. Ensure proper ventilation and use the official power supply to avoid instability. The NPU draws under 2.5 W, so the total power consumption remains modest.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Emphasized Reaction Meaning & How to Use It30 points
- AC Ton to kW Calculator & Formula5.28 kW
- AC Tonnage to kW Calculator & Formula5.28 kW
- K Factor Heating Calculation Guide6.185
- How to Calculate Heating Value30.80 MJ/kg
- Best Power Tool Starter Kit for First Projects6.00 min/km