vanelk / alexa-pi

Alexa on a raspberry pi
1 stars 0 forks source link
amazon-alexa nodejs python raspberry-pi systemd voice-assistant voice-recognition wake-word-detection

Alexa pi

Amazon alexa on raspberry pi.

Requirements

To install alexa on your raspberry pi you'll need:

Installation

Step 0: Creating project directory

Once you have installed your os, run:

cd $HOME
mkdir /opt/alexa
cd /opt/alexa
sudo chown -R pi:pi ../

Step 1: Installing Device SDK

Follow instructions to install alexa device sdk from amazon's website. Remember to replace /home/pi/ with /opt/alexa when running any script from the guide bellow.

Notes

Further Notes.

Step 2: Install NodeJS

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

Step 3: Clone and setup repo

a. Clone repo and enter into it

git clone https://github.com/vanelk/alexa-pi.git
cd  alexa-pi

b. Install Python and Nodejs dependencies

pip install -r requirements.txt
npm install

c. Install Audio player to play sound effects

sudo apt install mpg123

Running

In folder where you cloned this project, run:

npm start

Wait for the Hello sound to confirm activation. Try saying Alexa followed by your query. For example:

Optional

Running alexa-pi on device start

To run the script on device start we will use the systemd service.

sudo install -Dm644 ./scripts/alexapi.service /usr/lib/systemd/system/alexapi.service
sudo systemctl daemon-reload

Check if it is actually running

sudo systemctl start alexapi
systemctl status alexapi

If you see Running just press q to exit and run

sudo systemctl enable alexapi

After this you are all set and after rebooting your pi you should hear the hello sound indicating the app have started

reboot