SaraKIT is equipped with three microphones and a specialized audio processor that cleans up the voice and supports speech recognition on the Raspberry Pi. This project leverages these capabilities to implement voice control for Home Assistant (HA) systems.
SaraKIT can operate in two modes with HA:
- Offline Mode: Using VOSK for speech recognition, which operates entirely offline and free of charge. VOSK supports most languages, making it versatile for various users.
- Hybrid Mode: Using VOSK for WakeWord detection and Google Speech-to-Text (STT) for subsequent speech recognition. This mode remains offline until the WakeWord is detected, at which point it switches to online mode for superior accuracy and range. Google STT significantly outperforms VOSK in recognizing speech from a greater distance, though it requires an internet connection.
In both modes, once SaraKIT converts speech to text, it sends a topic (our command) to HA using MQTT in the form of a string, such as "homeassistant/TV/1/volup." This process is demonstrated in the accompanying video. The configuration is straightforward, yet it offers extensive possibilities.
Project OverviewFeatures- Voice Control with SaraKIT: Utilize SaraKIT's advanced audio processing to implement voice commands.
- Offline Speech Recognition: Achieve complete offline functionality with VOSK, supporting various languages.
- Hybrid Speech Recognition: Combine VOSK for WakeWord detection and Google STT for enhanced speech recognition accuracy.
- Simple Integration with Home Assistant: Use MQTT to seamlessly send commands to HA.
- Versatile Applications: Control multiple HA components such as lights, TVs, and other smart devices.
- Raspberry Pi with SaraKIT
- Home Assistant setup
- Basic understanding of MQTT and Python
1.Install Required Packages:
sudo apt-get update
sudo apt-get install pip
sudo apt-get install -y python3-pyaudio
sudo pip3 install vosk
sudo apt-get install mosquitto-clients
1b.Install OptionalPackages (for Hybrid version):
pip install google-cloud-speech
2.Set Up VOSK:
- Download and install the VOSK model for your language from VOSK Models.
- Place the model in a directory, e.g.,
models/vosk-model-small-en-us-0.15
.
3.Configure Google Speech-to-Text (Optional):
- Follow Google's guide to set up API keys
- export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/credentials.json"
4.Download and Configure the Project Code:
- Clone the repository:
git https://github.com/SaraEye/Offline_and_Hybrid_Voice_Control_for_Home_Assistant_with_SaraKIT.git sarakit-voice-ha
cd sarakit-voice-ha
- Update the python file with your MQTT broker details (HA ip, user, pass) and Google API key if using the hybrid mode.
5.Run the Voice Command Script:
python3 OfflineHAVoiceControl.py #for offline version
python3 HybridHAVoiceControl.py #for Hybrid version
Video DemonstrationCheck out our video demonstration to see the project in action:
ConclusionSaraKIT provides an excellent platform for integrating voice control into Home Assistant, offering both offline and hybrid modes for flexibility and enhanced performance. Whether you prefer complete offline functionality or the improved accuracy of online recognition, SaraKIT has you covered.
For more detailed instructions, additional projects, and source code, visit our GitHub repository.
We look forward to seeing what amazing projects you create with SaraKIT!
SaraKIT is a Raspberry Pi CM4 expansion board that enables advanced voice control and precise motor management. It features three sensitive microphones, two independent BLDC motor controllers for quiet and precise control, a CSI interface for dual cameras, two accelerometers, a gyroscope, and a temperature sensor.
The PCB for SaraKIT was expertly manufactured by PCBWay.com, whose quality services come highly recommended.
SaraKIT Home Page:
Comments