-
Notifications
You must be signed in to change notification settings - Fork 128
Raspberry Pi AI HAT+ 2
This document explains how to set up the Raspberry Pi AI Hat+ 2 (Hailo-10H) with the Whisplay AI Chatbot, covering ASR, LLM, TTS, and Vision services.
Hardware note: AI HAT+ 2 uses the Hailo-10H chip. It requires the
hailo-h10-allpackage, which is different fromhailo-allused by the AI Kit / AI HAT+. They cannot coexist on the same OS installation. See the official Software prerequisites.
The Hailo-10H NPU has limited on-chip SRAM. hailo-ollama (LLM) exclusively
locks the VDevice on startup and cannot coexist with any other NPU service —
starting it while another service holds the device will fail with
Failed to create VDevice.
hailo-whisper (ASR) and hailo-vlm (VLM), however, both use the
hailo-apps Python SDK with a shared VDevice group and can run side-by-side.
They share the NPU via time-slicing: sequential (non-overlapping) requests to
each service work correctly, but truly simultaneous inference calls will cause
one of them to fail with HAILO_INVALID_OPERATION (it recovers automatically
on the next request).
| Combination | Works? | Notes |
|---|---|---|
| hailo-whisper + hailo-vlm | ✅ Yes | Sequential requests OK; concurrent requests may error |
| hailo-whisper + hailo-ollama | ❌ No | hailo-ollama exclusively locks the VDevice |
| hailo-vlm + hailo-ollama | ❌ No | hailo-ollama exclusively locks the VDevice |
For whichever service is not running on the NPU, use a CPU-based or cloud alternative. The sections below cover each service independently.
┌─────────────────────────── Raspberry Pi 5 (AI HAT+ 2) ────────────────────────────┐
│ │
│ ╔══════════ Hailo-10H NPU (shared VDevice, time-sliced) ════════════╗ │
│ ║ ║ │
│ ║ hailo-whisper-host.py :8807 (Whisper-Base.hef) ← ASR -┐ ║ │
│ ║ ├ can ║ │
│ ║ hailo-vlm-host.py :8808 (VLM .hef) ← Vision┘ coexist║ │
│ ╚════════════════════════════════════════════════════════════════════╝ │
│ │
│ ╔══════════ Hailo-10H NPU (exclusive VDevice lock) ════════════════╗ │
│ ║ ║ │
│ ║ hailo-ollama :8000 (qwen2.5-instruct) ← LLM (alone) ║ │
│ ╚═══════════════════════════════════════════════════════════════════╝ │
│ │
└───────────────────────────────────────────────────────────────────────────────────┘
sudo apt update && sudo apt full-upgrade -y
sudo rpi-eeprom-update -a
sudo reboot
⚠️ AI HAT+ 2 requireshailo-h10-all— do not installhailo-all.
sudo apt update
sudo apt install -y hailo-h10-all
sudo rebootVerify after reboot:
hailortcli fw-control identify
# Expected: Device Architecture: HAILO10HTroubleshooting —
/dev/hailo0missing: Blacklist the oldhailo_pcimodule (for Hailo-8) which conflicts withhailo1x_pci:echo "blacklist hailo_pci" | sudo tee /etc/modprobe.d/blacklist-hailo-h8.conf echo "install hailo_pci /bin/true" | sudo tee -a /etc/modprobe.d/blacklist-hailo-h8.conf sudo update-initramfs -u sudo rebootAfter reboot,
lsmod | grep hailoshould show onlyhailo1x_pci.
Required for both Hailo Whisper ASR and Hailo VLM.
git clone https://github.com/hailo-ai/hailo-apps.git ~/hailo-apps
cd ~/hailo-apps
sudo ./install.sh
source setup_env.sh
pip install -e ".[gen-ai]"Runs speech recognition on the Hailo-10H NPU.
⚠️ Cannot coexist withhailo-ollama. Stophailo-ollamabefore starting this service. Can run alongsidehailo-vlm(sequential requests only). Use a cloud or CPU-based LLM (e.g.gemini) alongside it.
cd ~/hailo-apps
source setup_env.sh
hailo-download-resources --group whisper_chat --arch hailo10h
# Model saved to: /usr/local/hailo/resources/whisper_chat/Whisper-Base.hef (~131 MB)cd ~/hailo-apps
source setup_env.sh
python3 ~/whisplay-ai-chatbot/python/speech-service/hailo-whisper-host.py --port 8807Once you see Listening for requests..., test with:
# Health check
curl http://localhost:8807/health
# Expected: {"hailo":true,"status":"ok"}
# Transcription test (16 kHz mono WAV)
curl -s -X POST http://localhost:8807/transcribe \
-F "audio=@/path/to/test.wav" | python3 -m json.toolcat > /tmp/hailo-whisper.service << 'EOF'
[Unit]
Description=Hailo Whisper ASR HTTP Service
After=network.target
[Service]
User=pi
Environment="PATH=/home/pi/hailo-apps/venv_hailo_apps/bin:/usr/local/bin:/usr/bin:/bin"
WorkingDirectory=/home/pi/hailo-apps
ExecStart=/home/pi/hailo-apps/venv_hailo_apps/bin/python3 \
/home/pi/whisplay-ai-chatbot/python/speech-service/hailo-whisper-host.py --port 8807
Restart=on-failure
StandardOutput=append:/home/pi/hailo-whisper.log
StandardError=append:/home/pi/hailo-whisper-err.log
[Install]
WantedBy=multi-user.target
EOF
sudo mv /tmp/hailo-whisper.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable hailo-whisper.service
sudo systemctl start hailo-whisper.service
sudo systemctl status hailo-whisper.serviceView logs:
journalctl -u hailo-whisper -fASR_SERVER=hailowhisper
HAILO_WHISPER_HOST=localhost
HAILO_WHISPER_PORT=8807
HAILO_WHISPER_LANGUAGE=enRuns a quantised LLM on the Hailo-10H NPU via an Ollama-compatible REST API.
⚠️ NPU exclusive.hailo-ollamalocks the VDevice exclusively. Stop bothhailo-whisperandhailo-vlmbefore starting this service. Use a cloud or CPU-based ASR (e.g. Faster-Whisper, Gemini) alongside it.
hailo-ollama is shipped as part of the Hailo GenAI Model Zoo Debian package:
curl -L -o /tmp/hailo_gen_ai_model_zoo.deb \
https://dev-public.hailo.ai/2025_12/Hailo10/hailo_gen_ai_model_zoo_5.1.1_arm64.deb
sudo dpkg -i /tmp/hailo_gen_ai_model_zoo.deb
which hailo-ollama # should return /usr/bin/hailo-ollamaAlternative: download from the Hailo Developer Zone (free account) under the AI HAT+ 2 section.
⚠️ Model blobs must be downloaded via the REST API while the server is running. The CLIhailo-ollama pullstarts its own server and does not connect to an existing one.
# Start the server in one terminal
hailo-ollama
# In another terminal — pull a model (streaming progress)
curl -s http://localhost:8000/api/pull \
-H 'Content-Type: application/json' \
-d '{"model": "qwen2.5-instruct:1.5b", "stream": true}'Available models (bundled manifests in the deb package):
| Model | Size | Notes |
|---|---|---|
qwen2.5-instruct:1.5b |
~1 GB | Recommended — good speed/quality |
llama3.2:1b |
~650 MB | Fastest |
qwen2.5-instruct:3b |
~2 GB | Better quality, slower |
# List loaded models
curl -s http://localhost:8000/api/tags | python3 -m json.tool
# Chat test
curl -s http://localhost:8000/api/chat \
-H 'Content-Type: application/json' \
-d '{"model":"qwen2.5-instruct:1.5b",
"messages":[{"role":"user","content":"Say hello in one sentence."}],
"stream":false}' | python3 -m json.toolcat > /tmp/hailo-ollama.service << 'EOF'
[Unit]
Description=Hailo Ollama LLM Service
After=network.target
[Service]
User=pi
Environment="PATH=/usr/local/bin:/usr/bin:/bin:/home/pi/.local/bin"
ExecStart=/usr/bin/hailo-ollama
Restart=on-failure
StandardOutput=append:/home/pi/hailo-ollama.log
StandardError=append:/home/pi/hailo-ollama-err.log
[Install]
WantedBy=multi-user.target
EOF
sudo mv /tmp/hailo-ollama.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable hailo-ollama.service
sudo systemctl start hailo-ollama.service
sudo systemctl status hailo-ollama.serviceView logs:
journalctl -u hailo-ollama -fLLM_SERVER=ollama
OLLAMA_ENDPOINT=http://localhost:8000
OLLAMA_MODEL=qwen2.5-instruct:1.5b
OLLAMA_ENABLE_TOOLS=falseRuns vision/image-understanding on the Hailo-10H NPU, exposing an OpenAI-compatible
/v1/chat/completions endpoint.
⚠️ Cannot coexist withhailo-ollama. Stophailo-ollamabefore starting this service. Can run alongsidehailo-whisper(sequential requests only; the VLM HEF is ~2 GB). Use a cloud LLM alongside it.
pip install flask opencv-python-headless pillow --break-system-packagescd ~/hailo-apps
source setup_env.sh
hailo-download-resources --group vlm_chat --arch hailo10h
# ~2 GB HEF — download may take several minutescd ~/hailo-apps
source setup_env.sh
python3 ~/whisplay-ai-chatbot/python/speech-service/hailo-vlm-host.py --port 8808Test in another terminal with:
# Health check
curl http://localhost:8808/health
# Vision test (supply a JPEG/PNG image as base64)
curl -s http://localhost:8808/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "hailo-vlm",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,<BASE64>"}}
]
}]
}' | python3 -m json.toolcat > /tmp/hailo-vlm.service << 'EOF'
[Unit]
Description=Hailo VLM Vision HTTP Service
After=network.target
[Service]
User=pi
Environment="PATH=/home/pi/hailo-apps/venv_hailo_apps/bin:/usr/local/bin:/usr/bin:/bin"
WorkingDirectory=/home/pi/hailo-apps
ExecStart=/home/pi/hailo-apps/venv_hailo_apps/bin/python3 \
/home/pi/whisplay-ai-chatbot/python/speech-service/hailo-vlm-host.py --port 8808
Restart=on-failure
StandardOutput=append:/home/pi/hailo-vlm.log
StandardError=append:/home/pi/hailo-vlm-err.log
[Install]
WantedBy=multi-user.target
EOF
sudo mv /tmp/hailo-vlm.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable hailo-vlm.service
sudo systemctl start hailo-vlm.service
sudo systemctl status hailo-vlm.serviceView logs:
journalctl -u hailo-vlm -fLLM_SERVER=openai
OPENAI_API_KEY=no-need
OPENAI_API_BASE_URL=http://localhost:8808/v1
OPENAI_LLM_MODEL=hailo-vlm
ENABLE_CAMERA=true
USE_CAPTURED_IMAGE_IN_CHAT=true
ENABLE_THINKING=false
OPENAI_USE_STREAM=falseThe VLM service supports multi-turn conversation via the standard OpenAI API convention: include the full conversation history in the
messagesarray of each request. The server automatically truncates long histories to the most recent 3 user/assistant turns (plus the first image message) to prevent output degradation from the small on-device model. The KV-cache is cleared before every generation for consistent quality.
hailo-ollama exclusively locks the VDevice, so stop all other NPU services
before starting it. hailo-whisper and hailo-vlm can coexist.
# Switch to hailo-ollama LLM (must stop everything else first)
sudo systemctl stop hailo-whisper.service hailo-vlm.service
sudo systemctl start hailo-ollama.service
# Switch back to ASR + VLM (can start both)
sudo systemctl stop hailo-ollama.service
sudo systemctl start hailo-whisper.service
sudo systemctl start hailo-vlm.service # optional, can coexist with whisperPiper TTS runs on the CPU and is never affected by NPU switches.
Services take time to load models after boot. Wait ~60 s after systemctl start
before sending requests.
| Service | Approximate startup time |
|---|---|
| hailo-whisper (ASR) | ~10–20 s |
| hailo-ollama (LLM) | ~30–60 s |
| hailo-vlm (Vision) | ~20–40 s |
| piper-http (TTS) | ~5 s (CPU, auto-started) |
| Component | Start | Stop | Status |
|---|---|---|---|
| Hailo Whisper ASR | sudo systemctl start hailo-whisper |
sudo systemctl stop hailo-whisper |
sudo systemctl status hailo-whisper |
| Hailo Ollama LLM | sudo systemctl start hailo-ollama |
sudo systemctl stop hailo-ollama |
sudo systemctl status hailo-ollama |
| Hailo VLM Vision | sudo systemctl start hailo-vlm |
sudo systemctl stop hailo-vlm |
sudo systemctl status hailo-vlm |