Voice Assistant Auto-Start Service
This guide explains how the voice assistant is configured to start automatically when Batocera boots.
Service Overview
The voice assistant now runs as a Batocera service that starts automatically at boot time, enabling hands-free wake word detection from the moment your system starts.
Service Details
- Service Name:
voice_assistant - Location:
/userdata/system/services/voice_assistant - Status: ✅ Enabled and running
- Log File:
/tmp/voice-assistant.log - Service Log:
/tmp/voice-assistant-service.log
What the Service Does
When Batocera boots:
- Starts Ollama (if not already running) - Required for LLM responses
- Starts Voice Assistant - Runs
voice_assistant_wake.pyin background - Begins Listening - Immediately starts listening for “Hey Jarvis” wake word
- Logs Activity - All output goes to
/tmp/voice-assistant.log
Managing the Service
Check Service Status
batocera-services list
Look for: voice_assistant;* (the * means it’s enabled)
Start the Service Manually
batocera-services start voice_assistant
Stop the Service
batocera-services stop voice_assistant
Enable Auto-Start (Already Done)
batocera-services enable voice_assistant
Disable Auto-Start
batocera-services disable voice_assistant
Viewing Logs
Real-time Log (Live)
tail -f /tmp/voice-assistant.log
View Last 50 Lines
tail -50 /tmp/voice-assistant.log
Check if Service Started Successfully
cat /tmp/voice-assistant-service.log
Check if Ollama is Running
ps aux | grep ollama
Check if Voice Assistant is Running
ps aux | grep voice_assistant_wake
LED Feedback Behavior
The wake word mode includes LED feedback on GPIO 25 (AIY Voice HAT LED):
LED States
| State | LED | Meaning |
|---|---|---|
| OFF | 🟢 | Listening for wake word (ready) |
| ON | 🔴 | Wake word detected, recording/processing your command |
| OFF | 🟢 | Processing complete, back to listening |
LED Flow
- Startup: LED starts OFF (ready to listen)
- Wake Word Detected: LED turns ON immediately when you say “Hey Jarvis”
- During Processing: LED stays ON while recording, transcribing, and getting LLM response
- Response Complete: LED turns OFF after the assistant finishes speaking
- Back to Ready: LED stays OFF while waiting for next wake word
LED Always Turns Off When:
- ✅ Response is spoken successfully
- ✅ Recording fails (no audio captured)
- ✅ No speech detected (silence or unintelligible)
- ✅ Program exits (shutdown/crash)
- ✅ Any error occurs
The LED is a reliable indicator: If the LED is ON, the system is busy processing. If OFF, it’s ready for the wake word.
Troubleshooting
Service Won’t Start
Check if all dependencies are in place:
# Check Ollama
ls -la /userdata/ollama/bin/ollama
# Check models
ls -la /userdata/voice-assistant/models/
# Check Python libraries
ls -la /userdata/voice-assistant/lib/
# Check whisper-cli
ls -la /userdata/voice-assistant/whisper-cli
Check for Errors
# View the error log
tail -100 /tmp/voice-assistant.log
# Check service status
batocera-services status voice_assistant
Restart the Service
If something goes wrong:
# Stop and restart
batocera-services stop voice_assistant
sleep 2
batocera-services start voice_assistant
# Or reboot to restart everything
reboot
LED Not Working
The service uses gpioset command to control the LED. Verify it works:
# Test LED manually
gpioset gpiochip0 25=1 # LED on
sleep 1
gpioset gpiochip0 25=0 # LED off
If this works but the service LED doesn’t, check the log:
tail -20 /tmp/voice-assistant.log
Service File Location
The service script is at:
/userdata/system/services/voice_assistant
This is a bash script that:
- Sets up environment variables
- Starts Ollama (dependency)
- Starts the voice assistant Python script
- Runs everything in the background
Boot Behavior
At Boot:
- Batocera starts up
- Ollama service starts (if enabled)
- Voice assistant service starts
- Assistant begins listening for “Hey Jarvis”
During Use:
- Say “Hey Jarvis” → LED turns on → Speak your question → LED turns off → Assistant responds
- The assistant continues listening after each interaction
- No need to manually start anything
Switching Modes
The service currently runs wake word mode by default. To switch to button mode:
-
Stop the service:
batocera-services stop voice_assistant -
Edit the service file:
nano /userdata/system/services/voice_assistant -
Change this line:
# From: python3 voice_assistant_wake.py > /tmp/voice-assistant.log 2>&1 & # To: python3 voice_assistant_button.py > /tmp/voice-assistant.log 2>&1 & -
Save and restart:
batocera-services start voice_assistant
Disabling Auto-Start
To prevent the voice assistant from starting at boot:
batocera-services disable voice_assistant
The service file remains but won’t auto-start. You can still start it manually.
Manual Start Without Service
If you prefer not to use the service, you can still run manually:
cd /userdata/voice-assistant
python3 voice_assistant_wake.py
Service Dependencies
The voice assistant service depends on:
- ✅ Ollama (auto-starts if not running)
- ✅ Python libraries in
/userdata/voice-assistant/lib/ - ✅ Whisper models in
/userdata/voice-assistant/models/ - ✅ Audio hardware (AIY Voice HAT)
All dependencies are automatically handled by the service script.
Status: ✅ Service enabled and running Auto-start: ✅ Yes Current mode: Wake word detection LED feedback: ✅ Yes (GPIO 25)