Install Google Assistant on a Raspberry Pi 4

Поділитися
Вставка
  • Опубліковано 11 вер 2024

КОМЕНТАРІ • 103

  • @experimental87
    @experimental87 4 роки тому

    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.

  • @markboweringphotography4408
    @markboweringphotography4408 3 роки тому

    Thank you for sharing this. It is exactly what I am looking for.

  • @christianuhl7929
    @christianuhl7929 3 роки тому +2

    Have the same issue like Muthu Kumar i get everytime error 403 could you pls look how to fix it?

    • @ryanblake7609
      @ryanblake7609 3 роки тому +1

      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.

    • @christianuhl7929
      @christianuhl7929 3 роки тому +1

      @@ryanblake7609 thank you very much man I will try that

    • @ryanblake7609
      @ryanblake7609 3 роки тому

      @@christianuhl7929 no problem bro. Let me know if it works

  • @robertdexterding68
    @robertdexterding68 3 роки тому +1

    Hi. Did you install it on your magic mirror?

    • @SamWestby
      @SamWestby  3 роки тому

      Nope, but I'm working on a magic mirror right now actually

  • @MaCHeaMaRoBi
    @MaCHeaMaRoBi 2 роки тому +1

    how did you make your cmd so cool??

  • @kaukiaa4590
    @kaukiaa4590 4 роки тому +1

    Could you make a video on how to set up a push-button to trigger Google Assistant?

  • @SKiZ416
    @SKiZ416 2 роки тому

    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?

  • @sharvilkhamkar5693
    @sharvilkhamkar5693 2 роки тому

    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?

  • @duyquang4637
    @duyquang4637 4 роки тому +1

    The URL error
    i do not understand
    Help me please

  • @samyabk6984
    @samyabk6984 4 роки тому

    Thanks for the help! :)

  • @digitalclampmeter619
    @digitalclampmeter619 4 роки тому +2

    thank you bro, do you how to put a push button to trigger google assistant?

    • @SamWestby
      @SamWestby  4 роки тому +1

      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.

    • @andreamassignan4113
      @andreamassignan4113 4 роки тому

      @@SamWestby Which are the "appropriate imports"?

    • @SamWestby
      @SamWestby  4 роки тому +1

      There are a few. They're all listed on the raspberrypihq.com link I put in the above comment

    • @andreamassignan4113
      @andreamassignan4113 4 роки тому

      @@SamWestby ok, but I don't know where I have to put them in pushtotalk.py.... can you help me?

    • @SamWestby
      @SamWestby  4 роки тому +1

      After you install the modules with pip, then you can put your import statements at the top of your Python file

  • @Georgetwentyten
    @Georgetwentyten 2 роки тому

    THANK YOU MY GUY

  • @Videogame9559
    @Videogame9559 3 роки тому

    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 .

    • @SamWestby
      @SamWestby  3 роки тому

      Hi James. Sorry you're having trouble. Is there a specific section you're stuck on?

  • @techalgorithm8713
    @techalgorithm8713 4 роки тому

    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

    • @SamWestby
      @SamWestby  4 роки тому

      Hey do you need to go through the Google assistant sdk? Because if not that would be easier

  • @Freireg1503
    @Freireg1503 4 роки тому

    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.

    • @SamWestby
      @SamWestby  4 роки тому

      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

  • @millionandbell7779
    @millionandbell7779 4 роки тому

    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.

    • @SamWestby
      @SamWestby  3 роки тому

      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.

  • @AnasKhan-vm7jr
    @AnasKhan-vm7jr 4 роки тому +2

    Please tell me how to boot it on startup
    ThankYou !

    • @SamWestby
      @SamWestby  4 роки тому +1

      Google is your friend :) raspberrypi.stackexchange.com/questions/8734/execute-script-on-start-up

    • @SamWestby
      @SamWestby  2 роки тому

      Very delayed but here's a video tutorial ua-cam.com/video/Gl9HS7-H0mI/v-deo.html

    • @AnasKhan-vm7jr
      @AnasKhan-vm7jr 2 роки тому

      @@SamWestby Thankyou so Much!

  • @smartmagic7966
    @smartmagic7966 3 роки тому

    Is it possible to use other languages than english with an RPi?

    • @SamWestby
      @SamWestby  3 роки тому

      Yes it is, but unfortunately it's a bit tricky

  • @jovs1407
    @jovs1407 4 роки тому

    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?

    • @SamWestby
      @SamWestby  2 роки тому

      Very delayed but here's a tutorial ua-cam.com/video/Gl9HS7-H0mI/v-deo.html

  • @user-qw1ud5gp1j
    @user-qw1ud5gp1j 3 роки тому

    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??

    • @SamWestby
      @SamWestby  3 роки тому

      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

  • @anghel332
    @anghel332 4 роки тому

    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

    • @anghel332
      @anghel332 4 роки тому

      I mean when I test the speaker and the mic they don't react
      even tho they show up on alsamixer

    • @SamWestby
      @SamWestby  4 роки тому

      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!

  • @jacekpiterow900
    @jacekpiterow900 3 роки тому

    How to make it so there is no need to preaa the Enter? Can we activate it on a name? Like "Hi Raspberry!" ?

    • @SamWestby
      @SamWestby  3 роки тому

      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

    • @jacekpiterow900
      @jacekpiterow900 3 роки тому

      @@SamWestby I know I can 😍 I saw your videos with Buddy. Question is how?

  • @FisherPric3
    @FisherPric3 3 роки тому

    Once setup can i use it as spotify connect device?

    • @SamWestby
      @SamWestby  3 роки тому

      Yes you can. Take a look at the "Spotipy" library on github

  • @marine1718
    @marine1718 4 роки тому

    Is it possible to made this with orange pi?

  • @nayanthorat4805
    @nayanthorat4805 4 роки тому

    How to run google assistant with wake word and also run on boot

    • @SamWestby
      @SamWestby  3 роки тому

      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

  • @yazhinivenkatesan7574
    @yazhinivenkatesan7574 4 роки тому

    Hi, aer
    pasting the authorization code is done. But the last code with product I'd and model id shows some error

    • @SamWestby
      @SamWestby  4 роки тому +1

      Hi could you post the command you ran as well as the error?

    • @yazhinivenkatesan7574
      @yazhinivenkatesan7574 4 роки тому

      @@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

    • @SamWestby
      @SamWestby  4 роки тому

      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

    • @yazhinivenkatesan7574
      @yazhinivenkatesan7574 4 роки тому

      @@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
      @SamWestby  4 роки тому

      You should edit the sample rate values in audio_helpers.py

  • @sonicjetas
    @sonicjetas 4 роки тому

    Is there a way to change "ok google" to another name

    • @SamWestby
      @SamWestby  4 роки тому

      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

  • @nayanthorat4805
    @nayanthorat4805 4 роки тому

    Give command step by step please

  • @marine1718
    @marine1718 4 роки тому

    hi there is there any way to use hotword?

    • @SamWestby
      @SamWestby  3 роки тому +1

      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

    • @marine1718
      @marine1718 3 роки тому

      @@SamWestby thanks is is possible work like normal google assista wthoud the sad and happy stuff

    • @SamWestby
      @SamWestby  3 роки тому

      @@marine1718 Yep. You'll just have to edit out the part of the code

  • @tehnicc7803
    @tehnicc7803 3 роки тому

    Thx, biiiiiiiiig thx

  • @fernandocruz3457
    @fernandocruz3457 3 роки тому

    Wait I'm stuck and confused on 16:33

    • @SamWestby
      @SamWestby  3 роки тому

      What is confusing you?

    • @fernandocruz3457
      @fernandocruz3457 3 роки тому

      @@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

    • @SamWestby
      @SamWestby  3 роки тому

      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.

  • @nayanthorat4805
    @nayanthorat4805 4 роки тому

    Please help me

  • @MuthuKumar-yv7yn
    @MuthuKumar-yv7yn 3 роки тому

    I always get error 403 restricted client
    When I click the generated url...please help me

  • @slashghero
    @slashghero 4 роки тому

    Is this tutorial on VIM or? :)

    • @sekellas
      @sekellas 3 роки тому

      Yes it is on VIM.

  • @nayanthorat4805
    @nayanthorat4805 4 роки тому

    In raspberry pi 4

  • @AnasKhan-vm7jr
    @AnasKhan-vm7jr 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]

    • @SamWestby
      @SamWestby  4 роки тому

      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

    • @AnasKhan-vm7jr
      @AnasKhan-vm7jr 4 роки тому

      @@SamWestby Thankyou, It's working Fine Now.
      I had misplaced some card number in .asoundrc file

  • @jovs1407
    @jovs1407 4 роки тому

    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.

    • @SamWestby
      @SamWestby  4 роки тому +1

      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

    • @jovs1407
      @jovs1407 4 роки тому

      @@SamWestby ok , thank you very much. I'll try it out ;)

    • @jovs1407
      @jovs1407 4 роки тому

      @@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
      @SamWestby  4 роки тому

      @@jovs1407 try changing the last two '18's to '23's. 18 is your input pin and 23 is your output pin

    • @jovs1407
      @jovs1407 4 роки тому

      @@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.

  • @MrHOMBREOSOCERDO1
    @MrHOMBREOSOCERDO1 3 роки тому

    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]

    • @SamWestby
      @SamWestby  3 роки тому +1

      Necisitas cargar tu "SampleRate". Ve a 03:36 en el video

    • @MrHOMBREOSOCERDO1
      @MrHOMBREOSOCERDO1 3 роки тому

      Muchas gracias amigo ☺️

  • @Aaronbiju0
    @Aaronbiju0 4 роки тому

    Hi

    • @SamWestby
      @SamWestby  3 роки тому

      hi

    • @Aaronbiju0
      @Aaronbiju0 3 роки тому

      I commented 5 months ago 🙀🙀

    • @SamWestby
      @SamWestby  3 роки тому

      Haha I know. I figured better late than never

  • @marine1718
    @marine1718 4 роки тому

    the lack of hotword sucks