A working home companion connected to your Google account and constrained by voice orders can be made with just a few pieces of equipment and arrangements.
Follow the steps below to install the Google Assistant SDK on your Raspberry Pi and configure it to accept voice commands.
The equipment is as follows
- You will need the following to configure a Raspberry Pi to work with Google Assistant:
- In the first place, you need Raspberry Pi 2 or Pi 3
- Secondly, you require Force Supply
- This is the third item: A microSD card with NOOBS
- The fourth point is. You need a Receiver for the USB
- The fifth point is important. The speaker
- And lastly Wireless and Ethernet connections
- Install NOOBS on your SD card to introduce a spotless adaptation of Raspbian. Connect peripherals to your Pi for setup and utilize the NOOBS picture to get started.
- Once you have set up Internet access and a Raspbian installation on the Pi, you can proceed to set up the sound gadgets.
- Connect your USB receiver and speaker, and test to see if the gadgets are working properly.
- Open the Terminal application on your Pi. Through this interface, all arrangements will be made.
- Contribute the accompanying to the terminal to verify whether your speaker is working:
speaker-test - t wav
- To check if your receiver is working appropriately, input the accompanying to record a short clasp:
arecord –format=S16_LE –duration=5 –rate=16000 –file-type=raw out.raw
- To playback the recording, input the following command:
aplay –format=S16_LE –rate=16000 out.raw
- If your Raspberry Pi is connected to an HDMI display, you may also choose to play audio out to the monitor.
The following is needed for the Developer Project
- Setting up a Google Developer Project is the first step to introducing the Google Assistant SDK.
- Set up a Developer Project by following the steps below.
- Access your Google account by opening a web browser on any gadget.
- You can create another project by going to Google Cloud Platform and selecting the possibility to do so.
- Then you will choose the Google Assistant API and enable it for your project.
- Give your product a name and click on the OAuth consent screen tab.
- An OAuth ID must be created.
- Put a name on your client ID by choosing the other option.
- Close the dialogue that appears after selecting Create.
- Right next to the OAuth ID, click the Download JSON button.
- Move this file to your Raspberry Pi’s local storage under “/home/pi” to authorize it to use the Google Assistant SDK.
- The Google Assistant SDK requires you to share the activity data of the Google account you want to use with it.
- Make sure the following options are enabled in your account’s Activity Controls.
- Web and App Activity
- Google Chrome website and app history is included, as well as history from Google services using websites and apps
- Information about the device
- Voice and audio activity
- As soon as your account is set up, you can return to your Pi terminal and prepare to install the Assistant SDK.
Setup of the SDK
Run the following commands in order in a terminal on the Pi:
git clone https://github.com/google/aiyprojects-raspbian.git ~/voice-recognizer-raspi
cp src/assistant_library_with_local_commands_demo.py src/main.py
sudo systemctl enable voice-recognizer. service
You should now have Google Assistant SDK installed and it will run automatically when the Pi boots up.
Run the following commands to enable wake word detection and voice recognition:
Once you have configured Google Assistant, you can simply say “OK Google” and issue it commands.