Using Amazon Alexa with Matrix Voice to control a Stepper Motor

I’m making a project where I need to be able to use voice commands to control a stepper motor. I have the Amazon Alexa sdk installed and operating on my matrix voice and raspberry pi 3 model b. If anyone can guide me through how to setup the matrix voice to control a stepper motor with Amazon Alexa please let me know.

Alec

as far as i know gpio controlled by the rpi is not working currently. the gpio controlled by the esp (if you have on) should work.

Okay cool, I did add the ESP32 to the Matrix Voice that I got. Do you know of an existing getting started guide on how to program those pins?

i got some output on the gpio using micropython on the esp32. i’ll think they can also be used as normal gpio in the default esp framework. an example guide using esp32 is here:

and

https://matrix-io.github.io/matrix-documentation/matrix-voice/esp32/

the port 17, 18 , 20, 22 should be useable within the esp32 using the described esp IO ports.

https://matrix-io.github.io/matrix-documentation/matrix-voice/resources/pinout/

I appreciate the info. I’ll practice with it and see what I can’t figure out. Do you know if there’s a way to add your own Alexa voice commands to activate those GPIO pins?

Hi @gr8wh1tebuffalo,

Others users have had the same question on how to add “specific commands” the Alexa demo. This demo uses the public AVS device SDK. You will have to go a bit deeper into the SDK mechanisms to add this. I personally haven’t tried that yet but I think could be done using what they call Capabilities. This SDK is written in C++ so you have to be confortable with it.

On another option, personally, I think the Google Assistant demo is easier to extend using “Actions”, see here an example from Google. (Google Assistant is written in python)

-Yoel

Thanks for the response, I may end up going that route and using Google assistant. I’m not very familiar with C++ just yet.

OK Great, I have been wanting to test the Google Actions with MATRIX Voice/Creator for something simple (change the Everloop colors and dimming) … but I haven’t yet . So please share you progress if possible :).

Let me know if you need any help.

-Yoel

Will do! I’m sure you will here more from me

the easiest way it think is to write your own alexa skill. i have written own alexa skills with flask-ask (python). it just took me about 15 minutes to write my skill to control my tv with cec. there are plenty of tutorials out there:

you solution could be something like this.

alexa skill (e.g. flask-ask) <--- mqtt ---> voice esp32 (gpio) written in c or micropython
2 Likes

I’m currently working to activate the esp32 (gpio) on my matrix voice. Is micropython similar to python? I’m wanting to write a program that when triggered by various voice commands will turn a motor on for various set amounts of time then turn it off.

yeah micropython is small subset of python written to run on a variant of mcus like the esp32.

i got the standard esp32 micropython flashed to the voice esp32 and got the gpio working and everloop via the spi bus.

currently i’m reading into the writing of own micropython c modules to integrate the voice esp hal. But finding my way in there is relatively difficult, at least for me.

2 Likes

So I have the Matrix Voice with ESP32 Microcontroller. Do I need to do any setup to use the FPGA as GPIO Pins? To be more clear, do the GPIO pins of the Raspberry Pi the plug into the Matrix Voice just become GPIO pins on the expansion GPIO of the Matrix voice? And if so, can I address the GPIO pins in a python program as FPGA G1 instead of say GPIO 26? I am still trying to setup the esp32 but am having some issues.

Thanks,
Alec

The 40 pin GPIO Raspberry Pi connector was not designed for other use other than the Rasp Pi communication with the board. You should use the external 24 GPIO pins connector in the Top of the MATRIX Voice.

but are they now supported. the last information i got was that the voice gpios are currently not supported in (hal/matrix_malos) only the creator is supported.

Okay, I do understand that. So are the 24 GPIO connections on top of the Matrix Voice usable just as the GPIO pins of the Raspberry Pi are? Or is there a seperate setup process I have to do in order to use the 24 GPIO pins? I’m looking to use them in a python program so I was curious how I would specify the GPIO pin in the program at setup.
For example the pins using the RPi.GPIO library for the raspberry Pi looks like this:
DIR = 20 # Direction GPIO Pin
STEP = 21 # Step GPIO Pin
Is there a library I can import or something similair to interface with the GPIO pins of the Matrix voice just the same?

ok i have updated my voice if you do the following and have the matrix kernel modules installed, there are some gpios usable:

pi@matrix1:~ $ sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-53, parent: platform/3f200000.gpio, pinctrl-bcm2835:
 gpio-18  (                    |sysfs               ) out hi
 gpio-24  (                    |sysfs               ) out hi
 gpio-25  (                    |sysfs               ) out hi
 gpio-26  (                    |sysfs               ) out hi

gpiochip2: GPIOs 100-101, brcmvirt-gpio, can sleep:
 gpio-100 (                    |led0                ) out hi

gpiochip1: GPIOs 128-135, brcmexp-gpio, can sleep:
 gpio-135 (                    |led1                ) in  hi

gpiochip3: GPIOs 496-511, parent: spi/spi0.0, matrixio-gpio, can sleep:
pi@matrix1:~ $

GPIOs 0-53: are the default RPI GPIOs

the voice gpios should be from 496-511 (matrixio-gpio) so by default they should be usable from the standard python rpio gpio lib (RPi.GPIO). but i’m not sure, if the lib allows to address other then the RPI default gpios. i’ll check if my python matrix lib supports the voice gpios. just let me hook up my logic analyzer and run some tests.

i had no luck. i had attached a led to the first gpio and set the output to high. the led did not light up.

so it seems that the voice gpios are still not accessible from the rpi.:

image

the output keeps beeing low:

image

Interesting, so you’re saying there’s no way to actually use those GPIO’s on top of the matrix voice? What about those GPIO’s that are part of the ESP32? All I need for my project is 2 of the GPIO pins, 3.3v, and ground. Then from there program it, preferably using python or a variant of it to send signals from those GPIO pins. I’m going to work more on this on Thursday to see if I can make some progress.