/google-assistant-hotword-raspi

Simple Google Assistant with hotword activation from Snowboy setup for my Pi Zero W.

Primary LanguagePythonMIT LicenseMIT

google-assistant-hotword-raspi

Simple Google Assistant with hotword activation from Snowboy setup for RaspberryPi 1 and Zero W.

Setup

  • Configure a Developer Project and Account Settings
  • Configure and Test the Audio
  • Setup virtual environment
    -   (Recommended) For Python 3:
    
        sudo apt-get update
        sudo apt-get install python3-dev python3-venv
        python3 -m venv env
        env/bin/python -m pip install pip setuptools --upgrade
        source env/bin/activate
    
    -   For Python 2:
    
        sudo apt-get update
        sudo apt-get install python-dev python-virtualenv
        virtualenv env --no-site-packages
        env/bin/pip install pip setuptools --upgrade
        source env/bin/activate
    
  • Install dependencies sudo apt-get install portaudio19-dev libffi-dev libssl-dev
  • Install Google Assistant SDK + Samples python -m pip install google-assistant-sdk[samples]
  • Get credentials pip install --upgrade google-auth-oauthlib[tool] google-oauthlib-tool --client-secrets path/to/client_secret_XXXXX.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless
  • Test using the sample python -m googlesamples.assistant Issue commands after pressing enter and if you did all the steps above Google Assistant should respond.

PS On Raspberry Pi Zero W this setup takes about 30-40 minutes.

  • (Optional - The required files are already in this repo) Download Snowboy compiled library for all versions of Pi + demo
  • Install dependencies sudo apt-get install python-pyaudio python3-pyaudio sox
  • Install BLAS sudo apt-get install libatlas-base-dev
  • Install PyAudio pip install pyaudio You should be able to recored audio using: rec temp.wav

PS For Python 3 rename _snowboydetect.so_py3 to _snowboydetect.so.

Train your own hotwords or download existing ones from https://snowboy.kitt.ai/

3. Run gassistant.py and you should have a working Google Assistant with hotword activation

`python gassistant.py models/ok_google.pmdl`