Real-Time Object Detection with the Raspberry Pi AI HAT+

Last updated September 2026. Some links on this page may be affiliate links, which means RPi4U may earn a small commission at no extra cost to you.

By the end of this guide, your Raspberry Pi 5 will watch a live camera feed and draw labeled boxes around people, pets, cars and dozens of other everyday objects, smoothly and in real time. The heavy lifting happens on a Raspberry Pi AI HAT+, a small add-on board with a dedicated neural network chip.

Everything runs on the Pi itself. No cloud account, no subscription, and no video leaving your home network. That makes it a solid base for a pet cam, a people counter or a bird feeder that knows what just landed.

At a glance

DifficultyIntermediate
TimeAbout 1 hour
Works onRaspberry Pi 5 only
Parts cost (approx, US)About $233 (Pi 5 4GB, AI HAT+ 13 TOPS, Camera Module 3, PSU, cooler, microSD)

What you need

  • Raspberry Pi 5 (the 4GB model is plenty for vision demos)
  • Raspberry Pi AI HAT+, 13 TOPS (Hailo-8L). The 26 TOPS version (Hailo-8) is a drop-in upgrade if you want higher frame rates or bigger models.
  • Raspberry Pi Camera Module 3
  • A Standard-Mini camera cable, because the Pi 5 uses the smaller 22-pin camera connector
  • Official 27W USB-C power supply
  • Raspberry Pi Active Cooler
  • microSD card (32GB or larger)
  • A monitor, micro-HDMI cable, keyboard and mouse, so you can see the live preview window
  • A computer to flash the microSD card with Raspberry Pi Imager

How the AI HAT+ helps

TOPS stands for “trillion operations per second,” a rough measure of how much math an AI chip can crunch each second. The Pi 5’s CPU can run small detection models, but only at a few frames per second. The AI HAT+ connects over PCIe and takes over the neural network work, so the CPU is free to handle the camera, the display and your own code.

Raspberry Pi also sells a newer AI HAT+ 2 (40 TOPS, Hailo-10H, with 8GB of onboard memory) aimed at running language and vision-language models. It uses a different software package, noted below. For camera object detection, the original AI HAT+ is the cheaper and well-supported choice.

Step 1: Flash Raspberry Pi OS

The AI software expects the current 64-bit Raspberry Pi OS, which is based on Debian “Trixie.”

  1. Open Raspberry Pi Imager on your computer.
  2. Choose Raspberry Pi 5 as the device and Raspberry Pi OS (64-bit) as the operating system. Pick the desktop version so you get the preview window.
  3. Select your microSD card, set a username, password and Wi-Fi in the customization settings, then write the card.

New to this part? Our first setup guide walks through Imager screen by screen.

Step 2: Assemble the hardware

Do all of this with the power unplugged. Raspberry Pi suggests connecting the camera before the HAT, since the camera connectors are harder to reach once the board is on top.

  1. Fit the Active Cooler. Line up its two white push pins with the heatsink holes on the Pi 5 and press until they click. Plug the fan cable into the small fan connector on the board.
  2. Connect the camera. Use either connector labeled CAM/DISP0 or CAM/DISP1, between the micro-HDMI ports and the Ethernet jack. Gently lift the locking flap, slide in the narrow end of the cable with the metal contacts facing away from the flap, and press the flap down. At the camera end, the contacts face the camera board.
  3. Add the spacers and header. Screw the four spacers onto the Pi using the longer screws, then push the GPIO stacking header firmly onto the Pi’s 40 GPIO pins.
  4. Connect the PCIe ribbon. The flat ribbon comes attached to the HAT. Unclip it from the HAT, then open the clips on the Pi 5’s PCIe connector, insert the ribbon with the metal contacts facing inward, and close the clips.
  5. Mount the HAT. Lower it onto the header and spacers and fasten it with the four shorter screws.
  6. Reconnect the ribbon to the HAT. Push it into the HAT’s PCIe connector and close its clips.

Route the camera cable out the side so it doesn’t get pinched under the HAT. Then plug in the monitor, keyboard, mouse and finally the 27W power supply.

Step 3: Update and install the Hailo software

