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.

124 COMMENTS

  1. ‘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?

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

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

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

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

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

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

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

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

  8. I have reached the point of cloning at github. I have created an account, detail left out, but on the first command I am getting the error— remote: Repository not found. I am not familiar with github and it’s commands. What am I missing.

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

      • I’m not shure what you are doing. But If you hooked up your raspberry with your laptop through usb or something in the hope to install an OS. Nothing is going to happen. You need to install an OS like debian (for Raspberry pi — Raspbian) on an SD card or connect a monitor, keybord, mouse etc to your raspberry and install it through Noobs.
        More info:
        https://www.raspberrypi.org/documentation/installation/

        • first of all thanks for answering Wilbert, but i followed the above instructions which you are you telling for connecting raspberry pi to computer by installing noobs/raspberian os in sd card and plug into my raspberry pi .
          Now there my problem arises after extracting os in my sd card and plug into my pi ,but after that when i connect my pi to monitor there is nothing happening on screen (means no setup showing)……
          so can you help me on that where i am doing wrong.

  9. Thanks for the great work on this smart speaker! I got GoogleAssistent running 100%. I only have a problem with Alexa. When I start the raspberry Pi I here “Hello” and when I use the wakeword “Ok Alexa” it gives the short tone. After that it stays quite. No answers or reactions to the wake word. When I reboot the raspberry I hear again “Hello” and I can can a reaction one time. It is just as If it cannot login/connect to amazon.
    I guess that the “ProductID” asked for during the installation is the same “Product ID” as I entered at product information page at amazon and not some complex code as in Client ID

    • Found what I was doing wrong. I used raspbian lite (no desktop) and installed everything trough ssh. That want work for the authenticating process. Tried it with desktop version and that works ok for Alexa. But ….. now Gassist refuses. I cant start it manually “source env/bin/activate” gives me the error “no such file or directory”. When I check there is no directory “env” in /home/pi.” /home/pi/env/bin/python -u /home/pi/GasssistPi/src/main.py –project_id ‘xxxx’ –device_model_id ‘xxxxxx’” same problem. What Am I missing?

  10. Maybe a silly question but where do I download the credentials.json file. I’ve been searching and searching on my google developer site but I can’t find it….

  11. I entered the command as mentioned in the readme file for raspberry pi 3b and it says no file or directory named “gassistpi –whatever”.
    What to do?

  12. In audio test , inm unable to listen the sound and it is asking to check the sound.conf and asoundrc files but nothing helped me.. Plzz help me
    i have a project on this on tuesday

  13. i tried this process on raspian. i tried installing noobs but i m facing problems . And this process failed in raspian . can anyone help

  14. I’m getting this err when I try running “/home/pi/env/bin/python -u /home/pi/GasssistPi/src/main.py –project_id ‘xxxx’ –device_model_id ‘xxxxxx’

    File “/home/pi/GassistPi/src/main.py”, line 25, in
    import psutil
    “import error no module named ‘psutil’

    please help.
    Alexa is working fine and it start up correctly during bootup.

  15. Dear Sir, I “build” a Google Assistant on a Raspberry Pi 3 B. I want to use the broadcast command in view to send a message to 3 devices, one Google Home mini and 2 RPi devices. In Google Home on Android the genuine Google Home can be assigned to a room. The RPi it is seen as virtual device and cannot be assigned to a room. How I can do that? Have you an idea about that? Thank you for any advice. Cezar

  16. Alexa Works on boot up of Raspberry pi3 but Google Assistant does not work . I made changes according to readme file located at directory. If i manually run the command “source env/bin/activate” “google-assistant-demo” then it works. Whats exactly i am missing can you tell please?

  17. The setup of Raspberry Pi 3 has been completed. Then I have also installed the Google Assistant API. After that what is the next step to continue to make assistant?
    #ASK BEEBOM?

    • a 16GB card should work fine.
      a 4GB card will definitely not work.
      an 8GB card might or might not work, considering it has a decent amount of storage space available but was not tested by us at the time of building the smart assistant.

    • I AM Using *GB MicroSD Card And It Ca Be Possible It Works Fine ! Also You Should Have Minimum Of 8GB MicroSD Card

    • You’ll have to manually switch modes between the AUX input and the Bluetooth input, the toggle for which is present on the rear side of the speaker we’ve used.

  18. If I want to install Google Assistant or Alexa only , Can I press 1 or 2 in installation section?
    #AskBeebom

    • Once you’ve installed Debian using the NOOBS package, connect to WiFi on the first boot by heading over to settings or the quick launch tray.
      As for making the assistant startup on boot, simply follow the steps mentioned in the README file.

  19. I am in grade 9. Can you please explain to me how to do the assistant with the laptop Dell intel core i5?
    If the beebom is the best, then beebom will explain me briefly

    • Your question is a little unclear, but from what I can make out, it seems as if you’re trying to ask how to set up the assistant using just your laptop. If that is the case, while you can use the laptop for installing Debian on the Raspberry Pi 3 using the NOOBS package as mentioned in the tutorial above, you’ll still need a USB Keyboard, Mouse, and HDMI compatible screen to continue the setup on the Raspberry Pi.
      Hope that helps. Do feel free to comment back in order to allow us to assist you better.

  20. Thanks for all the help you have been providing. I have successfully created a Alexa powered smart speaker and it is working exceedingly well and got connected to the Alexa app too. But when I ask it to play some music, it says that Amazon music is not supported on this device and says the same for Saavn too. I can just play through TuneIn. How to resolve this issue?

    • In the Alexa app, there should be a way to log in via Spotify. Alternatively, you can purchase a membership for Amazon Music and play songs locally as well.

      • There isn’t one in mine and doesn’t give me the option to activate prime music either.It says it is not supported on this device

    • Connection to Bluetooth speakers is not possible at the moment. You can, however, connect any speaker via the aux cable into the 3.5mm jack on the Raspberry Pi.

      • when i run the audio test and i m unable to hear the sound and it is asking to check soundconf and .asoundrc files . plzz hlp me

  21. bro , i want to connect a home theater to that instead of a portable speaker , so definitely i will have to power that to a switch board ,now the issue is:

    if there is a power cut in my house will the program in the raspberry pi run again automatically once the power comes or should i do any thing to start it again.

    • Just make sure you are able to carry out the installation and setup process without any power cuts. Once you’re through with that, Alexa and Google Assistant will be set-up in order to start automatically at the time of booting. So even in the case of a power failure, whenever the power comes back on and the Raspberry Pi boots up, Alexa and Google Assistant will start simultaneously without fail.

  22. I just setup my speaker for Alexa and not for Google assistant. How to make Alexa bootup automatically on start?

  23. Can I directly use my laptop instead of keyboard, mouse and monitor?? If no then can I use my T.V. with HDMI port instead of monitor??

    • Bluetooth speakers are currently not supported by both Alexa and Google Assistant, and neither would you get an option for it within the script. You’ll have to rely on a wired 3.5mm speaker for it.

      • then can I output audio through the 3.5mm port to headphones and for audio input use a speaker having mike (connect it to the USB port)?

    • Bixby, Cortana, and Siri are all closed AIs, so as of now there is no way to add either of them.
      Google and Amazon provide open-source APIs for Assistant and Alexa respectively, hence this project includes both of them.

    • For Pi 2, you’ll have to buy a WiFi Adapter to connect it to the internet. Other than that, it’ll work just fine.

  24. Hey, what changes do I have to make according to the readme file? It says enter project id and model ID but I am confused which of the following: client id, client secret and product ID do I have to enter there. Also, can I use the mic inbuilt in my speaker?Please reply

    • the ” client id, client secret and product ID” are related to your Amazon account.
      on the other hand, “project id and model ID” are you google account details.
      Basically, your project id = What you named your product as while creating it in the google page
      the model id = your raspberry Pi’s model, ie, Pi3

      • But I just setup my speaker for Alexa and not for Google assistant. How to make Alexa bootup automatically on start?

  25. Hey, what changes do I have to make according to the readme file? It says enter project id and model ID but I am confused which of the following: client id, client secret and product ID do I have to enter there. Also, can I use the mic inbuilt in my speaker?

    • Once you’ve installed Debian on your pi using the NOOBS Package, you can connect it to the WiFI during the first run.

    • You can use it for home automation the same way you would use the standard Amazon Echo or the Google Home, by simply pairing them up with the smart device.

    • For Alexa, download the Alexa app on Android/iOS and login with your Amazon Developer Account.
      For Google, download the Google Home app on Android/iOS and login with your Google Account.
      While the speaker should automatically show up within the Alexa app, you’ll be required to search for the speaker using the nearby feature in the Google Home app.

    • A bluetooth mouse might work if the manufacturer of your mouse supports Linux distros, since Raspbian is based on Debian which is a Linux distro.
      As for the speaker, you’ll be required to make use of a wired 3.5mm speaker only. As you can see in the screenshot of Step 3, the script currently does not support bluetooth speakers or mics.

  26. What about building a smart android tv box using raspberry pi 3 that would be an amazing project and I request all of you awesome guys to put a tutorial on it.

    • You can run the commands using JuiceSSH on your Android phone. However, you’d still be needing a PC for setting up the microSD card for the Raspberry Pi in the first place.

    • You’ll need the keyboard, mouse and monitor for the initial setup. Later on, you can simply run the scripts using SSH or VNC.

      • Alternatively, you can also install Raspbian on your Raspberry Pi in CUI (console) mode, and then connect it using SSH. However, you’ll still be requiring a PC for setting up the microSD card in the first place.

  27. What if i want to use a speaker with inbuilt mic and bluetooth? I’m specifically talking about jbl flip 3. Please help which option to choose to get the mic working with the raspberry.

    • the mic won’t work in that case. the reason for that is that the 3.5mm jack on the Raspberry Pi is for output only and not input. Furthermore, Bluetooth can’t be used as a mode of communication for this. You’ll have to rely on a speaker that connects with the 3.5mm jack and a USB Mic.

LEAVE A REPLY