How to Build Smart Speaker with Alexa and Google Assistant (DIY)

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. We, at Beebom, have created our 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.

Note: The following project has been created with the help of a GitHub project.

Things You Need:

  • Raspberry Pi 3 (link)
  • microSD Card 32GB (link)
  • USB Wall Charger (link)
  • 3-port USB Hub (link)
  • USB-A to microUSB Cable (link)
  • USB Microphone (link)
  • Portable Speaker with AUX input (link)
  • Keyboard and Mouse (link)
  • Display with HDMI port (link)
  • HDMI Cable (link)

Smart Speaker

Steps to Build Smart Speaker:

1. To start off, you’ll first need to set up your Raspberry Pi. To do so, simply download the NOOBS 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.

NOOBS Package Download

2. Now, you need to create your Amazon Developer Account and create a security profile. You can follow the GitHub project instructions as well. Once done, note down your Amazon account’s credentials.

Amazon Developer Account

Next up, create a Google Developer Account and enable the Google Assistant API. Once you’re through with that, download the credentials.json file of your Google Product to /home/pi and rename it to assistant.json.

Google Assistant API Enabler

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

Audio Setup 3

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

Audio Test

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

Installation

6. Once both the assistants have been installed, you’ll be shown a screen as below. Run the commands one by one to authenticate Alexa. Once you’re through with that, make the changes in the README file located at /home/pi/Assistants-Pi to start the assistants on boot.

Authentication

And that’s it. Your 2-in-1 smart speaker is ready. Also, while you can use the entire setup barebones, we decided to wrap things up inside a nice little cardboard box and apply a black chart paper while Beebom-ify-ing things up. You can also check out our video of the same below, to see our speaker in action:

SEE ALSO: Google Home vs Amazon Echo: Google Assistant Takes on Alexa

The DIY Smart Speaker: Best of Both Worlds

Well, I know that you can buy your own Amazon Echo Dot and the Google Home Mini, but you might also be aware that those products aren’t available everywhere. What’s more is that with the above guide, you can create a speaker that gives you the power of both the voice assistants combined into a single device. Oh, and aren’t DIY projects always fun? I know I enjoyed a lot making my own smart speaker, and the end result was more than satisfactory. But what about you? Do share with us your experience of building your own smart speaker in the comments down below.

comment Comments 139
  • Rijo Raj says:

    Please pray for me I am starting to do this project I hope that I will not encounter any mistakes.

  • Adrian says:

    hi! may I ask if we can change the name? instead of alexa/google we want to use fairi. can we do this? how?

  • Reetam says:

    Can I run this on a raspberry pi Zero W?

  • Karthik Ammayappan says:

    Not working ☹️ I have done but the Alexa doesn’t respond

    • swadhindas says:

      Same problems have you any solution?

  • Arunnesar says:

    For this process we need to on hospot are not

  • J PAVAN KUMAR says:

    ENTERED THE COMMAND : /home/pi/env/bin/python -u /home/pi/GassistPi/src/main.py –device_model_id ‘ ENTERED MODEL ID ‘
    AND GOT THIS…..
    Traceback (most recent call last):
    File “/home/pi/GassistPi/src/main.py”, line 33, in
    import psutil
    File “/home/pi/GassistPi/src/psutil/__init__.py”, line 96, in
    from . import _pslinux as _psplatform
    File “/home/pi/GassistPi/src/psutil/_pslinux.py”, line 26, in
    from . import _psutil_linux as cext
    ImportError: cannot import name ‘_psutil_linux’ from ‘psutil’ (/home/pi/GassistPi/src/psutil/__init__.py)

    PLZ KINDLY HELP ME OUT WITH THIS..!!

  • Tanuj Dargan says:

    sudo /home/pi/Assistants-Pi/installer.sh getting error saying command not found
    Please help I had figured out the rest of the scripts by adding /scripts after /Assistants-Pi/scripts
    Please help

    • akash says:

      same

    • akash says:

      hello

      thank you i was stuck on the same part and then you told me about the /scripts part and that worked for me

      maybe you are typing in the wrong command

      thanks,
      Akash

  • tsu says:

    can the assistants increase/decrease the volume??

  • aawayes says:

    it will showing thee summ python error how to fix it brooooo

  • Vibhore says:

    Can we use arduino if yes please tell procedure

    • namee says:

      no
      aurdino is a microCONTROLLER
      it does not have the computation power to do that

    • tsu says:

      no
      aurdino is a microCONTROLLER
      it does not have the computation power to do that
      yon need a microPROCESSOR to do these things

  • Waspdog says:

    Hi I’m being asked for a user name and password.please help

  • Waspdog says:

    Hi after entering first line of instruction I’m being asked for a user name and password.please help

  • Swayam subhrajit sahoo says:

    It’s working!!!!!!!

  • Udit Garg says:

    ‘AVM file not running’ error is showing up when I run tests for Alexa and ‘No command found’ for Google Assistant. What should I do?

  • Jayvratsinh says:

    Do a proper video of installation because many things are going on the right way with us. And I m not able to understand the last 9 step on the readme file.

  • Odysseas says:

    So I can run my smart gadgets that are connected to google assistant and Alexa ?

  • nihal chintu says:

    thnks beebom for such tech ur teaching us
    in public for free
    i am so greatfull to be ur youtube subscriber

  • abhi says:

    hey getting this error not hearing the voice i am using the mic given in the link please help stuck from days

    =============Recording Mic Audio Sample=============
    Recording WAVE ‘/home/pi/mic-test.wav’ : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
    Warning: rate is not accurate (requested = 16000Hz, got = 44100Hz)
    please, try the plug plugin

    Finished recording the samples.

    Playing back the recorded audio sample……

    Playing WAVE ‘/home/pi/mic-test.wav’ : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
    Did you hear the recorded audio sample?
    [y/n] >>

    • Navneeth V says:

      reset your pi and then do all the things again

  • Jahin Halder says:

    Show the assembly part of the speaker in the box please

  • Kudhal says:

    After installing both Assistants to run the alexa in three different terminals… I’m getting a error called JAVA_HOME environment variable is not set.. plz help me with this error!! Beebom help me

    • Avese says:

      Same error here as well.

      • kushal says:

        I have commented for help about a month ago… no one responded from beebom! hence I assumed that beebom is not useful at all and a waste of time following that.

      • Dharam says:

        This Error Is Quite Easy To Solve On Windows So If You Use Windows Then Just Search For Environment Variables In The Start Menu And Open The First Search Result. Locate The Path Where You Java Is Installed And Go To “Bin” Subfolder And Then Copy The Path And Paste It There And Name It As “JAVA_HOME”. And Restart The PC. And As For Linux Users, Just Search Google For How To Add Environment Variables In Linux.

  • CS Lee says:

    Is the Alexa in AssistantsPi a recent version from the SDK? Does it have the drop-in and announce feature?
    Also, Does anyone know how to get it ti work with the google AIY v1.0 voice hat?

  • Vijay.R says:

    I am able to run Google Assistant, but can not play songs from google music, it just says ‘looking for songs by artist xxxx’ and then ‘No match found’ and then restarts.
    I dont have paid subscription for google music, is that the reason?. I have my playlists saved in google music.
    Please help.

    • Odysseas says:

      So what happened ? You fixed it ?

  • Shrijeet Patil says:

    Hello, It Is Asking For Username & Password For Cloning The GitHub Project What Should I Enter ?

Leave a Reply