Using external gpio (through core if possible) for a sensor (like PIR sensor)


#1

Hello ,
I think everything is said on the title , what I’d like to add is that I have already found some answers but links for using gpios through core layer are not working , I’m still a beginner so I need some help please , if someone explain how can use the external gpios for this purpose in details so I can get the data from the sensor and use it on other files etc, I need some help also on modifying the wakeword “Alexa” on the alexa / matrix project + making alexa control raspi by getting what the users says . I followed the hackster tuto for this project , thank you so much


#2

Hi @FxEng707. Have you tried our GPIO example for CORE? The script will output the current on/off state your MATRIX’s external GPIOs and toggle pin 0 on/off every 2 seconds.

CORE Installation: https://matrix-io.github.io/matrix-documentation/matrix-core/getting-started/core-installation/
JS Setup: https://matrix-io.github.io/matrix-documentation/matrix-core/getting-started/javascript-installation/
GPIO Example: https://matrix-io.github.io/matrix-documentation/matrix-core/javascript-examples/gpio/

GPIO Example Output

  • All pins are off.
GPIO PINS-->[0-15]
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
  • Pin 0 is on and the rest are off.
GPIO PINS-->[0-15]
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

If the sensor you are using has a digital output, you can send that to the external GPIO and read the current value.

Let us know if you have any more questions.


#3

Hi Carlos
Thank you so much for your help , the links are very helpfull , Once I start working on them I’ll post again if I find some issues , concerning the Matrixa project (Alexa/Matrix) is there a way to control raspberry through alexa? like taking a picture , and controlling gpios etc… , thank you so much.


#4

Anything interacting with an Alexa device will need to have an Alexa Skill created for it. All Alexa devices, including a Raspberry Pi with Alexa installed, use Skills to add additional functionality.

Creating a custom Skill will allow you to handle data received from Alexa devices with your Skill installed. Once set up, you can have the data from your custom Skill sent to your Raspberry Pi

I added a tutorial below that can help you get started.

If you’re interested, the same kind of setup is also required for having your Raspberry Pi interacting with Google Assistant. Instead of Skills, they’re called Actions.


#5

Hi Carlos
Thank you for the answer , what I need exactly is some trick to get what alexa has detected (like speech to text) control raspberry through python or cpp or any kind of script with the text detected , out of alexa , I mean alexa will only give me what has been said , she will work as a speech to text , some of the command will be handled by raspi like turn motor left or something , the rest will be handled with alexa .

Le mer. 28 nov. 2018 à 23:34, Carlos Chacin matrix@discoursemail.com a écrit :


#6

There’s no way to do speech to text on Alexa, without the use of a skill.

Official Response:
https://forums.developer.amazon.com/questions/10458/use-alexa-as-speech-to-text-engine.html


#7

Hello Carlos
Thank you so much for help , It appears to me after searching that is not easy to do what I have in mind with alexa so I decided to use google Speech to text in order to get the mic array input and then manipulate it through cpp or python script , could you help me to do that I just installed matrix Hal (erased raspi sd and reinstalled everything after some OS issue) . thank you so much

Le jeu. 29 nov. 2018 à 00:02, Carlos Chacin matrix@discoursemail.com a écrit :