Open a Terminal and bring the system and bootloader firmware fully up to date first. The Hailo driver depends on a recent kernel.

sudo apt update
sudo apt full-upgrade -y
sudo rpi-eeprom-update -a
sudo reboot

After the reboot, install the build tool the driver needs and then the Hailo bundle. hailo-all is a single package that brings in the Hailo driver, runtime and camera demo support.

sudo apt install dkms
sudo apt install hailo-all
sudo reboot

If you bought the AI HAT+ 2 instead, install hailo-h10-all in place of hailo-all.

You don’t need to enable PCIe Gen 3 by hand. That step is only for the older AI Kit; the AI HAT+ turns on the faster link automatically.

Step 4: Check that the Pi sees the HAT

hailortcli fw-control identify

It should print details about the board, such as its firmware version and device type. If the command errors out, check the kernel log for clues:

dmesg | grep -i hailo

Next, confirm the camera works on its own. A preview window should open for a few seconds.

rpicam-hello

Step 5: Run the detection demos

The rpicam-apps camera tools accept a post-processing file that tells them which model to run on the HAT and how to draw the results. Start with YOLOv8 object detection. The -t 0 option keeps the preview running until you press Ctrl+C.

rpicam-hello -t 0 --post-process-file /usr/share/rpi-camera-assets/hailo_yolov8_inference.json

Walk in front of the camera or hold up a cup, phone or banana. Each detected object gets a box, a label and a confidence score. Other detection models are in the same folder, so you can compare their speed and accuracy by swapping the file name to hailo_yolov6_inference.json, hailo_yolox_inference.json or hailo_yolov5_inference.json.

Pose estimation

This draws a stick-figure skeleton over each person, tracking joints like elbows and knees.

rpicam-hello -t 0 --post-process-file /usr/share/rpi-camera-assets/hailo_yolov8_pose.json

Image segmentation

Segmentation colors in the exact shape of each object instead of drawing a box. It is more demanding, so the frame rate is capped at 20.

rpicam-hello -t 0 --post-process-file /usr/share/rpi-camera-assets/hailo_yolov5_segmentation.json --framerate 20

Going further with Python

To act on detections in your own code (send an alert, count people, log a species), look at Hailo’s example pipelines on GitHub. The older hailo-rpi5-examples repository is now marked as outdated, and Hailo points users to hailo-apps instead. It supports the Hailo-8, Hailo-8L and Hailo-10H. The basic flow looks like this, but follow the README for the current details:

git clone https://github.com/hailo-ai/hailo-apps.git
cd hailo-apps
sudo ./install.sh
source setup_env.sh
hailo-detect-simple

Run source setup_env.sh again each time you open a new Terminal.

Project ideas

  • Pet cam: save a snapshot only when a dog or cat appears, instead of recording hours of an empty room.
  • People counter: count how many people pass a doorway or hallway during the day.
  • Bird feeder classifier: detect when a bird lands, then grab a photo for a second model or for you to identify later.

A note on privacy: all of the image processing happens on the Pi, and nothing is uploaded unless you write code to do it. Even so, be considerate about where you point a camera, and let people in your home know it’s there.

Troubleshooting

  • hailortcli can’t find a device: power off and reseat the PCIe ribbon at both ends, making sure the contacts face the right way and the clips are closed. Then confirm you ran the full upgrade and rebooted after installing hailo-all.
  • “No cameras available”: the camera ribbon is usually loose or reversed. Check that the contacts face away from the flap on the Pi end and that you are using the Standard-Mini cable.
  • The post-process file is not found: list the available files with ls /usr/share/rpi-camera-assets/ and use the exact name shown. Running sudo apt install rpicam-apps makes sure the camera tools are current.
  • No preview window appears: the preview needs the desktop. Run the command in a Terminal on the Pi’s own screen, not over a plain SSH session.
  • Low frame rate or throttling: make sure the Active Cooler’s fan is plugged in and you are using the 27W supply. For more speed, the 26 TOPS AI HAT+ runs the same models faster.

Where to go next

Sources: Raspberry Pi AI software documentation, Raspberry Pi AI HATs documentation, Raspberry Pi camera documentation, Hailo hailo-rpi5-examples, Hailo hailo-apps