Here's how you can turn your raspberry pi 4 (or 3) into an Amazon Alexa. It's even easier than a Google Assistant and has lots of applications.
Subscribe for more Raspberry Pi tutorials :) https://www.youtube.com/samwestbytech...
I may earn commission if you purchase from the links below:
MY CAMERA: https://amzn.to/3reaDlK
MY MICROPHONE: https://amzn.to/3fhunSN
MY LIGHTING: https://amzn.to/3dHll1i
FREE Amazon Prime: https://amzn.to/3ren80W
FREE Audible Plus: https://amzn.to/3xYzJsR
RASPBERRY PI 4: https://amzn.to/3BC4i9I
RASPBERRY PI PICO START KIT: https://amzn.to/3REvjis
RASPBERRY PI CAMERA V2: https://amzn.to/3QFp90c
ELECTRONICS COMPONENT STARTER KIT: https://amzn.to/3qB23xg
ASSORTED SENSOR KIT: https://amzn.to/3U7M7zV
USB SPEAKER: https://amzn.to/3La4foK
USB 1080P WEBCAM: https://amzn.to/3Lq0OL7
INSTRUCTIONS:
0:00 Intro
Start here: https://developer.amazon.com/en-US/do...
1:00 Register your device with Amazon: https://developer.amazon.com/en-US/do...
Download the config.json from your security profile
4:20 Access your pi's terminal - I'm using ssh
4:38 Run in the terminal:
cd /home/pi/
mkdir sdk-folder
cd sdk-folder
mkdir sdk-build sdk-source third-party sdk-install db
cd /home/pi/
sudo apt-get update
sudo apt-get -y install \
git gcc cmake build-essential libsqlite3-dev libcurl4-openssl-dev libfaad-dev \
libssl-dev libsoup2.4-dev libgcrypt20-dev libgstreamer-plugins-bad1.0-dev \
libnghttp2-dev nghttp2 gstreamer1.0-plugins-good libasound2-dev doxygen
cd /home/pi/sdk-folder/third-party
wget -c http://www.portaudio.com/archives/pa_...
tar zxf pa_stable_v190600_20161030.tgz
cd portaudio
./configure --without-jack
make
cd /home/pi/sdk-folder/third-party
wget https://github.com/curl/curl/releases...
tar xzf curl-7.67.0.tar.gz
cd curl-7.67.0
./configure --with-nghttp2 --prefix=/home/pi/sdk-folder/third-party/curl-7.67.0 --with-ssl
make
6:13 Download and build the AVS Device SDK
cd /home/pi/sdk-folder/sdk-source
git clone --single-branch git://github.com/alexa/avs-device-sdk.git
cd /home/pi/sdk-folder/sdk-build
cmake /home/pi/sdk-folder/sdk-source/avs-device-sdk \
-DGSTREAMER_MEDIA_PLAYER=ON \
-DPORTAUDIO=ON \
-DPKCS11=OFF \
-DPORTAUDIO_LIB_PATH=/home/pi/sdk-folder/third-party/portaudio/lib/.libs/libportaudio.a \
-DPORTAUDIO_INCLUDE_DIR=/home/pi/sdk-folder/third-party/portaudio/include \
-DCURL_INCLUDE_DIR=/home/pi/sdk-folder/third-party/curl-7.67.0/include/curl \
-DCURL_LIBRARY=/home/pi/sdk-folder/third-party/curl-7.67.0/lib/.libs/libcurl.so
Build the sample app (or just run "make" to build the whole SDK)
make SampleApp
7:15 Move config.json to Pi
On my remote machine I run:
scp insert/your/path/to/config.json pi@raspberrypi:/home/pi/sdk=folder/sdk-source/avs-device-sdk/tools/Install
If you're already on the Pi, move your config.json to /home/pi/sdk=folder/sdk-source/avs-device-sdk/tools/Install
8:40 Generate config
cd /home/pi/sdk-folder/sdk-source/avs-device-sdk/tools/Install
bash genConfig.sh config.json 12345 \
/home/pi/sdk-folder/db \
/home/pi/sdk-folder/sdk-source/avs-device-sdk \
/home/pi/sdk-folder/sdk-build/Integration/AlexaClientSDKConfig.json \
-DSDK_CONFIG_MANUFACTURER_NAME="raspberrypi" \
-DSDK_CONFIG_DEVICE_DESCRIPTION="raspberrypi"
9:08 Set up audio:
sudo nano /home/pi/sdk-folder/sdk-build/Integration/AlexaClientSDKConfig.json
Then add
"gstreamerMediaPlayer":{
"audioSink":"alsasink"
},
to the space above "cblAuthDelegate"
Ctrl + S to save then Ctrl + X to exit the nano editor
Run the following to find your card and device numbers:
aplay -l
arecord -l
Make a .asoundrc file:
sudo nano ~/.asoundrc
Copy and paste the following (changing card and device numbers if necessary):
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:0,0"
}
capture.pcm {
type plug
slave.pcm "hw:1,0"
}
}
Ctrl + S to save Ctrl + X to exit
Test audio: sudo apt-get install sox -y && rec test.wav
Kill pulseaudio: pulseaudio -k
Authorize and run your Alexa:
cd /home/pi/sdk-folder/sdk-build
PA_ALSA_PLUGHW=1 ./SampleApp/src/SampleApp ./Integration/AlexaClientSDKConfig.json DEBUG9
I hope you found this helpful! Happy coding
コメント