Local-Offline-Voice-Assistant-on-Raspberry-Pi

by Evan Vedh in Circuits > Raspberry Pi

137 Views, 4 Favorites, 0 Comments

Local-Offline-Voice-Assistant-on-Raspberry-Pi

1768719697369.png

Voice assistants like Alexa and Google Assistant usually depend on cloud services, constant internet access, and powerful servers. In this project, I built a fully offline voice assistant on a Raspberry Pi that can listen for a wake word, understand speech, generate intelligent responses, and speak back — all locally on the device.

This voice assistant uses Vosk for offline speech recognition, Ollama to run a lightweight local language model, and Piper TTS for natural-sounding offline text-to-speech. Once activated by a wake word such as “Hey Assistant”, the system listens for a command, processes it using a local AI model, and responds with spoken output. A beep sound confirms wake word detection, and a thinking sound plays while the assistant processes the request.

To make the project beginner-friendly, all required models, audio files, and code are provided through a single Google Drive download, allowing anyone to set up the assistant easily without searching for individual dependencies. This project is ideal for students, hobbyists, and makers who want to explore offline AI, Raspberry Pi automation, and voice-controlled systems without relying on the cloud. Designed for privacy, low latency, and reliability.

Supplies

shopping.png

Hardware

  1. Raspberry Pi 4 / 5 (recommended) - https://robu.in/product/raspberry-pi-4-model-b-with-2-gb-ram
  2. Microphone (USB mic or sound card mic)
  3. Speaker or headphones
  4. Internet (only for installing packages & pulling models)

Software

  1. Raspberry Pi OS (64-bit recommended)
  2. Python 3.9+

Update Your Raspberry Pi

Screenshot 2026-01-18 132519.jpg
Screenshot 2026-01-18 132854.jpg
Screenshot 2026-01-18 133026.jpg

Open Terminal and run:

sudo apt update && sudo apt upgrade -y

Install basic audio tools:

sudo apt install -y alsa-utils sox

Test audio output:

speaker-test -t sine -f 1000

Press Ctrl + C to stop.

Set Up Microphone

Screenshot 2026-01-18 133203.jpg
Screenshot 2026-01-18 133509.jpg

Check if the microphone is detected:

arecord -l

Test recording:

arecord test.wav
aplay test.wav

If you hear your voice, the mic works.

Install Python Dependencies

Screenshot 2026-01-18 133620.jpg
Screenshot 2026-01-18 133823.jpg
Screenshot 2026-01-18 134122.jpg

Install system dependencies:

sudo apt install -y python3-pip portaudio19-dev

Install Python libraries:

pip3 install ollama vosk pyaudio numpy

If PyAudio fails:

pip3 install --no-binary=:all: pyaudio

Download All Required Files (From Google Drive Link)

Untitled design (1).png

To make setup easier, all required files are stored in one Google Drive folder.

This folder contains:

  1. Vosk speech recognition model
  2. Piper TTS model + config
  3. Voice assistant Python code
  4. process.wav (thinking sound)
  5. beep.wav (wake confirmation sound)

Download from Google Drive

  1. Open the Google Drive link provided here:

https://drive.google.com/file/d/1HrUWTQNB1PZXy0Y_czlAySrls6E05IO-/view?usp=sharing

  1. Click Download all
  2. A ZIP file will be downloaded

Extract Files on Raspberry Pi

Move the ZIP file to /home/pi and extract:

cd /home/pi
unzip VoiceAssistant.zip

After extraction, your directory structure must look like this:

/home/pi/
├── voice_assistant.py
├── process.wav
├── beep.wav
├── vosk-model-small-en-us-0.15/
│ ├── am/
│ ├── conf/
│ └── ...
└── piper/
├── en_US-lessac-medium.onnx
└── en_US-lessac-medium.onnx.json

⚠️ Important: Do not rename folders or files.

Verify File Paths in Code

Screenshot 2026-01-18 142244.jpg

Open the Python file:

nano VoiceAssist.py

Confirm these paths match exactly:

MODEL_PATH = "/home/pi/piper/en_US-lessac-medium.onnx"
CONFIG_PATH = "/home/pi/piper/en_US-lessac-medium.onnx.json"
VOSK_MODEL_PATH = "/home/pi/vosk-model-small-en-us-0.15"
THINKING_SOUND = "/home/pi/process.wav"
BEEP_SOUND = "/home/pi/beep.wav"

Save and exit.

Install Ollama (LLM Engine)

Screenshot 2026-01-18 141558.jpg

Install Ollama:

curl -fsSL https://ollama.com/install.sh | sh

Start Ollama:

ollama serve

Pull a lightweight model (recommended for Pi):

ollama pull qwen2.5:0.5b

Test it:

ollama run qwen2.5:0.5b

Run the Voice Assistant

Screenshot 2026-01-18 142420.jpg

Start Ollama (if not running):

ollama serve

In another terminal:

python3 VoiceAssist.py

You should see:

Always listening for wake word...
Say one of: hey assistant, hello assistant, okay assistant

How to Use It

BCO.06613632-a62a-406a-961a-f393f9a3cab6.png
  1. Say "Hey Assistant"
  2. Hear a beep
  3. Ask your question
  4. Assistant thinks (sound plays)
  5. Assistant speaks the answer

Examples:

  1. "Hello assistant, tell me a joke"
  2. "Okay assistant explain Arduino"

Exit the Assistant

Say:

exit
quit
stop
goodbye

Or press Ctrl + C.

Tips for Better Performance

PI_5_BENCHMARK_LO.jpg
  1. Use a USB microphone for accuracy
  2. Reduce background noise
  3. Use small LLM models (≤1B parameters)
  4. Raspberry Pi 4 (4GB+) works best

Final Result

BCO.88c913cd-dca1-4dc6-989f-84dac13821ef.png

You now have a fully offline voice assistant with:

  1. Wake word detection
  2. Offline speech recognition
  3. Local LLM responses
  4. Natural-sounding TTS

Perfect for Jarvis-style assistants, smart projects, and AI demos 🚀


🎉 Congratulations! Your Raspberry Pi Voice Assistant is Live!