lmacky
Posts: 9
Joined: Mon Feb 09, 2015 5:30 pm

help with alexa using google aiy kit

Sun May 07, 2017 6:48 pm

I was wondering if anyone can help me please,

I have followed the instructions at http://lifehacker.com/the-simplest-way- ... 1794218212 to install alexapi on a fresh raspbian install,

i have installed pulse audio and vlc,
i am struggling to make it recognise the mic and speaker from the google kit (free with the magpi) and am unsure how to proceed.

is there a site anyone would recommend to help me learn how to install and use this hat beyond the preinstalled google provided image as my linux knowledge is seriously lacking in this area.

Thank you for any help anyone can give.

rednuop
Posts: 4
Joined: Mon May 08, 2017 2:28 pm

Re: help with alexa using google aiy kit

Mon May 08, 2017 3:28 pm

have you tried

Code: Select all

alsamixer
in terminal and then selecting the audio source? I was experimenting a bit last night but stopped at this point. The microphone was working fine without any changes but the audio was being passed through the HDMI.

McLemming
Posts: 5
Joined: Sat May 13, 2017 9:27 pm

Re: help with alexa using google aiy kit

Sat May 13, 2017 9:31 pm

Hey, did anyone make any headway with this. I was wanting to toy around with it. I've given it a look but can't seem to get the mic or speaker to work. I'm sure I'm missing something (possibly diver/gpio related). So was wondering how anyone else was getting on.

Thanks

Bodestone
Posts: 46
Joined: Wed May 10, 2017 7:14 pm

Re: help with alexa using google aiy kit

Sun May 14, 2017 8:55 pm

I followed the instructions from a fresh Raspbian install but obviously could not access the hat as it didn't have drivers.

I tried it on my AIY image. Followed the instructions exactly. Got to the the setup.sh which seemed to work correctly and take me to the authentication step and got:

Success!
The refresh token has been added to your config file.

When trying to start the service I just get:
Failed to start AlexaPi.service: Unit AlexaPi.service failed to load: No such file or directory.

Bodestone
Posts: 46
Joined: Wed May 10, 2017 7:14 pm

Re: help with alexa using google aiy kit

Sun May 14, 2017 10:49 pm

OK, I rebooted, re-ran the install.sh and can now start the service. Nothing yet but stopping the service and:
cd /opt
./AlexaPi/src/main.py

Gives me the following:

CRITICAL: Your input_device 'plughw:CARD=Device,DEV=0' is invalid. Use one of the following:
null
pulse
softvol
micboost
default
sysdefault:CARD=sndrpigooglevoi
dmix:CARD=sndrpigooglevoi,DEV=0
dsnoop:CARD=sndrpigooglevoi,DEV=0
hw:CARD=sndrpigooglevoi,DEV=0
plughw:CARD=sndrpigooglevoi,DEV=0


Looks like I can set the google voice hat but just need to find where to change the input_device

Found and edited input_device in /opt/AlexaPi/src/scripts/inc/device/raspberrypi.sh
Still says plughw:CARD=Device,DEV=0 is invalid
Tried all most options and it still just looks at CARD=Device

Bodestone
Posts: 46
Joined: Wed May 10, 2017 7:14 pm

Re: help with alexa using google aiy kit

Mon May 15, 2017 8:09 pm

Gak. Thought I had it sorted as I got a clean run of main.py

