Configuring Amazon Alexa on Raspberry Pi!
Tags: alexa, amazon, tech, programming
Published: 2022-03-26 15:21:29

**_Alexa_** is Amazon’s cloud-based voice service available on more than 100 million devices from Amazon and third-party device manufacturers. With Alexa, you can build natural voice experiences that offer customers a more intuitive way to interact with the technology they use every day.

In this post I will guide you how to do it on a **Raspberry Pi**.

**Step 1>** _Creating Amazon Developer Account_

Open up a browser and go to **https://developer.amazon.com/**.
Just enter a username and password and create your account.


![Image1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bysmfh2lkylizvxcbfht.png)

**Step 2>** _Register Amazon Developer_

Just enter all the relevant details


![Image2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyqcgwdnbehnckshs0rn.png)

**Step 3>** _Creating the Product_

Go to **https://developer.amazon.com/alexa/console/avs/products**

Click on Add new product


![Image3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/22g332cour803um9h5i3.png)

Now fill the required details


![Image4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nhlnqate8xgnt9cokdge.png)


![Image5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/klkjbqukyolpnzycmq82.png)


![Image6](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zo4hyxtnvfkuhq70m5wo.png)

**Step 4>** _Creating LWA Security Profile_

Click on create new profile and fill the details

**Note**: You can put anything in security profile description


![Image7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0yzps1gghj33x8qk7hu.png)

After filling details click on next.

Copy all the details and note them, as they will be required in further steps.


![Image8](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqks5n88tbrzov01a4n1.png)


![Image9](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jozgm7vybv9xyemyrz7v.png)

IN allowed origins field put **http://IP:5050** and **http://localhost:5050**.

IP is the IP of the Raspberry Pi where you want to Alexa service to run.

In allowed return URLs put **http://IP:5050/code**  and **http://localhost:5050/code**

IP is the IP of the Raspberry Pi where you want to Alexa service to run.

Click on I agree and then continue/next.

You will get a message that Your product has been created successfully.

**Step 5>** _Configuring the device_

Open up a terminal, we will do some installations first.

Make sure everything is updated -
`$ sudo apt-get update`

Distribution upgrade -
`$ sudo apt-get dist-upgrade`

Install git -
`$ sudo apt-get install git`

Install CherryPy library -
`$ sudo pip3 install CherryPy==17.4.0`

Navigate to /opt folder -
`cd /opt`

Clone the AlexaPi repository -
`$ sudo git clone https://github.com/alexa-pi/AlexaPi.git`

Run the setup script -
`$ sudo ./Alexa/src/scripts/setup.sh`

Answer the prompts according to your device and OS. For Airplay support give **n**.

Once every detail is provided to the script, open up a browser and go to **http://localhost:5050**. If any error comes then check in security profile configuration that the URLs are added.

Sign in using your Amazon developer account credentials.

This page will come after signing in, click on Allow

![Image10](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bon20i7xip2fdlzuh2pi.png)

You will get this message -

![Image11](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4e5sgierxqhv768xozny.png)

Now exit the browser and press Ctrl+C in the terminal.

**Step** Start the AlexaPi service

start by -
`$ sudo systemctl start AlexaPi.service`

stop by -
`$ sudo systemctl stop AlexaPi.service`

Connect a Speaker and Mic to your Raspberry Pi. Once the service is running start asking **Alexa** any questions.

Thanks

My GitHub Profile -> https://github.com/YashIndane
My Linkedin Profile -> https://www.linkedin.com/in/yash-indane-aa6534179/