Introduction: DIY Amazon Echo

About: I am an engineering student who is very passionate about technology. I like to code a lot, build projects and I am very curious of different tech. things and its working. IoT have been one of my favorite topic…

Amazon Echo is now becoming a trend in the space of home automation and voice personal assistant. The ability to link the echo with other devices like philips hue, Wemo light switch etc... have made them more robust and flexible.

In this project, I am going to make a custom Amazon echo using the raspberry pi. The support for the alexa is provided by Amazon developer account. Also I will be making a custom case for the entire project to en-cooperate all components in to a single unit..

So let's get started...... !

Step 1: Gathering the Materials

1. Screws, nuts and bolts

2. Cardboard sheet for enclosure

3. Speaker

4. 220 v AC - 9 v DC circuit

5. Audio amplifier circuit (you can also use PAM8403)

6. Wooden box frame (for the enclosure)

7. Raspberry pi 2 (Installed with raspbian)

8. USB sound card with Mic

9. Wifi Dongle (not required for raspberry pi 3)

NOTE:>> speaker,amplifier circuit and voltage converter can be salvaged from an old PC speaker

>> Installation of raspbian can be found here

Step 2: Polishing the Enclosure

Polishing helps to make the finished project aesthetically appealing. I've used normal wood varnish to coat the box.

  1. Sand the surface using a 60 grid sand paper and clean up all the dust
  2. Apply a coat of the varnish using a cotton cloth
  3. Let the box dry
  4. Apply another layer of varnish to give a glossy finish

Step 3: Preparing the Enclosure

  1. Cut the cardboard for the wooden box as per required size (X2)
  2. Drill holes on front side cardboard for speaker vents (I've used 6mm bit)
  3. Drill holes at back side cardboard for the control knobs for the speaker
  4. Paste cloth mesh at front side from inside for the speaker vents

Step 4: Setting Up Amazon Developer Account

Register for an Amazon Developer Account :

1. Signup for an amazon developer account

2. Login to Amazon developer account

3. Click on the "Alexa" tab

4. Click "get started" on the Alexa voice service

5. Select Register a product > Device

6. Name your device ID and display name and click next

7. On the Security Profile screen, click “Create new profile”

8.Under the General tab, next to Security Profile Name name your profile. Do the same for the description then click Next

9. Make a note of the Product ID (from device type info), Client ID, and Client Secret generated

10. Click the Web Settings tab, then click the Edit button next to the profile dropdown list

11. Next to Allowed Origins click, Add Another and enter the following:

https://localhost:3000

12. Next to Allowed Return URL's click, Add Another and enter the following:

https://localhost:3000/authresponse

13. Click next

14. Fill in the device details tab as per your requirement like image, description etc...

15. Submit the information.

Now you have succesfully created the account for alexa voice service !

Step 5: Setting Up Raspberry Pi

After installation of Raspbian follow the steps:

1. Connect the usb sound card with mic, Wifi dongle, keyboard and mouse to the pi

2. Open the terminal and type :

cd Desktop

3. Type in git clone

<a href="https://github.com/alexa/alexa-avs-sample-app.git" rel="nofollow">https://github.com/alexa/alexa-avs-sample-app.git...</a>

and press Enter.

4. Then type

 cd ~/Desktop/alexa-avs-sample-app 

and press Enter.

5. Type

nano automated_install.sh

Press enter

6. Type in the ProductID, ClientID, and ClientSecret that you notes in the step above in the editor which opened up and press CTRL+x to save the file.

7. Then type in

cd ~/Desktop/alexa-avs-sample-app

and press Enter.

8. Then type

. automated_install.sh

and press enter

9. Several questions will be asked during the installation reply with Y/N according to the questions. This may take some time (about 30 min.). So take a break....

Once these steps are done its time to start alexa service described in the next step

Step 6: Running Alexa Web Service on Pi

Open three terminals for each of the following main steps:

TERMINAL 1

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 app and opens up the port to communicate with amazon.

TERMINAL 2

1. Type in

cd ~/Desktop/alexa-avs-sample-app/samples

and press Enter

2. Type in

cd javaclient && mvn exec:exec 

and press Enter

3. Click yes for the authentication window poping up.

4. 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.Log into your Amazon account in the browser.You’ll see an authentication screen for your device. Click Okay. Your browser will now display “device tokens ready.”You can now Click the Ok pop-up in the Java app.

5. Now the raspberry pi is able to communicate with amazon alexa server

TERMINAL 3

1. Type in

cd ~/Desktop/alexa-avs-sample-app/samples

and press Enter.

2. Type in

 cd wakeWordAgent/src && ./wakeWordAgent -e kitt_ai

3. Now your raspberry is listening to you for wake word "Alexa"

Test out the Alexa by saying wake word "ALEXA" followed by the question like "Whats the time" If every thing is properly configured you will be replied by the answer by alexa through the speaker.


NOTE: connect the speaker to 3.5mm analog port and set it as default audio output. Find more at here

For any clarification see the GIF file attached with this step

Step 7: Putting Every Thing Toghether

The last step is to put every thing into the enclosure:

1. Mount the Speaker to front side cardboard with nut and bolt.

2. Mount control knob, adapter to the enclosure

3. Connect Raspberry pi to the Aux cable and provide a micro USB cable to power it.

4. Close the enclosure with back side cardboard

Step 8: Finishing It Up !

1. Connect the power for speaker and Raspberry pi to the socket

2. The raspberry pi will boot up and use either SSH or monitor to perform steps defined in step 6 to start the alexa web service

That's it now you have developed your own alexa personal assistant. If needed you can create a script to automatically start the alexa web service.

I hope u all liked the project... Thank you...! :)

Power Supply Contest

Participated in the
Power Supply Contest