Before getting started, let's review what you'll need.
- Raspberry Pi 3 (Recommended) or Pi 2 Model B (Supported).
- MATRIX Voice or MATRIXCreator - Raspberry Pi does not have a built-in microphone, the MATRIX Voice&MATRIXCreator each have an 8 mic array - Buy MATRIX Voice or Buy MATRIX Creator.
- Micro-USB power adapter for Raspberry Pi.
- Micro SD Card (Minimum 8 GB) - An operating system is required to get started. You can download Raspbian Stretch and use the guides for Mac OS, Linux and Windows in the Raspberry Pi website.
- External Speaker with 3.5 mm audio cable.
- A USB Keyboard & Mouse, and an external HDMI Monitor - we also recommend having a USB keyboard and mouse as well as an HDMI monitor handy. You can also use the Raspberry Pi remotely, see this guide from Google.
- Internet connection (Ethernet or WiFi)
- (Optional) WiFi Wireless Adapter for Pi 2. Note: Pi 3 has built-in WiFi.
If you haven't already, be sure to set up your Raspberry Pi with your MATRIX Device.1. Installing the MATRIX Dependancies (Raspberry Pi)
Input the following commands on your Raspberry Pi's terminal. Be sure to copy the entire command block for each step!
Add the MATRIX repository 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 sudo apt-get update sudo apt-get upgrade
Install MATRIX HAL & PIP 3.
sudo apt-get install matrixio-creator-init libmatrixio-creator-hal libmatrixio-creator-hal-dev python3-pip
Upgrade PIP 3 & install MATRIX Lite PY.
python3 -m pip install --upgrade pip python3 -m pip install --user matrix-lite
Reboot your device.
Install the MATRIX Kernel Modules.
sudo apt install matrixio-kernel-modules
Reboot your device again.
2. Installing Chirp
Although Chirp provides multiple SDKs to choose from, we'll be using the Python SDK for this guide.
Install the dependancies needed by Chirp.
sudo apt-get install python3-setuptools portaudio19-dev libffi-dev libsndfile1
3. Set Up Your Chirp Credentials
sudo python3 -m pip install chirpsdk
Create a Chirp account here https://developers.chirp.io/sign-up. Once logged in, go to https://developers.chirp.io/applications and select a transmission. Pick any configuration option you'd like to use. However, keep in mind that Chirps can only be sent/received from the same configuration.
Copy your credentials from the Python tab. We're going to save them in a file.
Run the command below to open the nano terminal editor.
Paste your credentials inside the editor. Once finished, press
y, and then the
enter key to save.
You're all set to start using Chirp with the MATRIX Voice and MATRIX Creator!4. Verifying Everything Works
Before moving to Python, it's good to make sure that everything we've installed is working. Thankfully Chirp's Python SDK comes with a few Command Line utilities that are perfect for this.
Chirp CLI Docs:https://developers.chirp.io/docs/tutorials/command-line
To start, you're going to want to open 2terminalsessions on your Pi. One session will be used to receive a chirp while the other sends a chirp.
Session 1: The command below will continually listen for chirps and print their value. It will also show you a list of input devices. The MATRIX microphones should be in the third index (-i 3) with the name below:
MATRIXIO-SOUND: - (hw:2,0), ALSA (8 in, 0 out)
chirp-receive -u -i 3
Session 2: To send a chirp use the following command for a hello world message. By default, the audio output will be from your Pi's audio jack.
chirp-send -u "Hello From Chirp!"
Result: Below is the expected output of the terminal using the chirp-receive command.
We highly recommend reading the Chirp Python documentation to have a better understanding of the SDK: https://developers.chirp.io/docs/getting-started/python
There are two Python scripts attached in this guide:
receive.py will allow you to set the MATRIX LEDs through a chirp message.
In another terminal, you can run the command below to play around with the MATRIX LEDs
chirp-send -u "blue"
send.py script will toggle between sending Chirps with "red" & "green" as the message.
You're all set! Feel free to play around with the examples for a better understanding of Chirp. The SDK is non-blocking which can be a little tricky for newer users.