DEV Community

Tejas
Tejas

Posted on

Simple Easy Voice Assistant using Raspberry Pi 1

Photograph of a Raspberry Pi 1 board connected to a USB webcam, desktop speaker, and laptop on a clean white desk setup

Introduction & Hardware Overview

This is a super easy setup, though your overall speed and performance will depend on your hardwareβ€”the better the hardware, the faster the results!

For this project, I used a Raspberry Pi 1 from 2013. It's really old and slow, but it definitely gets the job done! You just need to be a little patient during the initial package installation.

To keep the Pi as fast and lightweight as possible, I installed DietPi as the operating system.


πŸ› οΈ What You Need

1. The Client (Raspberry Pi 1)

  • Raspberry Pi 1 (or any newer Pi model)
  • DietPi OS (keeps memory usage super low)
  • USB Microphone: I used an old USB webcam microphone. (Pro Tip: Put a piece of tape over the camera lens if you have privacy concerns!)
  • 3.5mm Speakers / Headphones

2. The Server (Mini PC / Local Host)

  • Mini PC (or any Linux host on your local network)
  • Ollama: Running lightweight models like qwen2.5:1.5b or llama3.2:1b
  • Faster-Whisper: For fast local Speech-to-Text

🌐 Network & Quick Overview

  1. Local Network: Ensure both your Pi and Server are on the same local network. Verify connectivity by running a ping from the server to the Pi and vice versa.
  2. Install & Test: Run the requirement setup and shell scripts on the Pi, and run the server script on the Mini PC.
  3. Verify Logs: Test both scripts running together and check the logs using the provided code commands.
  4. Enable on Boot: Once everything works, convert the scripts into systemd background services and enable them on boot so your AI assistant starts automatically whenever your Pi powers on!

πŸ“Š Viewing Logs Live

Checking the logs live is the best way to see your voice queries, transcripts, and AI answers in real-time.

1. View Client Logs (Raspberry Pi 1 / DietPi)

sudo journalctl -u jarvis-client -f
Enter fullscreen mode Exit fullscreen mode

2. View Server Logs (Mini PC)

sudo journalctl -u jarvis-server -f
Enter fullscreen mode Exit fullscreen mode

πŸ”§ Troubleshooting Guide & Pro Tips

Here are the most common issues you might encounter when building this project and how to fix them:

1. Error: Device or resource busy

  • Cause: You have multiple scripts or background services trying to access the microphone at the same time.
  • Fix: Kill extra background processes and make sure only one instance of jarvis-client is running:
  sudo pkill -9 sox
  sudo systemctl restart jarvis-client
Enter fullscreen mode Exit fullscreen mode

2. Sound Device Card Numbers Shift After Rebooting

  • Cause: Linux ALSA card numbers (card 0, card 1) can change randomly every time you restart your Pi.
  • Fix: Use permanent device names instead of numbers:
    • Mic: plughw:Camera,0 (or your webcam name)
    • Speakers: plughw:Headphones,0

3. Audio Crashes with Floating point exception on Pi 1

  • Cause: SoX play or ffplay uses floating-point audio resampling math that crashes on old ARMv6 (Pi 1) processors.
  • Fix: Use native ALSA aplay -D plughw:Headphones,0 for playback, and have the server convert all output audio into standard 16kHz mono WAV format.

4. Audio Cuts Off Before You Finish Speaking

  • Cause: The SoX Voice Activity Detection (VAD) silence pause time is set too short.
  • Fix: Increase the silence pause parameter in jarvis_listener.sh from 0.8s to 1.8s:
  sox -t alsa "$MIC_DEVICE" -c 1 -r 16000 -b 16 "$TEMP_IN" silence 1 0.1 5% 1 1.8 5%
Enter fullscreen mode Exit fullscreen mode

https://github.com/teejaz/jarvis-edge-ai
Feel free to reach out for any question or additional ideas.

Top comments (0)