This is thread to give some tips on how to get the MATRIX Voice working with rhasspy.
There are 2 options on how to make it work:
- Attach the MATRIX Voice directly on the Raspberry Pi that runs Rhasspy
- Use the MATRIX Voice with a ESP32 as a streamer
For option 2, see here: Rebranded the Matrix Voice to esp32-rhasspy-satellite
For option 1, there is a good hackster guide made by the MATRIX people:
KNOWN BUGS
However, the matrix-kernel-modules are not compatible with the current raspberry pi kernel 5.10
.
The downgrade to kernel 5.4 can be accomplished like this:
DOWNGRADE KERNEL TO 5.4
sudo apt purge matrixio-kernel-modules
cd ~/
wget -q --show-progress -O rpi_kernel_5-4.deb http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20201126-1_armhf.deb
wget -q --show-progress -O rpi_kernel_headers_5-4.deb http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel-headers_1.20201126-1_armhf.deb
sudo apt purge raspberrypi-kernel-headers
sudo apt install ~/rpi_kernel_5-4.deb
sudo apt install ~/rpi_kernel_headers_5-4.deb
sudo apt-mark hold raspberrypi-kernel
sudo apt-mark hold raspberrypi-kernel-headers
sudo reboot
sudo apt update
sudo apt install matrixio-kernel-modules
sudo reboot
UNDO
sudo apt-mark unhold raspberrypi-kernel
sudo apt-mark unhold raspberrypi-kernel-headers
sudo apt purge matrixio-kernel-modules
sudo apt purge raspberrypi-kernel-headers
sudo apt update && sudo apt upgrade
sudo reboot
sudo apt install matrixio-kernel-modules
sudo reboot
Light Ring / Halo
To get the lights / led ring with WS2812B pixels working, there are also two options.
HermesLedControl:
github: HermesLedControl
Some Installation Hints here:
(Will add when I can add more links)
For me, I made a python script:
# Imported mqtt Libraries
import paho.mqtt.client as mqttClient
import time
# Imported Matrix libraries
from matrix_lite import led
from time import sleep
from math import trunc
# mqtt callbacks
def on_connect(client, userdata, flags, rc):
if rc == 0:
global Connected #Use global variable
Connected = True #Signal connection
set_lightring("green")
time.sleep(10)
set_lightring("black")
else:
Connected = False
everloop[13] = "red"
led.set(everloop)
time.sleep(10)
set_lightring("black")
def on_message(client, userdata, message):
if str(message.topic) == "hermes/asr/startListening":
set_lightring("blue")
else:
set_lightring("black")
# matrix light color
def set_lightring(color):
#everloop = ['black'] * led.length
ledAdjust = 0.0
if len(everloop) == 35:
ledAdjust = 0.51 # MATRIX Creator
else:
ledAdjust = 1.01 # MATRIX Voice
ledLength = led.length
for i in range(0,11):
if i<5:
everloop[13+i] = color
else:
everloop[i-5] = color
led.set(everloop)
everloop[13-i] = color
led.set(everloop)
sleep(.025)
Connected = False #global variable for the state of the connection
everloop = ['black'] * led.length #setup everloop
broker_address= "localhost" #Broker address
port = 12183 #Broker port
#user = "username" #Connection username
#password = "passwor" #Connection password
client = mqttClient.Client("wake_ring") #create new instance
#client.username_pw_set(user, password=password) #set username and password
client.on_connect= on_connect #attach function to callback
client.on_message= on_message #attach function to callback
client.connect(broker_address, port=port) #connect to broker
client.loop_start() #start the loop
while Connected != True: #Wait for connection
time.sleep(0.1)
#client.subscribe("hermes/asr/startListening")
client.subscribe([("hermes/asr/startListening",0),("hermes/asr/stopListening",0)])
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
client.disconnect()
client.loop_stop()
except:
client.disconnect()
client.loop_stop()
which can be started by a service:
[Unit]
Description=Rhasspy LED control
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 60
Type=idle
ExecStart=/usr/bin/python3 /home/pi/lite_py/rhasspyledcontrol.py
Restart=always
RestartSec=15
User=pi
[Install]
WantedBy=multi-user.target
[/quote]
MATRIX On-board Amplifier Speaker Output
If you want to connect small speakers to the MATRIX Voice, you must change the output channel at every boot. Also the volume may be adjusted - I found 40% to be good for my speakers. Just make the changes in the rc.local and then reboot:
sudo nano /etc/rc.local
# Set alsa volume (sometimes it is -c 3 instead of -c 2!)
sleep 30
amixer -c 2 set Playback_Volume 40%
amixer -c 2 set Master_Playback_Switch Speaker
Happy to hear any of your solutions!