Make Your Own Virtual Personal Assistant - Raspberry pi 3

Make Your Virtual Personal Assistant

 Make Your Own Virtual Personal Assistant - Raspberry pi 3
Google, Apple and Amazon launched her AI Devices like: Google Home, Apple home, Alexa, but main problem is all of them are so expansive

in this post i am talking about making your own AI assistant with google assistant and amazon Alexa.

What You’ll Need

As you’d expect, you’ll need a Raspberry Pi alongside a handful of parts:
  • A Raspberry Pi 3 (recommended) or Raspberry Pi 2 (you’ll also need a USB Wi-FI adapter with the Model 2) with Raspbian installed. If you haven’t installed Raspbian before, our guide covers everything you need to know.
  • A MicroUSB power cable
  • An 8GB MicroSD card
  • A USB Microphone (I used this cheap $6 mic, but pretty much any USB mic seems to work. The $8 Playstation Eye seems to work especially well if you’re looking for a slight upgrade)
  • Speakers (any powered speaker does the job, I decided to use a UE Mini Boom because I already owned it and even when it’s plugged into the Pi, it still works as a Bluetooth speaker)
  • A Keyboard and Mouse for setup (or access to a computer with VNC)
Installing Both of assistant

Step One: Register for an Amazon Developer Account


https://i.kinja-img.com/gawker-media/image/upload/s--ZXmdOQi_--/c_scale,fl_progressive,q_80,w_800/vmcmdmwkycsoxzlwnpnm.jpg
Before you do anything, you’ll need to register for a free Amazon Developer Account, then create a profile for your DIY Echo. This is pretty straightforward:
  1. Log into your Amazon Developer Account.
  2. Click on the Alexa Tab.
  3. Click Register a Product Type > Device.
  4. Name your device type and display name (We chose “Raspberry Pi” for both).
  5. Click Next.
  6. On the Security Profile screen, slick “Create new profile.”
  7. Under the General tab, next to “Security Profile Name” name your profile. Do the same for the description. Click Next.
  8. Make a note of the Product ID, Client ID, and Client Secret that the site generates for you.
  9. Click the Web Settings tab, then click the Edit button next to the profile dropdown.
  10. Next to Allowed Origins, click, “Add Another” and type in: https://localhost:3000.
  11. Next to Allowed Return URLs, click “Add Another” and type in: https://localhost:3000/authresponse Click Next when you’re done.
  12. The Device Details tab is next. It doesn’t matter much what you enter here. Pick a category, write a description, pick an expected timeline, and enter a 0 on the form next to how many devices you plan on using this on. Click Next.
  13. Finally, you can choose to add in Amazon Music here. This does not work on the Pi powered device, so leave it checked as “No.” Click Save.

Step Two: Clone and Install Alexa

 https://i.kinja-img.com/gawker-media/image/upload/s--h_QOfR_8--/c_scale,fl_progressive,q_80,w_800/bkeikgvyskacqjzfuwd4.jpg
  1.   Open the Terminal application on the Raspberry Pi and type: cd Desktop and press Enter.
  2. Type in git clone https://github.com/alexa/alexa-avs-sample-app.git and press Enter.
  3. Once that’s complete, type in: cd ~/Desktop/alexa-avs-sample-app and press Enter.
  4. Type in nano automated_install.sh and press Enter.
  5. This pulls up your text editor. Here, you’ll need to enter your ProductID, ClientID, and ClientSecret that you notes in the step above. Use the arrow keys to navigate to each entry. Enter each detail after the = sign as noted in the image above. When you’re done, tap CTRL+X to save and exit.
  6. You’re now back at the command line. It’s time to run the install script. Type in cd ~/Desktop/alexa-avs-sample-app and press Enter.
  7. Type in . automated_install.sh and press Enter.
  8. When prompted, press Y for the different questions, and answer as you see fit for the rest. This will configure your Pi and install some extra software. This can take up to 30 minutes, so just let it do it’s thing.

Step Three: Run the Alexa Web Service

https://i.kinja-img.com/gawker-media/image/upload/s--kKG5xn6N--/c_scale,fl_progressive,q_80,w_800/zhfptdw3jsd57vilttr3.gif
The first one you’ll start is the Alexa Web Service:
  1. Type in cd ~/Desktop/alexa-avs-sample-app/samples and press Enter.
  2. Type in cd companionService && npm start and press Enter.
This starts the companion service and opens up a port to communicate with Amazon. Leave this window open.

Step Four: Run the Sample App and Confirm Your Account

https://i.kinja-img.com/gawker-media/image/upload/s--1vBP-wj5--/c_scale,fl_progressive,q_80,w_800/oeslhgvhdof9gapwdwuy.gif
  1. In your new Terminal window type in cd ~/Desktop/alexa-avs-sample-app/samples and press Enter.
  2. Type in cd javaclient && mvn exec:exec and press Enter.
  3. A window will pop up asking you to authenticate your device. Click Yes. This opens up a browser window. A second pop-up will appear in the Java app asking you to click Ok. Do not click this yet.
  4. Log into your Amazon account in the browser.
  5. You’ll see an authentication screen for your device. Click Okay. Your browser will now display “device tokens ready.”
  6. You can now Click the Ok pop-up in the Java app.
Now, your Raspberry Pi has the necessary tokens to communicate with Amazon’s server. Leave this Terminal window open.

Step Five: Start Your Wake Word Engine


https://i.kinja-img.com/gawker-media/image/upload/s--lQhxfsyc--/c_scale,fl_progressive,q_80,w_800/vhsxt0bidgt0rtiycpqc.gif
Finally, open a third Terminal window (File > New Window). Here, you’ll start the wake word engine. This makes it so you can say “Alexa” to make your Raspberry Pi start listening to you. You have two options for wake word software, Sensory and KITT.AI. Both are free, but Sensory expires after 90 days, so let’s use KITT instead:

  1. Type in cd ~/Desktop/alexa-avs-sample-app/samples and press Enter.
  2. Type in cd wakeWordAgent/src && ./wakeWordAgent -e kitt_ai
That’s it, your DIY Echo is now running. Go ahead and try it out by saying “Alexa.” You should hear a beep indicating that it’s listening. When you hear that beep, ask a question like, “What’s the weather?” or “What’s the score in the Dodgers game?”

Step six: autostart Amazon alexa-avs-sample-app on boot

Install the alexa-avs-sample-app and first make sure that it is working fine and after that follow the guidelines given below.
  • Clone the git using:
git clone https://github.com/shivasiddharth/headless-alexa-avs-sample-app
  • Check and verify the path of the installed alexa-avs-sample-app in the clientstart.sh, companionstart.sh and wakeword.sh scripts placed inside the /home/pi/headless-alexa-avs-sample-app/scripts directory.
  • Make the installer executable using:
sudo chmod +x /home/pi/headless-alexa-avs-sample-app/installer.sh  
  • Execute the installer:
sudo /home/pi/headless-alexa-avs-sample-app/installer.sh  

in next post i am teaching you how you can install google assistant on your rpi3
by sujeet kumar

Just Myself

I like writing about Science, games and free software.

2 Comments

Please Comment if you are like this post

Previous Post Next Post