[Solved] Working Matrix Voice on Raspberry Pi

Great just did a new install using MATRIX Voice Running Alexa Demo in Hands-Free Mode, have been working on this for several days now. Some questions still exist. First, how to use the speaker module on the Matrix Voice board, second when saying Alexa the LEDs turn on red, after her response they turn light blue and stay on until the next question. Is this normal or do we still have some bugs in the code. Thanks to all those who assisted me.
Danny

Hi @rockman55,

Glad that you got the LEDs working! The behavior of the LEDs is correct

You can easily change colors or when they appear with just few lines of codes. Please see here

After the change you need to build again the Wakeword project by going to the src/ folder and doing make. Let me know if you help here.

Regarding using speaker output we are finalizing a guide for it. Would post here community as soon as it is out.

Hope it helps.

Yoel

Great thanks. I see the colors that are used. What is the code or combination to change the colors. For example: to display the color red, it looks like :slight_smile:
led.red = 50;
led.green = 0;
led.blue = 0;
led.white = 0;
and blue is:

        led.red = 0;
        led.green = 0;
        led.blue = 50;
        led.white = 0;

I assume green would be led.green = 50, but to make like blue green what would be needed?
Also what is the exact procedure to build again (make) the Wakeword project?
Looking forward for the fix on the audio.
Thanks,
Danny

can you provide more details about getting the LEDs on? my are still off.

thanks

I just reran the setup again, and paid attention to this information from the other thread:
From the guide in hackster, you should also have installed libmatrixio-creator-hal-dev. Please try
sudo apt-get install matrixio-malos libmatrixio-creator-hal-dev
after this you can build the wakeword app yourself :
cd alexa-avs-sample-app/samples/wakeWordAgent/src/
cmake .
make
and try run the services again to test the demo.
(if you prefer you could instead just run the automated_install.sh again after installing hal-dev, this will build the wakeword project at the end)

Good Luck

thanks…i didnt know that i have to rebuild the app.

i will try

i tried it… at first time it worked but then i tried wakeWordAgent with kitt_ai and failed. LEDs turned off.

I tried to setup the demo again. But at the End this error appears

