Smart Speaker With Alexa and Google Assistant

Introduction: Smart Speaker With Alexa and Google Assistant

About: I am a 14 year old programmer. I know basic Python, Java, HTML and CSS. I want to become and entrepreneur when grow up. So, wish me luck....

These days, smart assistants are taking the tech world by storm. Amazon’s Alexa and Google’s Assistant are now being embedded within every device, be it car devices, showers, or practically almost everything that was unveiled at CES 2018. But despite all that, the most selling devices sporting these assistants are the company’s own products, that is, the Amazon Echo and the Google Home.

While both the smart speakers are great by themselves, wouldn’t it be great to have the power of them both on one device? Well, now you can. I have created my own guide of how to create your own smart speaker having the capabilities of both Google Assistant and Amazon Alexa. So without any further ado, let’s get right into it.

Step 1: Things You Need:

Step 2: Install the NOOBS Package:

To start off, you’ll first need to set up your Raspberry Pi. To do so, simply download theNOOBS Package, extract it to your microSD card and plug it into your Raspberry Pi. Hook up the USB Keyboard, Mouse, Mic and the Speaker to the Pi and turn it on. You will now get a first time setup. Simply select Debian and install to start the installation of Debian on your Raspberry Pi.

Step 3: Create Your Amazon Developer Account

Now, you need to create your Amazon Developer Account and create a security profile. You can follow these instructions to do so :

Login to Amazon Developer Portal - developer.amazon.com

Click Alexa -> Alexa Voice Service -> Get Started.

Click Create Product.

Fill-in these values and save:-

Product Information

  1. On this page you'll provide information about your product.
  2. Product Name - This is what gets displayed to users when they register an instance of the product with Amazon.
  3. Product ID - A simple identifier for your product.
  4. When asked if your product is an app or device, select Device.
  5. When asked if your product will use a companion app, select Yes.
  6. For Product Category, select Other, and enter "Rapsberry Pi Project". Note: For a commercial product, you should select the best option available.
  7. Enter a brief description. For example: My first Pi project.
  8. When asked how users will interact with your product, select Touch-initiated and Hands-free. Note: For a commercial product, you should select the options that best describe your product's functionality.
  9. You can skip uploading an image for now. This content is used on the manage your content and devices screen on amazon.com.
  10. When asked if you will distribute this project, select No. Note: For a commercial product, you should select Yes.
  11. When asked if this product is for children, select No.Click Next.

Security Profile

On this page we'll create a new Login with Amazon (LWA) security profile. This associates user data and security credentials with one or more products.

Click Create New Profile. Enter a name and description for your security profile, then click Next. For example:

Security Profile Name: Alexa Voice Service Sample App Security Profile.

  • Security Profile Description: Alexa Voice Service Sample App Security Profile Description.

Note: These are suggested values. You provide custom information for Security Profile Name and Security Profile Description.

A Client ID and Client Secret will be generated for you.

Enter your Allowed origins and Allowed return URLs. We need to setup http and httpsroutes for our sample project:

Click Update.

You are now ready to generate self-signed certificates.

Enable Security Profile

  1. Open a web browser, and visit https://developer.amazon.com/lwa/sp/overview.html.
  2. Near the top of the page, select the security profile you created earlier from the drop down menu and click Confirm.
  3. Enter a privacy policy URL beginning with http:// or http:// or
  4. For this example, you can enter a fake URL such as http://example.com.
  5. [Optional] You may upload an image as well. The image will be shown on the Login with Amazon consent page to give your users context.
  6. Click Save.

Step 4: Create Your Google Developer Account

Next up, create a Google Developer Account and enable the Google Assistant API. That is pretty much it for Google.

Step 5: Preparing for Installation

Before Starting the setup

For Google Assistant

1. Download credentials-.json file (refer to this doc for creating credentials)

2. Place the .json file in/home/pi directory

3. DO NOT RENAME THE JSON FILE

For Amazon Alexa

1. Create a security profile for alexa-avs-sample-app if you already don't have one.

Now, run the following commands one by one to clone the GitHub project and make the installer files executable:

git clone https://github.com/shivasiddharth/Assistants-Pi

sudo chmod +x /home/pi/Assistants-Pi/prep-system.sh  
sudo chmod +x /home/pi/Assistants-Pi/audio-test.sh 
sudo chmod +x /home/pi/Assistants-Pi/installer.sh  
sudo /home/pi/Assistants-Pi/prep-system.sh

First, OS will be updated and upgraded. Thereafter, you will be prompted to select the audio setup. Select “3” from the options. Now, restart the Raspberry Pi.

Step 6: Testing the Audio

Upon reboot, first, check your audio setup by

sudo /home/pi/Assistants-Pi/audio-test.sh

The script is interactive, just press “y” if you hear the audio, or “n” if you don’t. In case you don’t hear the audio, you need to check the wires.

Step 7: Installing Alexa and Google Assistant

Now that your system is ready, run the following command to start the installer:

sudo /home/pi/Assistants-Pi/installer.sh 

The script will now execute. It is a pretty straightforward script, simply follow the on-screen instructions.

IMPORTANT : I have mentioned before in Step 4 that you have to download the credentials.json file. Place it in you home/pi directory. And also you have to make the changes mentioned in the next step when the installation for Google Assistant starts.

Step 8: How to Start Your Assistants After Rebooting You Pi

Once both the assistants have been installed, you’ll be shown a screen as above. Run the commands one by one to authenticate Alexa. Once you’re through with that, follow these steps to start them on boot:

For Google Assistant:

Open a terminal and execute the following one-by-one

source/env/bin/activate

google-assistant-demo

For Amazon Alexa:

Open 3 different terminal and execute every command in a different terminal

cd /home/pi/alexa-avs-sample-app/samples/javaclient && sudo mvn exec:exec

cd /home/pi/alexa-avs-sample-app/samples/companionService && sudo npm start  

cd /home/pi/alexa-avs-sample-app/samples/wakeWordAgent/src && sudo ./wakeWordAgent -e kitt_ai 

After executing these commands you should be good to go

Step 9: Conclusion

And that’s it. Your 2-in-1 smart speaker is ready. Also, while you can use the entire setup barebones, I decided to wrap things up inside a nice little cardboard box and apply a black chart paper and giving it some final and personal touches. Also, I think I have pretty much included everything you need to install Alexa and Google Assistant, but still, as they say,

No human being is perfect.

If I have made some mistakes or forgotten something please remind me about it in the comments section.

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Tiny Home Contest

      Tiny Home Contest

    7 Discussions

    Hey, very nice project. I was searching for something just like this. I have seen AlexaPi and GAssist Pi. But never saw both of them in the same speaker. Keep it up dude...

    0
    None
    TechR9

    5 months ago

    Hi guys, I have updated the instructable as there was some problem with auto starting the bots on boot. So you have to start them manually. But don't worry, you can make it headless and then execute these commands too !

    0
    None
    ag0024

    5 months ago

    Hey, nice project

    Are you form Beebom Team

    1 reply

    No. I just have taken the first picture from their project. Rest everything is done by me. If you are offended in any way, I can remove it.

    When you start your installation for Google Assistant, and have provided it with the name of your .json file you downloaded from your Google developer account, the installation for Google Assistant will start (do not rename that file or it will not work). After 30 seconds or so, a text file name model id will be created in your home/pi directory. It will provide you your model id. Hope this helped.

    0
    None
    TechR9

    6 months ago

    Sorry guys, I forgot to add some crucial information when I first posted this instructable. I have updated it, so it should work well and good now.