MATRIX Voice Running Mycroft.AI


#1

Hello community,

after some trial and errors I have managed to get a running installation of MATRIX Voice (on a Raspberry Pi 3B+) with Mycroft.AI (and connected it to my openHAB installation). This has already been discussed here in the Forum: Mycroft AI Partnership but I would like to provide some details.

Here are the step-by-step instructions:

  1. Register an account at https://mycroft.ai/get-mycroft/
  2. Download the Picroft Stretch image from https://github.com/MycroftAI/enclosure-picroft/tree/stretch (or https://mycroft.ai/to/picroft-unstable)
  3. Burn the image to a micro-SD card (e.g. with Etcher)
  4. Optional: create a wpa_supplicant.conf file in the “boot” part of the microSD card with your Wifi Information:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid=“YOUR_SSID”
psk=“YOUR_PASSWORD”
key_mgmt=WPA-PSK
}

  1. Connect your MATRIX Voice to the Raspberry Pi, insert the microSD card (Optional: Connect a monitor and keyboard and/or network cable) and boot the Raspberry Pi.

  2. SSH to picroft.local (or find the IP adress from your router), login “pi” password “mycroft” (or use monitor/keyboard)

  3. Follow the mycroft.AI setup, choose “other” under microphone. Wait for mycroft.AI to do it’s thing. If you end up on the mycroft.AI command line (Log Output on top), use Ctrl+C to quit.

  4. Now it is time to install the MATRIX Voice Kernel Modules (see also: https://github.com/matrix-io/matrixio-kernel-modules)

Add repo and key

curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
echo “deb https://apt.matrix.one/raspbian $(lsb_release -sc) main” | sudo tee /etc/apt/sources.list.d/matrixlabs.list

Update packages and install

sudo apt-get update
sudo apt-get upgrade

Reboot in case of Kernel Updates

sudo reboot

Installation MATRIX Packages

sudo apt install matrixio-kernel-modules
sudo apt-get install pulseaudio

One more reboot

sudo reboot

  1. Make sure that the MATRIX microphone is recognized:

pactl list sources short

The result should look something like this :

(.venv) pi@picroft:~ $ pactl list sources short
0 alsa_output.platform-snd_dummy.0.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
1 alsa_input.platform-snd_dummy.0.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
2 alsa_input.platform-3f204000.spi-platform-matrixio-codec.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
3 alsa_output.platform-soc_audio.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz SUSPENDED

  1. Make sure that the standard microphone is the MATRIX Voice (kill pulseaudio, then set default):

pulseaudio -k
pactl set-default-source 2
pulseaudio --start

  1. Check the output volume

amixer

The result might look like this (notice the 1%):

(.venv) pi@picroft:~ $ amixer
Simple mixer control ‘Master’,0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 65536
Mono:
Front Left: Playback 450 [1%] [on]
Front Right: Playback 450 [1%] [on]
Simple mixer control ‘Capture’,0
Capabilities: cvolume cswitch cswitch-joined
Capture channels: Front Left - Front Right
Limits: Capture 0 - 65536
Front Left: Capture 65536 [100%] [on]
Front Right: Capture 65536 [100%] [on]

To fix this, set the volume:

amixer set Master 99%

The result of ‘amixer’ should now be this:

(.venv) pi@picroft:~ $ amixer
Simple mixer control ‘Master’,0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 65536
Mono:
Front Left: Playback 64881 [99%] [on]
Front Right: Playback 64881 [99%] [on]
Simple mixer control ‘Capture’,0
Capabilities: cvolume cswitch cswitch-joined
Capture channels: Front Left - Front Right
Limits: Capture 0 - 65536
Front Left: Capture 65536 [100%] [on]
Front Right: Capture 65536 [100%] [on]

  1. If after a reboot the volume goes back to low, put the command in the audio_setup.sh

sudo nano audio_setup.sh

Add the following line to the end of the file, then exit and save (Strg+X, then Y):

amixer set Master 99%

  1. Now you can do a test (records audio and plays it back to you)

arecord --duration 5 --rate 16000 --format S16_LE test.wav && aplay ./test.wav

  1. And another test through mycroft.AI:

mycroft-mic-test

  1. Mycroft.AI should keep telling you to register the device. Go to https://home.mycroft.ai/ and add Device, then type the spoken code.

  2. Optional: Install openHAB skill (https://github.com/openhab/openhab-mycroft)

cd /opt/mycroft/skills
git clone https://github.com/openhab/openhab-mycroft.git skill-openhab
cd skill-openhab
pip install -r requirements.txt

Then you need to add the openHAB configuration to your ‘mycroft.conf’:

sudo nano ./mycroft/mycroft.conf

Then change the file, mine looks like this:

{
“max_allowed_core_version”: 18.8,

“openHABSkill”: {
“host”: “OPENHAB.IP.GOES.HERE”,
“port”: “OPENHAB-PORT”
}
}

Enjoy talking to Mycroft!


Mycroft AI Partnership
#2

Nice work :slight_smile:


#3

Great work @SpaceGlider!

I just followed your steps to install Mycroft.AI on the MATRIX Creator and it works well!

We would love to see this post as a Hackster guide so more people can follow it. Would you like to make a Hackster guide out of this? If not, we can make one and attribute the work to you. Let us know!

Thanks again, excited about this!


#4

Hello @Samreen, I guess it is more helpful if all the Hackster guides are created under the MATRIX account so it’s easier to find! Maybe there are some smarter ways to do/explain the steps I made, feel free to adjust it!

Maybe also add that Mycroft needs some configuration from home.mycroft.ai (e.g. the timezone/location) to make more sense.

Cheers!


#5

@SpaceGlider mycroft-mic-test works but arecord --duration 5 --rate 16000 --format S16_LE test.wav && aplay ./test.wav does not. Any suggestions?


#6

Hmm not really, but if the Mycroft test works then you should be set and able to use Mycroft!


#7

Hey @Neo arecord won’t work if your device’s microphones are already in use (mycroft in this case).


#8

Hey @SpaceGlider

We posted the Mycroft guide and accredited it to you, thank you again for this amazing work! We were wondering if you had a Hackster account or if you would like to make one so that we can tag you on the guide as a creator as well.

I also wanted to ask you if you’ve had issues reconnecting with Picroft after installing MATRIX stuff and registering it the first time. For example, after Mycroft worked great the first time, the third time I rebooted my Pi, it’s been stuck on this screen for 15 minutes.


#9

Hi @Samreen
I just saw the guide on hackster and it looks great. Thanks for the credit, I’ll think about making a hackster account but don’t worry for now!

I also have some stability issues with Mycroft/Picroft and the Matrix Voice, but it is mostly during boot-up. Sometimes it takes 3 to 4 tries until it’s booted up. However, after that it is really stable and runs for days. Both the Pi and the Matrix Voice board get quite warm however and the CPU usage is 60% constantly.

I don’t know whether the stability problems during boot-up are due to mycroft/picroft or the Matrix Voice. The picroft image is labeled unstable so maybe it will get better in the future?