[ 35%] Linking CXX executable wakeWordAgentTest
CMakeFiles/wakeWordAgentTest.dir/home/pi/Desktop/alexa-avs-sample-
app/samples/wakeWordAgent/src/WakeWordAgent.cpp.o: In function 
`AlexaWakeWord::WakeWordAgent::mainLoop()':
WakeWordAgent.cpp:(.text+0x838): undefined reference to `matrix_hal::WishboneBus::WishboneBus()'
WakeWordAgent.cpp:(.text+0x84c): undefined reference to `matrix_hal::WishboneBus::SpiInit()'
WakeWordAgent.cpp:(.text+0x860): undefined reference to `matrix_hal::Everloop::Everloop()'
WakeWordAgent.cpp:(.text+0x89c): undefined reference to 
`matrix_hal::MatrixDriver::Setup(matrix_hal::WishboneBus*)'
WakeWordAgent.cpp:(.text+0xadc): undefined reference to 
`matrix_hal::Everloop::Write(matrix_hal::EverloopImage const*)'
WakeWordAgent.cpp:(.text+0xc94): undefined reference to 
`matrix_hal::Everloop::Write(matrix_hal::EverloopImage const*)'
collect2: error: ld returned 1 exit status
CMakeFiles/wakeWordAgentTest.dir/build.make:566: recipe for target 'wakeWordAgentTest' failed
make[2]: *** [wakeWordAgentTest] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/wakeWordAgentTest.dir/all' failed
make[1]: *** [CMakeFiles/wakeWordAgentTest.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
chown: changing ownership of '/home/pi/Desktop/alexa-avs-sample-app/samples/wakeWordAgent/ext/lib/libblas.so.3': Operation not permitted

=============================
*****************************
========= Finished ==========
*****************************
=============================

what the matter? Hal is setup properly.

I always run this wakeword:
Sensory: cd /home/pi/alexa-avs-sample-app/samples/wakeWordAgent/src && ./wakeWordAgent -e sensory

me as well,…but why does the error during compiling occur?

Are you installing with the automated script? That is what I used.

I too would be interested in knowing how to control the LEDs. Mine stay off as well.

The code for controlling the LEDs is already in the WakeWordAgent app. If you want to change the behavior please check here how it’s done:

Can you share the output of this?
sudo dpkg --list | grep matrix

Thank you

Sure @yoelrc88 here you go:

pi@raspberrypi:~ $ sudo dpkg --list | grep matrix
ii  libmatrixio-creator-hal:armhf         0.2.1                                      armhf        Hardware Abstraction Layer for MATRIX.
ii  libmatrixio-creator-hal-dev           0.2.1                                      armhf        Hardware Abstraction Layer for MATRIX (headers)
ii  libmatrixio-malos:armhf               0.1.2                                      armhf        Libraries of MATRIX abstraction layer for MOS
ii  libmatrixio-protos:armhf              0.1.1                                      armhf        Protocolbuffers for MATRIX abstraction layer
ii  matrixio-creator-init                 0.4.2                                      armhf        Install scripts that can program the MATRIX Creator FPGA and SAM3 IMU.
ii  matrixio-malos                        0.3.0                                      armhf        Allows queries to MATRIX Creator hardware via ZMQ.
ii  matrixio-openocd                      1.0.1                                      armhf        Open on-chip JTAG debug solution for ARM and MIPS systems
ii  matrixio-protobuf                     3.4.0                                      armhf        Protocol Buffers - Google's data interchange format. (From GRPC 3.4.0)
ii  matrixio-xc3sprog                     1.1.1                                      armhf        Spartan3, XCF and CPLD JTAG programmer and other utilities.

WakeWordAgent.cpp relevant lines look like this (I have not modified the file)

     98       switch (m_currentState) {
     99         case State::WAKE_WORD_DETECTED:
    100           m_IPCHandler->sendCommand(Command::WAKE_WORD_DETECTED);
    101           setState(State::SENT_WAKE_WORD_DETECTED);
    102           for (hal::LedValue& led : image1d.leds) {
    103             led.red = 50;
    104             led.green = 0;
    105             led.blue = 0;
    106             led.white = 0;
    107           }
    108           everloop.Write(&image1d);
    109           break;
    110 
    111         case State::WAKE_WORD_PAUSE_REQUESTED:
    112           m_wakeWordEngine->pause();
    113           m_IPCHandler->sendCommand(Command::CONFIRM);
    114           setState(State::WAKE_WORD_PAUSED);
    115           break;
    116 
    117         case State::WAKE_WORD_RESUME_REQUESTED:
    118           m_wakeWordEngine->resume();
    119           setState(State::IDLE);
    120           for (hal::LedValue& led : image1d.leds) {
    121             led.red = 0;
    122             led.green = 0;
    123             led.blue = 50;
    124             led.white = 0;
    125           }
    126           everloop.Write(&image1d);
    127           break;
    128 
    129         default:
    130           // no-op
    131           break;
    132       }

It looks like you have the correct packages.

Regarding this:

Are you referring to control the LEDs when the Alexa demo is speaking/listening?
If yes, the answer is that it should be working for what I saw in the file you shared.

To test the LEDs you can use the demo arc_demo.cpp in HAL repo https://github.com/matrix-io/matrix-creator-hal?

Let me know how it goes and if you need more help.

EDIT: I ran the automated_setup of the AVS sample again, and now the leds respond.

The arc demo works, the leds start slowly pulsating. When I kill the arc_demo with Ctrl-C, the leds stop pulsating and are of a constant brightness.

However, when I run the Alexa demo, the leds stay the same color / brightness they were when I killed the arc demo. WakeWordAgent doesn’t seem to do anything to them.

Alexa Demo logs:

pi@raspberrypi:~/matrix/alexa-avs-sample-app/samples/companionService $ npm start

> alexa-voice-service-sample-companion-service@1.0.0 start /home/pi/matrix/alexa-avs-sample-app/samples/companionService
> node ./bin/www

This node service needs to be running to store token information memory and vend them for the AVS app.

Listening on port 3000
Successfully retrieved access token for session id: ca264da0-2006-478f-8c7c-ab53d8d46976


pi@raspberrypi:~/matrix/alexa-avs-sample-app/samples/javaclient $ mvn exec:exec
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Alexa Voice Service Sample Java Client 20160207.7
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- exec-maven-plugin:1.2.1:exec (default-cli) @ sample-java-client ---

pi@raspberrypi:~/matrix/alexa-avs-sample-app/samples/wakeWordAgent/src $ ./wakeWordAgent -e sensory
INFO:main: Starting Wake Word Agent
INFO:WakeWordAgent: State set to IDLE(2)
INFO:Initializing Sensory library | library name: TrulyHandsfree | library version: 5.0.0-beta.10.2 | model file: ../ext/resources/spot-alexa-rpi.snsr
WARNING:Library expires on: License expires on 28 Apr 2018 00:00:00 GMT
INFO:SensoryWakeWordEngine: mainLoop thread started
INFO:WakeWordIPCSocket::mainLoop thread started
INFO:WakeWordIPCSocket: init socket on port:5123
INFO:===> Connected to AVS client <===
INFO:WakeWordAgent: thread started
INFO:===> WakeWordAgent: wake word detected <===
INFO:WakeWordAgent: State set to WAKE_WORD_DETECTED(3)
INFO:WakeWordAgent: State set to SENT_WAKE_WORD_DETECTED(4)
INFO:WakeWordAgent: IPC Command received:3
INFO:WakeWordAgent: State set to WAKE_WORD_PAUSE_REQUESTED(5)
INFO:SensoryWakeWordEngine: handling pause
INFO: *** THREAD JOINING: Sensory ***
INFO:SensoryWakeWordEngine: mainLoop thread ended
INFO:WakeWordAgent: State set to WAKE_WORD_PAUSED(6)
INFO:WakeWordAgent: IPC Command received:4
INFO:WakeWordAgent: State set to WAKE_WORD_RESUME_REQUESTED(7)
INFO:SensoryWakeWordEngine: handling resume
INFO:SensoryWakeWordEngine: mainLoop thread startedINFO:WakeWordAgent: State set to IDLE(2)

Some other information that may or may not be useful:

pi@raspberrypi:~ $ /usr/share/matrixlabs/matrixio-devices/fpga_info
IDENTIFY = 6032bad2
VERSION = 10005

pi@raspberrypi:~ $ cat /sys/class/gpio/gpio25/value
1

pi@raspberrypi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 8.0 (jessie)
Release:	8.0
Codename:	jessie

Let me double check your current status:

  • You have the audio part of the alexa demos working . You can make questions and Alexa answers.
  • Just the LEDs interaction is not working.
  • HAL demos using the LEDs worked
  • Wakeword app does change the LEDs

Is this correct?

Yes I got the wakeword app to change the LEDs, so that problem is solved now. Thanks for your help!

1 Like