Turn Your Raspberry Pi Into An Amazon Echo

Опубликовано: 31 Март 2025
на канале: The Assembly
5,097
71

Smart speaker assistants utilize technology for our home convenience and have rightly become a core feature in most households, centralizing control of various devices and making them far easier to use. In a past session, we turned a Raspberry Pi into a DIY Google Home-style assistant, but in this workshop, we will continue that pursuit by transforming a Pi into a customizable smart speaker modelled on the other prominent brand in the market: the Amazon Echo.

We’ll show you how to incorporate Amazon’s Alexa APIs and set up voice controls for our device, allowing for easy sync with home technology and companion apps.

Prerequisites:
Raspberry Pi (with Raspbian OS)
USB microphone
Speakers

----------------------------------------
Amazon Links
----------------------------------------
https://developer.amazon.com/login.html
https://developer.amazon.com/lwa/sp/o...

Commands
----------------------------------------
sudo apt-get update
sudo apt-get upgrade

wget https://raw.githubusercontent.com/ale...
wget https://raw.githubusercontent.com/ale...
wget https://raw.githubusercontent.com/ale...

nano ~/config.json
bash setup.sh config.json
sudo apt-get install gstreamer1.0-alsa gstreamer1.0-tools gstreamer1.0-plugins-ugly
nano /home/pi/build/Integration/AlexaClientSDKConfig.json
arecord -l
aplay -l
nano /home/pi/.asoundrc

.asoundrc file content
----------------------------------------
pcm.!default {
type asym
capture.pcm "mic"
playback.pcm "speaker"
}
pcm.mic {
type plug
slave {
pcm "hw:[card number],[device number]"
}
}
pcm.speaker {
type plug
slave {
pcm "hw:[card number],[device number]"
}
}
----------------------------------------
starting Alexa on boot commands and code
-----------------------------------------
sudo nano /home/pi/avs-device-sdk/SampleApp/src/UserInputManager.cpp



std::this_thread::sleep_for(std::chrono::hours(1));
continue;


cd /home/pi
sudo bash setup.sh config.json

sudo nano /lib/systemd/system/alexa.service


[Unit]
Description=Raspberry Pi Alexa
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/bin/bash /home/pi/startsample.sh
Restart=on-abort
User=pi
Group=pi

[Install]
WantedBy=multi-user.target


sudo systemctl enable alexa.service
sudo systemctl start alexa.service
sudo systemctl status alexa.service


-----------------------------------------

To learn more about The Assembly’s workshops, visit our website, social media or email us at [email protected]

Our website: http://theassembly.ae
Follow us on social media:
—Instagram:   / makesmartthings  
—Facebook: http://fb.com/makesmartthings
—Twitter:   / makesmartthings  

#SmartSpeaker #Amazon #Echo #Alexa #RaspberryPi #DIY #EmbeddedSystems