My Raspberry Pi Echo Alexa

Jun 15,2018

Dear all in this blog I am explaining, how I have converted my old raspberry pi to an amazon echo dot like device.
In my raspberry pi I have added following things additional to core modules for this:,
  • USB wireless microphone
  • USB Wi-Fi module to connect internet already inbuilt in Raspberry pi
  • External speaker and auxiliary sound jack to connect speaker and raspberry pi
  • I have also used a raspberry pi cover, which I have built using my new 3D printer please refer my earlier blogs of my assembled 3D printer

  • After connecting  Speaker and Microphone, I have tested voice recording and play using arecord and aplay commands.
    Before any further setup, I have registered for a free Amazon Developer Account and created a profile for my Raspberry device.,
    Steps to register a account and to create a profile in Amazon
  • Log into your Amazon Developer Account and click on the Alexa Tab.
  • Then Click Register a Product Type > Device.
  • Name device type and display name (example: 'My Pi AVS'). Click Next.
  • On the Security Profile screen, slick 'Create new profile.'
  • Under the General tab, next to 'Security Profile Name' name profile and description. Then Click Next.
  • Make a note of the Product ID, Client ID, and Client Secret that the site generates.
  • Click the Web Settings tab, then click the Edit button next to the profile drop down.
  • Next to Allowed Origins, click, 'Add Another' and type in: https://:3000
  • Next to Allowed Return URLs, click 'Add Another' and type in: https://:3000/authresponse
  • The Device Details tab is next. It doesn’t matter much what to enter here. Pick any category, write some 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.
  • Please note Amazon Music does not work on Raspberry pi device, but for music anyone can add other freely available skills
  • I am configuring this pi as a Alexa Eco for my home automation IOT projects, so music is not very important for me, but I can get all other information, news etc. easily in this device based against my voice search.
  • Now when have an Amazon Developer Account and I have created a profile for my Pi-powered Echo then I have followed bellow steps:
  • install git software
  • using git download - git clone https://github.com/alexa/alexa-avs-sample-app.git
  • cd alexa-avs-sample-app and typed 
    ./automated_install.sh
     and pressed Enter
  • this has asked some questions and then started installation, it has taken approx 20mins to finish
  • Then I have Installed nodeJs in raspberry pi, before executing next steps. I am using latest LTS version of Node Js in my pi
  • cd ~/Desktop/alexa-avs-sample-app/samples/companionService  and write command '
    npm start
    '  in nohup mode
  • This starts the '
    companion service
    ' and opens up a port to communicate with Amazon. It will start a sample AVS JavaScript sample app in port 3000. Url : 'https://:3000'
  • Then I have installed maven  (a build tool)
  • in another window, then I have typed - cd ~/Desktop/alexa-avs-sample-app/samples/javaclient && mvn exec:exec
  • Then one window popped up asking  to authenticate my device. On clicking  Yes, this has opened up a browser window, where I have logged into my Amazon account and upon authentication it has confirmed my device tokens were ready for communication.
  • I have kept all command windows open as advised
  • Finally I have started Wake word agent in following way
  • cd wakeWordAgent/src && ./wakeWordAgent -e sensory (Please note , we have two options to start wake agent - Sensory and KITT.AI, but  I have selected sensory option)

  • That’s it, my DIY Echo is now running fine. I can wake her by trying out saying 'Alexa.'
    You can also try the same to built your own DIY Alexa Eco, and say 'Alexa' - You should then hear a beep sound indicating that it is listening. When you hear that beep, ask any question like, 'What’s the weather?' , 'What is the current time in USA', 'What is today's major news highlights' etc.
    See attached video.

    #Alexa,#Echo,#raspberrypi