Handles deployment, testing, and debugging of Bob The Skull code on Raspberry Pi. Use when deploying to Pi, testing remote code, troubleshooting Pi issues, or setting up new Pi hardware.
Comprehensive workflow for deploying, testing, and debugging Bob The Skull on Raspberry Pi.
# 1. Check git status - ensure clean or intentional changes
git status
# 2. Verify critical files exist
- .env.bob (API keys configured)
- requirements-body.txt (Pi dependencies)
- setup_raspberry_pi_no_git.sh (setup script)
- BobTheSkull.py or BobSkullOnly.py (main entry point)
# 3. Test locally if possible (optional but recommended)
./venv/Scripts/python test_system_config.py
# Windows: Use deploy_to_pi.bat
cmd /c deploy_to_pi.bat
# The script will:
# 1. Copy Python files (*.py)
# 2. Copy config files (.env.bob, requirements*.txt)
# 3. Copy all component directories (wake_word/, stt/, llm/, tts/, etc.)
# 4. Copy setup scripts
# Connect to Pi
plink -pw peacock7 knarl@192.168.1.44
# Navigate to deployment directory
cd /home/knarl/BobTheSkull5
# Verify files copied
ls -la
# Make setup script executable
chmod +x setup_raspberry_pi_no_git.sh
# Run setup (installs dependencies, creates venv)
./setup_raspberry_pi_no_git.sh
# Setup installs:
# - System packages (python3, portaudio, mosquitto-clients, avahi-daemon)
# - Python venv
# - requirements-body.txt dependencies (excludes heavy vision/GPU packages)
# Copy environment file
cp .env.bob .env
# Verify API keys are present
grep -E "OPENAI_API_KEY|PICOVOICE_ACCESS_KEY|ELEVEN_LABS_API_KEY" .env
# Check audio device configuration
python list_audio_devices.py
# Update .env if audio device indices changed
nano .env
# BOBTHESKULL_AUDIO_INPUT_DEVICE_INDEX=X
# BOBTHESKULL_AUDIO_OUTPUT_DEVICE_INDEX=Y
# Activate virtual environment
source venv/bin/activate
# Run Bob (body mode - no vision)
python BobTheSkull.py
# Or run in background with logging
nohup python BobTheSkull.py > bob.log 2>&1 &
# Monitor logs in real-time
tail -f bob.log
# Or use screen for persistent session
screen -S bob
python BobTheSkull.py
# Detach: Ctrl+A then D
# Reattach: screen -r bob
Check what will be deployed:
# Review git status
git status
# Check for uncommitted changes to critical files
git diff BobConfig.py
git diff BobTheSkull.py
git diff .env.bob
Verify configuration files:
# Ensure .env.bob has valid API keys
cat .env.bob | grep -E "API_KEY|ACCESS_KEY"
# Ensure deployment mode is correct
grep "DEPLOYMENT_MODE" .env.bob
# Should show: BOBTHESKULL_DEPLOYMENT_MODE=bob
Run deployment script:
# Windows
cmd /c deploy_to_pi.bat
# Expected output:
# [1/4] Creating directory on Pi...
# [2/4] Copying Python files...
# [3/4] Copying configuration files...
# [4/4] Copying component directories...
# Deployment Complete!
What gets copied:
*.py in root.env.bob, requirements*.txt, setup scriptsevents/, wake_word/, stt/, llm/, tts/, state_machine/, vision/, hardware/, web/What does NOT get copied:
venv/ - Virtual environment (recreated on Pi).git/ - Git repository__pycache__/ - Python cachelogs/ - Old log filesEmbeddingsDB/, LongTermDB/ - DatabasesSSH Connection:
# Connect via plink (PuTTY)
plink -pw peacock7 knarl@192.168.1.44
# Or use WSL/Git Bash
ssh knarl@192.168.1.44
# Password: peacock7
Network Info:
First-time setup (or after major changes):
cd /home/knarl/BobTheSkull5
# Make setup script executable
chmod +x setup_raspberry_pi_no_git.sh
# Run setup (5-10 minutes)
./setup_raspberry_pi_no_git.sh
What setup does:
apt update && apt upgrade)requirements-body.txtSetup complete when you see:
=========================================
Setup Complete!
=========================================
Next steps:
1. Copy .env.body to .env and update with your PC's IP address
2. Add your Picovoice API key to .env
3. Run: source venv/bin/activate
4. Run: python BobSkullOnly.py --broker <YOUR_PC_IP>
List available audio devices:
python list_audio_devices.py
Example output:
Input Devices:
[0] Built-in Microphone
[4] PS3 Eye Camera (USB Mic)
Output Devices:
[2] Built-in Speaker
[3] USB Audio Device
Update .env with correct indices:
nano .env
# Set to your device indices
BOBTHESKULL_AUDIO_INPUT_DEVICE_INDEX=4
BOBTHESKULL_AUDIO_OUTPUT_DEVICE_INDEX=3
Test audio output:
# Test speaker/audio output
python test_audio_output.py
# Should hear test tones
Test wake word detection:
# Test microphone and wake word
python test_wake_word_live.py
# Say "Wake up Bob" or "Hey Bob"
# Should see detection events
Test MQTT connection (if using distributed mode):
# Test MQTT broker connection
python test_mqtt.py
# Should connect to localhost:1883
Standard run:
source venv/bin/activate
python BobTheSkull.py
Background run with logging:
nohup python BobTheSkull.py > bob.log 2>&1 &
# Monitor logs
tail -f bob.log
# Stop background process
pkill -f BobTheSkull.py
Using screen (recommended for long-term):
# Start screen session
screen -S bob
python BobTheSkull.py
# Detach from screen: Ctrl+A then D
# Reattach to screen: screen -r bob
# Kill screen: Ctrl+C then exit
Test in this order to isolate issues:
Audio Output
python test_audio_output.py
Verifies: Speaker/audio device working
Audio Input
python test_wake_word_live.py
Verifies: Microphone working, wake word detection
MQTT/EventBus
python test_mqtt.py
Verifies: Event bus communication
Web Monitor
python test_web_monitor.py
# Open browser: http://192.168.1.44:5001
Verifies: Web interface accessible
Full System
python BobTheSkull.py
Verifies: Complete integration
Access from Windows PC:
http://192.168.1.44:5001
Monitor dashboard shows:
Problem: PuTTY not installed or not in PATH
Solution:
# Option 1: Install PuTTY
# Download from: https://www.putty.org/
# Option 2: Use WSL/Git Bash instead
scp -r *.py knarl@192.168.1.44:/home/knarl/BobTheSkull5/
Problem: Pi is offline or IP address changed
Solution:
# Ping to verify Pi is online
ping 192.168.1.44
# Try mDNS hostname
ping bob-pi.local
# If IP changed, update deploy_to_pi.bat:
# set PI_HOST=<NEW_IP>
Problem: System dependencies not installed
Solution:
# SSH to Pi
plink -pw peacock7 knarl@192.168.1.44
# Install PortAudio manually
sudo apt update
sudo apt install -y portaudio19-dev python3-pyaudio
# Recreate venv
rm -rf venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements-body.txt
Problem: Wrong requirements file used or venv not activated
Solution:
# Ensure using requirements-body.txt (not requirements.txt)
source venv/bin/activate
pip install -r requirements-body.txt
# Verify pvporcupine installed
pip list | grep pvporcupine
Problem: Device indices changed or incorrect
Solution:
# List current audio devices
python list_audio_devices.py
# Update .env with correct indices
nano .env
# Change BOBTHESKULL_AUDIO_INPUT_DEVICE_INDEX
# Change BOBTHESKULL_AUDIO_OUTPUT_DEVICE_INDEX
# Test audio
python test_audio_output.py
Problem: User not in dialout group
Solution:
# Add user to dialout group
sudo usermod -a -G dialout knarl
# Logout and login again (or reboot)
sudo reboot
Problem: Microphone not working or sensitivity too low
Solution:
# 1. Verify microphone
python list_audio_devices.py
# Ensure correct input device index
# 2. Test microphone recording
arecord -d 5 -f cd test.wav
aplay test.wav
# Should hear your recording
# 3. Adjust wake word sensitivity
nano .env
# BOBTHESKULL_WAKE_WORD_SENSITIVITY=0.3 # Lower = more sensitive (0.0-1.0)
# 4. Test wake word
python test_wake_word_live.py
Problem: MQTT broker not running or wrong config
Solution:
# Check if mosquitto is running
sudo systemctl status mosquitto
# Start mosquitto if not running
sudo systemctl start mosquitto
sudo systemctl enable mosquitto
# Verify MQTT config in .env
grep MQTT .env
# Should show:
# BOBTHESKULL_MQTT_BROKER_HOST=localhost
# BOBTHESKULL_MQTT_BROKER_PORT=1883
Problem: Eyes controller offline or discovery failed
Solution:
# Test mDNS discovery
python test_mdns_discovery.py
# Try serial discovery
ls /dev/ttyUSB*
# If serial device exists: /dev/ttyUSB0
# Update .env to force serial mode
nano .env
# BOBTHESKULL_EYES_DISCOVERY_MODE=serial
# BOBTHESKULL_EYES_SERIAL_PORT=/dev/ttyUSB0
Problem: Pi CPU limited or wrong Python version
Solution:
# Check CPU usage
top
# Look for high CPU processes
# Verify Python version (should be 3.9-3.11)
python3 --version
# Ensure using body requirements (no vision overhead)
pip list | grep -E "opencv|onnx|dlib"
# Should NOT be installed in body mode
# Consider disabling wake word processing on Pi
# Use distributed architecture with vision PC doing wake word
Option 1: SSH and tail
plink -pw peacock7 knarl@192.168.1.44 "tail -f /home/knarl/BobTheSkull5/bob.log"
Option 2: Web Monitor
http://192.168.1.44:5001/logs
# Main application log
~/BobTheSkull5/bob.log
# System logs (if running as service)
/var/log/syslog | grep bob
# MQTT logs
/var/log/mosquitto/mosquitto.log
# Show errors only
tail -f bob.log | grep -i error
# Show state transitions
tail -f bob.log | grep "State transition"
# Show event publications
tail -f bob.log | grep "Publishing event"
# Show LLM interactions
tail -f bob.log | grep "LLM"
Configuration (.env.bob):
BOBTHESKULL_DEPLOYMENT_MODE=bob
BOBTHESKULL_VISION_CAN_SEE=false
BOBTHESKULL_WAKE_WORD_ENABLED=true
BOBTHESKULL_MQTT_BROKER_HOST=localhost
Components enabled:
Use when: Running standalone Bob on Pi without vision PC
Vision PC runs:
Raspberry Pi runs:
Configuration (.env on Pi):
BOBTHESKULL_MQTT_BROKER_HOST=192.168.1.XXX # Vision PC IP
Use screen for persistence - Prevents SSH disconnects from stopping Bob
screen -S bob
python BobTheSkull.py
# Ctrl+A D to detach
Create deployment aliases - Add to ~/.bashrc on Pi:
alias bob-run='cd ~/BobTheSkull5 && source venv/bin/activate && python BobTheSkull.py'
alias bob-log='tail -f ~/BobTheSkull5/bob.log'
alias bob-stop='pkill -f BobTheSkull.py'
Monitor from Windows - Keep web monitor open during deployment:
http://192.168.1.44:5001
Test incrementally - Don't deploy everything at once:
Keep backup .env - Copy working .env before changing:
cp .env .env.backup
Use version tags - Tag working versions in git:
git tag -a pi-working-2024-12-09 -m "Working Pi deployment"
Automated health checks - Run periodic tests:
# On Pi, add to crontab
*/5 * * * * /home/knarl/BobTheSkull5/health_check.sh
Remote file editing - Use nano on Pi, VS Code Remote SSH, or WinSCP
Quick config changes - Use web interface instead of editing files:
http://192.168.1.44:5001/config
Network discovery - Use mDNS instead of IP addresses:
ping bob-pi.local
ssh knarl@bob-pi.local
# 1. Fix bug locally on Windows
# 2. Test locally (if possible)
./venv/Scripts/python test_system_config.py
# 3. Deploy single file (faster than full deploy)
pscp -pw peacock7 BobConfig.py knarl@192.168.1.44:/home/knarl/BobTheSkull5/
# 4. Restart Bob on Pi
plink -pw peacock7 knarl@192.168.1.44 "pkill -f BobTheSkull.py"
plink -pw peacock7 knarl@192.168.1.44 "cd ~/BobTheSkull5 && nohup python BobTheSkull.py > bob.log 2>&1 &"
# 5. Monitor logs
plink -pw peacock7 knarl@192.168.1.44 "tail -f ~/BobTheSkull5/bob.log"
# Option 1: Use web interface (fastest)
# Open: http://192.168.1.44:5001/config
# Make changes via UI
# Click Save
# Option 2: Edit .env remotely
plink -pw peacock7 knarl@192.168.1.44
nano /home/knarl/BobTheSkull5/.env
# Make changes
# Ctrl+X, Y, Enter
exit
# Restart Bob
plink -pw peacock7 knarl@192.168.1.44 "pkill -f BobTheSkull.py && cd ~/BobTheSkull5 && nohup python BobTheSkull.py > bob.log 2>&1 &"
# 1. Deploy files from Windows
cmd /c deploy_to_pi.bat
# 2. SSH to Pi
plink -pw peacock7 knarl@192.168.1.44
# 3. Run full setup
cd /home/knarl/BobTheSkull5
chmod +x setup_raspberry_pi_no_git.sh
./setup_raspberry_pi_no_git.sh
# 4. Configure environment
cp .env.bob .env
nano .env
# Update audio device indices
# 5. Test audio
python list_audio_devices.py
python test_audio_output.py
# 6. Run Bob
screen -S bob
python BobTheSkull.py
# Ctrl+A D to detach
# 1. Check if Bob is running
plink -pw peacock7 knarl@192.168.1.44 "ps aux | grep BobTheSkull"
# 2. Check recent logs
plink -pw peacock7 knarl@192.168.1.44 "tail -100 ~/BobTheSkull5/bob.log"
# 3. Check for errors
plink -pw peacock7 knarl@192.168.1.44 "grep -i error ~/BobTheSkull5/bob.log | tail -20"
# 4. Open web monitor in browser
# http://192.168.1.44:5001
# 5. If needed, run tests remotely
plink -pw peacock7 knarl@192.168.1.44 "cd ~/BobTheSkull5 && source venv/bin/activate && python test_mqtt.py"
Without this skill:
With this skill:
Estimated time savings: 2-3x faster deployments
Works well with:
β Deploying without testing locally first
β Forgetting to update .env on Pi
.env after deploymentβ Using wrong requirements file
requirements-body.txt, not requirements.txtβ Not checking audio device indices
list_audio_devices.pyβ Deploying with hardcoded paths
β Not monitoring logs during first run
β Forgetting to enable avahi-daemon
β Running full requirements.txt on Pi
β Not using screen/nohup for background runs
β Skipping component-by-component testing
Deployment Scripts:
Test Scripts:
test_audio_output.py - Test speakertest_wake_word_live.py - Test microphone and wake wordtest_mqtt.py - Test MQTT connectiontest_web_monitor.py - Test web interfacelist_audio_devices.py - List audio devicesConfiguration Files:
.env - Environment-specific overrides (on Pi)config.yaml - Optional YAML configurationRelated Documentation: