Nice and Clean explanation !!. Wanted to add a point, it is important to add those extra lines (as shown in the video) in .asoundrc file to avoid errors in the end. I was able to connect few lights and control it using IFTTT and Blynk.
Hey bro i just spent 2 hours looking for how to fix this. I needed to go to the google api screen and on the tabs go to OAuth Consent tab. Then it should say publish as the first button there, do that and it should work.
Does this integrate with other Google Home devices (ie. Google Mini)? I want to make a touch screen smart mirror and use a Pi 4 to power it - If I have a Google Mini and Say "Hey Google..." will the devices work out on their own who answers or would both devices answer the trigger word?
Super clean video instructions. I was trying the sample textinput.py but for some of the requests like "Show me picture of a car" I get null response on the RPi3. Would you happen to know how I can get it to print the suggested images page or HTML or JSON response which I can parse?
Hey! There are a couple ways to do this. The easiest way follow this article to get the button working (just the first method). raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/ Then go into pushtotalk.py and replace: if wait_for_user_trigger: click.pause(info="Press Enter ...") with if wait_for_user_trigger: logging.info("Press the Button") while True: if GPIO.input(10) == GPIO.HIGH: break And also add the appropriate imports. (See the link for the imports) You might have to change the '10' to a different number depending on how you set up your button. The link I included should help you with that.
nice video but your not showing how past it in the directory or step by step approach your got you move done which we do not understand. i have vim installed and tried flowing you but to many missing steps .
Hi, Sam I settled this on my raspberry pi 4b But what I want is to control gpio pins by voice assistant command. I further read the documentation and setted up the hardware, but when I say "turn on" Google says that "sorry, power controle is not yet support assistant sdk" Can you please make a video on this topic
Is there a way to use this assistant without needing to push a button? Like the google assistant works on phones with "Ok Google"? I'm building my first ever project in a rpi, aprecciate any help.
Yep. I have another video on my channel where I do this (Google Assistant AI Knows When I'm Sad). My thoughts on how to do this: Find a free speech to text Python library Have the library always listening Have a conditional statement waiting for you to say "Ok Google" When you say that keyphrase, have it listen for a command. When the command is finished send that transcript to the Google assistant sdk
what's the best method to make this voice activated? i seen something called snowboy, but it doesn't seem to work correctly, i probably didn't follow the tutorial correctly. I am using Rasbian Buster. I am building a dashboard for my home gym that also works as a voice activated timer for rest times.
I'd recommend to have a voice recognition like the python package SpeechRecognition continuously listening. Then when it recognizes a specific hotword your start the Google Assistant routing.
So adding a push button also worked . But now i'm try to add autostart of this assistant when the pi boots up. I can't find the correct info on google. This is what i've found : Make a file with this commando: sudo nano /etc/systemd/system/assist.service and paste this in it. [Unit] Description=Assist @ reboot [Service] ExecStart=/home/pi/assist.py User=pi Group=pi StandardOutput=syslog StandardError=syslog SyslogIdentifier=assist Chmod this file. Than sudo systemctl enable assist.service Than sudo systemctl start assist.service But it's not working. As i don't have this file assist.py ( i think ) Or do i need to use pushtotalk.py there? Where do i need to put this line : googlesamples-assistant-pushtotalk --project-id my-dev-project --device-model-id my-model (of course with my own id etc...) Doesn't it need to be there to? Or am i completely wrong now?
You can. I would recommend using a different voice recognition python library to constantly listen. Then when it hears the words "Hi Raspberry" it takes the following command, converts it to text, and sends it to the Google Assistant API
I'd recommend to have a voice recognition like the python package SpeechRecognition continuously listening. Then when it recognizes a specific hotword your start the Google Assistant routing. Another option is to copy my project here github.com/samwestby/pysodic-assistant I use a custom hotword on line 145 of scripts/execute.py
@@SamWestby thanks for the reply INFO:root:Connecting to embeddedassistant.googleapis.com Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048 Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722 Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843 Traceback (most recent call last): File "/home/pi/env/bin/googlesamples-assistant-pushtotalk", line 8, in sys.exit(main()) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 722, in _call_ return self.main(*args, **kwargs) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 351, in main flush_size=audio_flush_size File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 190, in _init_ blocksize=int(block_size/2), # blocksize is in number of frames. File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 1345, in _init_ **_remove_self(locals())) File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 861, in _init_ 'Error opening {0}'.format(self.__class__.__name__)) File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 2653, in _check raise PortAudioError(errormsg, err) sounddevice.PortAudioError: Error opening RawStream: Invalid sample rate [PaErrorCode -9997]. . I used raspbian buster os ..the last command is the sample command with model id and product id...also I checked the sound system with arecord -l and aplay -l command
This looks like an error with your microphone or speaker. Did you take the necessary steps to test them on your Pi? If rthe audio tests are successful, I would edit some of the values in audio_helpers.py
@@SamWestby ya it works fine ....I could hear my recordings in the speaker...also I am not using noobs os I am using raspbian buster os ...and raspberry pi 3b model
@@SamWestby I keep puting it wrong and getting the message along the lines of bash not found and path not found and I know I just put it in wrong but I don't know what part
This is one of the hardest part of programming. Here you should probably go back to the start of the instructions and be incredibly careful to do every step perfectly. Double check everything. Try not to rush. This mindset gets easier and easier the more you do it.
INFO:root:Connecting to embeddedassistant.googleapis.com Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048 Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719 Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843 Traceback (most recent call last): File "/home/pi/env/bin/googlesamples-assistant-pushtotalk", line 8, in sys.exit(main()) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 351, in main flush_size=audio_flush_size File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 190, in __init__ blocksize=int(block_size/2), # blocksize is in number of frames. File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 1345, in __init__ **_remove_self(locals())) File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 861, in __init__ 'Error opening {0}'.format(self.__class__.__name__)) File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 2653, in _check raise PortAudioError(errormsg, err) sounddevice.PortAudioError: Error opening RawStream: Invalid sample rate [PaErrorCode -9997]
This looks like an error with your microphone or speaker. Did you take the necessary steps to test them on your Pi? If the audio tests are successful, I would edit some of the values in audio_helpers.py
Hi, Can you help me out please? I followed your instructions and the assistant is working when i press enter. But i want to make it work with the use of a button. I've followed your link below in the commends and also this link www.novaspirit.com/2017/05/09/button-trigger-google-assistant-raspberry-pi/ because i wanted to use a push button like him. But when i run the command python3 push_button.py then i always get this : RuntimeError: The GPIO channel has not been set up as an OUTPUT I don't have enough experience with programming as this is my first project on the raspberry pi. Hope you can help me out. Mabye you could make a video of adding the butten and make it all start automatically on boot. Thanks.
I might get around to making a video about that. Once You get more comfortable programming you'll learn how to Google stuff (It can be daunting at first). I googled "RuntimeError: The GPIO channel has not been set up as an OUTPUT". Then clicked on the first result. There was a comment saying: You need a line at the beginning of your code saying GPIO.setup(##, GPIO.OUT) Where ## is the pin number you want to be used in output mode? You should also run this at the end of your program: GPIO.cleanup() So try adding those two line changing the "##" for your pin number
@@SamWestby This is what i had entered , your GPIO.setup(##,GPIO.OUT) is there already :s import RPi.GPIO as GPIO now we have to setup our pins GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(23, GPIO.OUT) now we need to add the trigger to our code at line 197 comment out with #click.pause….. input_state = GPIO.input(18) if input_state == True: GPIO.output(18,False) continue else: GPIO.output(18,True) pass So i really don't understand anymore what i'm doing wrong.
@@SamWestby Thanks for that. I feel so stupid now that i did'nt see it. In his video he was indeed using the pin 23 but in the description on his site it's written wrong. And i copied that off course. Now it's on to my next problem. When i want to start it i get this : (env) pi@raspberrypi:~/env/lib/python3.7/site-packages/googlesamples/assistant/grpc $ python pushtotalk.py Traceback (most recent call last): File "pushtotalk.py", line 26, in import RPi.GPIO as GPIO ModuleNotFoundError: No module named 'RPi' In the tutorial they are talking from a file named _main_ , but i can't find that file anywhere.
saludos desde mexico gracias por compartir tu proyecto, casi al final me sale este error ojala puedas ayudarme, gracias iNFO:root:Connecting to embeddedassistant.googleapis.com Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048 Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719 Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843 Traceback (most recent call last): File "/home/pi/env/bin/googlesamples-assistant-pushtotalk", line 8, in sys.exit(main()) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 722, in _call_ return self.main(*args, **kwargs) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 351, in main flush_size=audio_flush_size File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 190, in _init_ blocksize=int(block_size/2), # blocksize is in number of frames. File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 1345, in _init_ **_remove_self(locals())) File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 861, in _init_ 'Error opening {0}'.format(self.__class__.__name__)) File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 2653, in _check raise PortAudioError(errormsg, err) sounddevice.PortAudioError: Error opening RawStream: Invalid sample rate [PaErrorCode -9997]
Nice and Clean explanation !!. Wanted to add a point, it is important to add those extra lines (as shown in the video) in .asoundrc file to avoid errors in the end.
I was able to connect few lights and control it using IFTTT and Blynk.
Thank you for sharing this. It is exactly what I am looking for.
Have the same issue like Muthu Kumar i get everytime error 403 could you pls look how to fix it?
Hey bro i just spent 2 hours looking for how to fix this. I needed to go to the google api screen and on the tabs go to OAuth Consent tab. Then it should say publish as the first button there, do that and it should work.
@@ryanblake7609 thank you very much man I will try that
@@christianuhl7929 no problem bro. Let me know if it works
Hi. Did you install it on your magic mirror?
Nope, but I'm working on a magic mirror right now actually
how did you make your cmd so cool??
Could you make a video on how to set up a push-button to trigger Google Assistant?
Does this integrate with other Google Home devices (ie. Google Mini)? I want to make a touch screen smart mirror and use a Pi 4 to power it - If I have a Google Mini and Say "Hey Google..." will the devices work out on their own who answers or would both devices answer the trigger word?
Super clean video instructions. I was trying the sample textinput.py but for some of the requests like "Show me picture of a car" I get null response on the RPi3. Would you happen to know how I can get it to print the suggested images page or HTML or JSON response which I can parse?
The URL error
i do not understand
Help me please
Thanks for the help! :)
thank you bro, do you how to put a push button to trigger google assistant?
Hey! There are a couple ways to do this. The easiest way follow this article to get the button working (just the first method).
raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/
Then go into pushtotalk.py and replace:
if wait_for_user_trigger:
click.pause(info="Press Enter ...")
with
if wait_for_user_trigger:
logging.info("Press the Button")
while True:
if GPIO.input(10) == GPIO.HIGH:
break
And also add the appropriate imports. (See the link for the imports)
You might have to change the '10' to a different number depending on how you set up your button. The link I included should help you with that.
@@SamWestby Which are the "appropriate imports"?
There are a few. They're all listed on the raspberrypihq.com link I put in the above comment
@@SamWestby ok, but I don't know where I have to put them in pushtotalk.py.... can you help me?
After you install the modules with pip, then you can put your import statements at the top of your Python file
THANK YOU MY GUY
nice video but your not showing how past it in the directory or step by step approach your got you move done which we do not understand.
i have vim installed and tried flowing you but to many missing steps .
Hi James. Sorry you're having trouble. Is there a specific section you're stuck on?
Hi, Sam
I settled this on my raspberry pi 4b
But what I want is to control gpio pins by voice assistant command.
I further read the documentation and setted up the hardware, but when I say "turn on" Google says that "sorry, power controle is not yet support assistant sdk"
Can you please make a video on this topic
Hey do you need to go through the Google assistant sdk? Because if not that would be easier
Is there a way to use this assistant without needing to push a button? Like the google assistant works on phones with "Ok Google"? I'm building my first ever project in a rpi, aprecciate any help.
Yep. I have another video on my channel where I do this (Google Assistant AI Knows When I'm Sad).
My thoughts on how to do this:
Find a free speech to text Python library
Have the library always listening
Have a conditional statement waiting for you to say "Ok Google"
When you say that keyphrase, have it listen for a command.
When the command is finished send that transcript to the Google assistant sdk
what's the best method to make this voice activated? i seen something called snowboy, but it doesn't seem to work correctly, i probably didn't follow the tutorial correctly. I am using Rasbian Buster. I am building a dashboard for my home gym that also works as a voice activated timer for rest times.
I'd recommend to have a voice recognition like the python package SpeechRecognition continuously listening. Then when it recognizes a specific hotword your start the Google Assistant routing.
Please tell me how to boot it on startup
ThankYou !
Google is your friend :) raspberrypi.stackexchange.com/questions/8734/execute-script-on-start-up
Very delayed but here's a video tutorial ua-cam.com/video/Gl9HS7-H0mI/v-deo.html
@@SamWestby Thankyou so Much!
Is it possible to use other languages than english with an RPi?
Yes it is, but unfortunately it's a bit tricky
So adding a push button also worked . But now i'm try to add autostart of this assistant when the pi boots up.
I can't find the correct info on google.
This is what i've found :
Make a file with this commando:
sudo nano /etc/systemd/system/assist.service
and paste this in it.
[Unit]
Description=Assist @ reboot
[Service]
ExecStart=/home/pi/assist.py
User=pi
Group=pi
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=assist
Chmod this file. Than sudo systemctl enable assist.service
Than sudo systemctl start assist.service
But it's not working. As i don't have this file assist.py ( i think ) Or do i need to use pushtotalk.py there?
Where do i need to put this line : googlesamples-assistant-pushtotalk --project-id my-dev-project --device-model-id my-model (of course with my own id etc...)
Doesn't it need to be there to? Or am i completely wrong now?
Very delayed but here's a tutorial ua-cam.com/video/Gl9HS7-H0mI/v-deo.html
it's nice!thing is that I can't find a way for it to be used with a hotword,like "ok google" etc.Is there a way??
There is a way! I used the hotword "buddy" for this video. ua-cam.com/video/hJQgWvXT5p0/v-deo.html
Link to github in the description
Hey Sam
I have the Google Voice Kit 2.0 and I just can't seem to get it to work
any advice would be appreciated !
Cheers
I mean when I test the speaker and the mic they don't react
even tho they show up on alsamixer
Hey sorry I forgot to respond to this. I've never worked with Google Voice Kit 2.0 so I don't know if I can help. Sorry!
How to make it so there is no need to preaa the Enter? Can we activate it on a name? Like "Hi Raspberry!" ?
You can. I would recommend using a different voice recognition python library to constantly listen. Then when it hears the words "Hi Raspberry" it takes the following command, converts it to text, and sends it to the Google Assistant API
@@SamWestby I know I can 😍 I saw your videos with Buddy. Question is how?
Once setup can i use it as spotify connect device?
Yes you can. Take a look at the "Spotipy" library on github
Is it possible to made this with orange pi?
Yes it will!
How to run google assistant with wake word and also run on boot
I'd recommend to have a voice recognition like the python package SpeechRecognition continuously listening. Then when it recognizes a specific hotword your start the Google Assistant routing.
Another option is to copy my project here github.com/samwestby/pysodic-assistant
I use a custom hotword on line 145 of scripts/execute.py
Hi, aer
pasting the authorization code is done. But the last code with product I'd and model id shows some error
Hi could you post the command you ran as well as the error?
@@SamWestby thanks for the reply
INFO:root:Connecting to embeddedassistant.googleapis.com
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Traceback (most recent call last):
File "/home/pi/env/bin/googlesamples-assistant-pushtotalk", line 8, in
sys.exit(main())
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 722, in _call_
return self.main(*args, **kwargs)
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 351, in main
flush_size=audio_flush_size
File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 190, in _init_
blocksize=int(block_size/2), # blocksize is in number of frames.
File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 1345, in _init_
**_remove_self(locals()))
File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 861, in _init_
'Error opening {0}'.format(self.__class__.__name__))
File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 2653, in _check
raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening RawStream: Invalid sample rate [PaErrorCode -9997]. .
I used raspbian buster os ..the last command is the sample command with model id and product id...also I checked the sound system with arecord -l and aplay -l command
This looks like an error with your microphone or speaker. Did you take the necessary steps to test them on your Pi? If rthe audio tests are successful, I would edit some of the values in audio_helpers.py
@@SamWestby ya it works fine ....I could hear my recordings in the speaker...also I am not using noobs os I am using raspbian buster os ...and raspberry pi 3b model
You should edit the sample rate values in audio_helpers.py
Is there a way to change "ok google" to another name
Yeah I did that for this video - ua-cam.com/video/hJQgWvXT5p0/v-deo.html
The code I used is in the description of that video
Give command step by step please
hi there is there any way to use hotword?
Yes you can. I used the hotword "buddy" for this video. ua-cam.com/video/hJQgWvXT5p0/v-deo.html
Link to github in the description
@@SamWestby thanks is is possible work like normal google assista wthoud the sad and happy stuff
@@marine1718 Yep. You'll just have to edit out the part of the code
Thx, biiiiiiiiig thx
Wait I'm stuck and confused on 16:33
What is confusing you?
@@SamWestby I keep puting it wrong and getting the message along the lines of bash not found and path not found and I know I just put it in wrong but I don't know what part
This is one of the hardest part of programming. Here you should probably go back to the start of the instructions and be incredibly careful to do every step perfectly. Double check everything. Try not to rush. This mindset gets easier and easier the more you do it.
Please help me
I always get error 403 restricted client
When I click the generated url...please help me
I'm not sure sorry :/
Is this tutorial on VIM or? :)
Yes it is on VIM.
In raspberry pi 4
INFO:root:Connecting to embeddedassistant.googleapis.com
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Traceback (most recent call last):
File "/home/pi/env/bin/googlesamples-assistant-pushtotalk", line 8, in
sys.exit(main())
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 351, in main
flush_size=audio_flush_size
File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 190, in __init__
blocksize=int(block_size/2), # blocksize is in number of frames.
File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 1345, in __init__
**_remove_self(locals()))
File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 861, in __init__
'Error opening {0}'.format(self.__class__.__name__))
File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 2653, in _check
raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening RawStream: Invalid sample rate [PaErrorCode -9997]
This looks like an error with your microphone or speaker. Did you take the necessary steps to test them on your Pi? If the audio tests are successful, I would edit some of the values in audio_helpers.py
@@SamWestby Thankyou, It's working Fine Now.
I had misplaced some card number in .asoundrc file
Hi,
Can you help me out please? I followed your instructions and the assistant is working when i press enter. But i want to make it work with the use of a button.
I've followed your link below in the commends and also this link www.novaspirit.com/2017/05/09/button-trigger-google-assistant-raspberry-pi/
because i wanted to use a push button like him.
But when i run the command python3 push_button.py then i always get this : RuntimeError: The GPIO channel has not been set up as an OUTPUT
I don't have enough experience with programming as this is my first project on the raspberry pi.
Hope you can help me out.
Mabye you could make a video of adding the butten and make it all start automatically on boot.
Thanks.
I might get around to making a video about that. Once You get more comfortable programming you'll learn how to Google stuff (It can be daunting at first). I googled "RuntimeError: The GPIO channel has not been set up as an OUTPUT".
Then clicked on the first result.
There was a comment saying:
You need a line at the beginning of your code saying
GPIO.setup(##, GPIO.OUT)
Where ## is the pin number you want to be used in output mode?
You should also run this at the end of your program:
GPIO.cleanup()
So try adding those two line changing the "##" for your pin number
@@SamWestby ok , thank you very much. I'll try it out ;)
@@SamWestby This is what i had entered , your GPIO.setup(##,GPIO.OUT) is there already :s
import RPi.GPIO as GPIO
now we have to setup our pins
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(23, GPIO.OUT)
now we need to add the trigger to our code at line 197
comment out with #click.pause…..
input_state = GPIO.input(18)
if input_state == True:
GPIO.output(18,False)
continue
else:
GPIO.output(18,True)
pass
So i really don't understand anymore what i'm doing wrong.
@@jovs1407 try changing the last two '18's to '23's. 18 is your input pin and 23 is your output pin
@@SamWestby Thanks for that. I feel so stupid now that i did'nt see it. In his video he was indeed using the pin 23 but in the description on his site it's written wrong. And i copied that off course.
Now it's on to my next problem. When i want to start it i get this :
(env) pi@raspberrypi:~/env/lib/python3.7/site-packages/googlesamples/assistant/grpc $ python pushtotalk.py
Traceback (most recent call last):
File "pushtotalk.py", line 26, in
import RPi.GPIO as GPIO
ModuleNotFoundError: No module named 'RPi'
In the tutorial they are talking from a file named _main_ , but i can't find that file anywhere.
saludos desde mexico gracias por compartir tu proyecto, casi al final me sale este error ojala puedas ayudarme, gracias
iNFO:root:Connecting to embeddedassistant.googleapis.com
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Traceback (most recent call last):
File "/home/pi/env/bin/googlesamples-assistant-pushtotalk", line 8, in
sys.exit(main())
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 722, in _call_
return self.main(*args, **kwargs)
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/env/lib/python3.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 351, in main
flush_size=audio_flush_size
File "/home/pi/env/lib/python3.7/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 190, in _init_
blocksize=int(block_size/2), # blocksize is in number of frames.
File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 1345, in _init_
**_remove_self(locals()))
File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 861, in _init_
'Error opening {0}'.format(self.__class__.__name__))
File "/home/pi/env/lib/python3.7/site-packages/sounddevice.py", line 2653, in _check
raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening RawStream: Invalid sample rate [PaErrorCode -9997]
Necisitas cargar tu "SampleRate". Ve a 03:36 en el video
Muchas gracias amigo ☺️
Hi
hi
I commented 5 months ago 🙀🙀
Haha I know. I figured better late than never
the lack of hotword sucks