Turned out I had messed up my Alsa config along the way and it had no output at all (without that can't confirm input).

Re-flashed and now I am back to it not actually installing the service, even after reboots and re-tries.
I feel I am close if I can only work out what is stopping the service install int the first place.

...Additional...
Actually, it's beyond me. Hopefully the messages and findings will help someone else.
Re-ran main.py for Alexa and got the red from above. Changed /etc/opt/AlexaPi/config.yaml to: input_device: "default"
main.py started succesfully but it killed all output, even Check audio shortcut.

Given the voice hat was built specifically for Google Voice interaction it may be harder than we throught.

McLemming
Posts: 5
Joined: Sat May 13, 2017 9:27 pm

Re: help with alexa using google aiy kit

Wed May 17, 2017 12:26 pm

I managed to get Alexa working. I tried using a fresh install but failed. I tried using the AIY img and came up with the pulse audio error and attempts to troubleshoot that error didn't work with the voice hat so I went all the way back to the start here is the outline of what I did.

- Flashed Raspbian Jessie lite image
- Downloaded the AIY project kit manually using the instructions found here -> https://github.com/google/aiyprojects-raspbian
- Followed the step one and two in Hacking.md (finished after the driver install)
- Installed AlexaPi following the instructions from the AlexaPi Git hub
- Changed the device in the config file to snd_rpi_googlevoicehat_soundcar and ensured the same was up in alsamixer
- Changed the gpio pin in the config file to 23 and 25 as appropriate

instructions for the last 2 steps can be found on the AlexaPi wiki.

Using the Raspbian Jessie lite image resolves the pulse audio error which is apparently caused by the GUI. Alexa now works on my setup using the voice hat I can press the button or say Alexa. Over the weekend I'm going to look at setting up the Google assistant on the device as well. This should be relatively easy and simply a case of disabling the GPIO button in the alexa config file but I can report back Saturday or Sunday evening if anyone is interested.
Hope this helps

Bodestone
Posts: 46
Joined: Wed May 10, 2017 7:14 pm

Re: help with alexa using google aiy kit

Wed May 17, 2017 8:34 pm

This is great and thanks loads.

I just can't follow the link trail to find the file for the pin configuration.

https://github.com/alexa-pi/AlexaPi/wik ... -debugging
raspberrypi:
button: 7
plb_light: 24
rec_light: 25

Actual Config:
raspberrypi:
# GPIO Pin with button connected
button: 18
# GPIO Pin for the playback/activity light
plb_light: 24
# GPIO Pin for the recording light
rec_light: 25

orangepi:
# GPIO Pin with button connected
button: 20
# GPIO Pin for the playback/activity light
plb_light: 9
# GPIO Pin for the recording light
rec_light: 8

Is it just the 2 button numbers to change? What is orangepi?

Many of us are very new to this.

Cheers.

McLemming
Posts: 5
Joined: Sat May 13, 2017 9:27 pm

Re: help with alexa using google aiy kit

Thu May 18, 2017 9:30 am

Hey,

Your wanting to only change the gpios under the raspberrypi heading from:

Actual Config:
raspberrypi:
# GPIO Pin with button connected
button: 18
# GPIO Pin for the playback/activity light
plb_light: 24
# GPIO Pin for the recording light
rec_light: 25

To
Actual Config:
raspberrypi:
# GPIO Pin with button connected
button: 23
# GPIO Pin for the playback/activity light
plb_light: 25
# GPIO Pin for the recording light
rec_light: 25

Ignore the orangpi one. Its another system similar to the pi only thing you need to touch is the raspberry pi section.

baloo247
Posts: 7
Joined: Mon May 15, 2017 4:22 pm

Re: help with alexa using google aiy kit

Thu May 18, 2017 11:22 am

So does this mean if I want Kodi + Alexa + Voice HAT I'm stuck? Based on the statement that the GUI prevents the HAT from working with Alexa?

I was hoping to build a little unit for the wife so when she is feeding baby she can browse the net and watch movies, whilst using alexa/google assistant to control all teh lights etc. I have alexa in all my rooms so would prefer to have the alexa assistant vs google home.

unless I launch kodi in standalone mode ... ignore me, I can still achieve this.

baloo247
Posts: 7
Joined: Mon May 15, 2017 4:22 pm

Re: help with alexa using google aiy kit

Thu May 18, 2017 5:21 pm

Got this all up and running, but I've noticed that Alexa cannot control my home devices. Anyone else noticed this? Is this not supported with teh Alexa voice service?

Bodestone
Posts: 46
Joined: Wed May 10, 2017 7:14 pm

Re: help with alexa using google aiy kit

Thu May 18, 2017 5:42 pm

baloo247 wrote:So does this mean if I want Kodi + Alexa + Voice HAT I'm stuck? Based on the statement that the GUI prevents the HAT from working with Alexa?

I was hoping to build a little unit for the wife so when she is feeding baby she can browse the net and watch movies, whilst using alexa/google assistant to control all teh lights etc. I have alexa in all my rooms so would prefer to have the alexa assistant vs google home.

unless I launch kodi in standalone mode ... ignore me, I can still achieve this.
At the end of the alexapi install it has a link telling you how to configure PA to work in desktop mode: https://github.com/alexa-pi/AlexaPi/wik ... pulseaudio

baloo247
Posts: 7
Joined: Mon May 15, 2017 4:22 pm

Re: help with alexa using google aiy kit

Thu May 18, 2017 7:35 pm

So the problem with AlexaPi is that it uses the old APIs, so wont support home automation devices. Any suggestions for alternatives, or how to upgrade it?

Bodestone
Posts: 46
Joined: Wed May 10, 2017 7:14 pm

Re: help with alexa using google aiy kit

Thu May 18, 2017 7:53 pm

Also, many thanks for the clarification on the button settings McLemming.

Cheers,

Bode.

Sheepyshoe
Posts: 1
Joined: Thu May 18, 2017 9:22 pm

Re: help with alexa using google aiy kit

Thu May 18, 2017 9:41 pm

I've got this all up and running but when I ask for the weather Alexa cuts off half way through the response. When I check the status with

Code: Select all

sudo systemctl status AlexaPi.service
I get "Failed to create secure directory (/var/lib/AlexaPi/.config/pulse): Operation not permitted"

When I was following the setup guide for pulse, it was asking to run

Code: Select all

mkdir -p /var/lib/AlexaPi/.config/pulse
sudo cp /etc/pulse/client.conf /var/lib/AlexaPi/.config/pulse/
but permission was denied, so I tried

Code: Select all

chown -R alexapi:alexapi /var/lib/AlexaPi/
usermod --home /var/lib/AlexaPi alexapi
but that didn't give back permission denied and not permitted as well. I'm assuming this is where the hangup is.

Can anyone shed some light on this?

McLemming
Posts: 5
Joined: Sat May 13, 2017 9:27 pm

Re: help with alexa using google aiy kit

Thu May 18, 2017 9:43 pm

My problem was on configuring pulse audio I removed the config for the VoiceHat. Someone more patient then me may fair better. But as i didn't need the GUI I figured why bother? (Lazy I know)

You'd want to move to the standard Alexa SDK. I've not read the documentation on it so can't confirm but I'd imagine the process would be similar. I'm going to sit tonight and read through the pros and cons of AlexaPi and the official version and see if its worth swapping. I hadn't realised that it actually ran a different version I thought it was just a tweaked version of the same code.

Bodestone
Posts: 46
Joined: Wed May 10, 2017 7:14 pm

Re: help with alexa using google aiy kit

Sat May 20, 2017 5:03 pm

Hi McLemming. Just one more question if I may.

- Followed the step one and two in Hacking.md (finished after the driver install)

Does that mean you run the step: sudo scripts/install-alsa-config.sh?

I'm running from lite.
Alsamixer shows device as: snd_rpi_googlevoicehat_soundcar

When I run main.py from Alexapy/src I still get

Your input_device 'snd_rpi_googlevoicehat_soundcar' is invalid. Use one of the following:
null
pulse
softvol
micboost
default
sysdefault:CARD=sndrpigooglevoi
dmix:CARD=sndrpigooglevoi,DEV=0
dsnoop:CARD=sndrpigooglevoi,DEV=0
hw:CARD=sndrpigooglevoi,DEV=0
plughw:CARD=sndrpigooglevoi,DEV=0


Cheers.

....Edit

Changed devices to "default" in config.yaml

baloo247
Posts: 7
Joined: Mon May 15, 2017 4:22 pm

Re: help with alexa using google aiy kit

Tue May 30, 2017 4:40 pm

I can confirm that the Avs-sample works with the AIY hat. you just need to make sure you run the wake word engine as su.

smartthings integration, pandora, shopping list work.

spotify doesnt work.

czarnikjak
Posts: 19
Joined: Sat May 20, 2017 9:16 pm

Re: help with alexa using google aiy kit

Tue May 30, 2017 10:34 pm

Does tune in radio work?

baloo247
Posts: 7
Joined: Mon May 15, 2017 4:22 pm

Re: help with alexa using google aiy kit

Wed May 31, 2017 8:36 am

I'll confirm shortly, there's another form of the avs-sample that autostarts on bootup, once I've installed it I'll come back and confirm.
The one thing I like about the google AIY project is that you can run scripts through voice commands, it'd be nice to do this with the AVS code. I'm sure it's possible, will look into that at some point.
B

pbhound
Posts: 10
Joined: Wed Jul 26, 2017 3:55 pm

Re: help with alexa using google aiy kit

Tue Dec 25, 2018 2:50 am

hi all,

I would like to see if I can get some help with my issue on this, I am running the setup script from here https://github.com/EmerickH/EmerickH/bl ... md#windows. I get through the script (well to the end when it wants to register the device) and receive the error "We're Sorry! an error occurred when we tried to process your request. Rest assured, we're already working on the problem and expect to resolve it shortly."

and that's all I get. any help would be greatly appreciated.

RyFi13
Posts: 1
Joined: Sun Jul 14, 2019 4:52 pm

Re: help with alexa using google aiy kit

Sun Jul 14, 2019 5:01 pm

Hello All!

Brand new to this forum and have encountered every issue that I can imagine. I've followed every guide, debug, etc and I cannot seem to get this AIY kit to run! I'm also brand new to the whole coding/github forum thing, so please let me know what it is that I need to post in terms of code and I'll do anything I can.

The last guide I attempted was the recommendation by McLemming, however I'm still getting error codes and can't run the AlexaPi service. Here is the latest status that I received:

Code: Select all

pi@raspberrypi:~/aiyprojects-raspbian $ sudo systemctl status AlexaPi.service
* AlexaPi.service - Alexa client for all your devices
   Loaded: loaded (/usr/lib/systemd/system/AlexaPi.service; enabled)
   Active: failed (Result: exit-code) since Sun 2019-07-14 10:26:31 MDT; 16min ago
     Docs: https://github.com/alexa-pi/AlexaPi/wiki
 Main PID: 576 (code=exited, status=1/FAILURE)

Jul 14 10:26:30 raspberrypi systemd[1]: Starting Alexa client for all your d....
Jul 14 10:26:30 raspberrypi systemd[1]: Started Alexa client for all your de....
Jul 14 10:26:31 raspberrypi python3[576]: Traceback (most recent call last):
Jul 14 10:26:31 raspberrypi python3[576]: File "/opt/AlexaPi/src/main.py", l...>
Jul 14 10:26:31 raspberrypi python3[576]: import yaml
Jul 14 10:26:31 raspberrypi python3[576]: ImportError: No module named 'yaml'
Jul 14 10:26:31 raspberrypi systemd[1]: AlexaPi.service: main process exited...E
Jul 14 10:26:31 raspberrypi systemd[1]: Unit AlexaPi.service entered failed ....
Jul 14 10:35:12 raspberrypi systemd[1]: Stopped Alexa client for all your de....
Hint: Some lines were ellipsized, use -l to show in full.
and:

Code: Select all

pi@raspberrypi:~ $ sudo systemctl status AlexaPi.service
* AlexaPi.service - Alexa client for all your devices
   Loaded: loaded (/usr/lib/systemd/system/AlexaPi.service; enabled)
   Active: failed (Result: exit-code) since Sun 2019-07-14 10:26:31 MDT; 34min ago
     Docs: https://github.com/alexa-pi/AlexaPi/wiki
 Main PID: 576 (code=exited, status=1/FAILURE)

Jul 14 10:26:30 raspberrypi systemd[1]: Starting Alexa client for all your d....
Jul 14 10:26:30 raspberrypi systemd[1]: Started Alexa client for all your de....
Jul 14 10:26:31 raspberrypi python3[576]: Traceback (most recent call last):
Jul 14 10:26:31 raspberrypi python3[576]: File "/opt/AlexaPi/src/main.py", l...>
Jul 14 10:26:31 raspberrypi python3[576]: import yaml
Jul 14 10:26:31 raspberrypi python3[576]: ImportError: No module named 'yaml'
Jul 14 10:26:31 raspberrypi systemd[1]: AlexaPi.service: main process exited...E
Jul 14 10:26:31 raspberrypi systemd[1]: Unit AlexaPi.service entered failed ....
Jul 14 10:35:12 raspberrypi systemd[1]: Stopped Alexa client for all your de....
Hint: Some lines were ellipsized, use -l to show in full.
If there is somewhere else for me to locate the logs or errors that might be able to solve this, just tell me how to access/execute them and I'll gladly post! Just want to get this thing up and running. :)

Thank you all in advanced!

lopezst1
Posts: 5
Joined: Tue May 05, 2020 2:23 pm

Re: help with alexa using google aiy kit

Sun Jul 19, 2020 6:36 pm

For some reason you do not have yaml installed for python3. This should have been done on install but for some reason it was skipped. You can either install by typing

Code: Select all

python3 -m pip install PyYAML
or remove everything and start fresh. Who knows what else is missing so starting fresh may be the way to go, but trying the pip install first is harmless enough.

Return to “AIY Projects”