If you have created a smart mirror, you already have convenient access to calendars, weather and news. But you can do more than that! The Magic Mirror software allows you to add modules for additional features such as Alexa for voice control.
Other developers create these modules. Options range from useful ones like Alexa or presence detection (using a camera or PIR sensor) to entertaining ones like snowflakes and Spotify playback information.
We recommend mmm-awesome-alexa as it is maintained by an active developer, although there are other Alexa modules for the Magic Mirror software.
If you prefer to install Google Assistant, Google offers a complete guide to installing Assistant on Raspberry Pi, including steps, images, and download links. While there are several Magic Mirror modules for Google Assistant, our research has shown that these modules are problematic, often causing mirror information to fail or be reflected. If you want the easiest setup possible, we recommend adding the Google AIY kit and using its dedicated guide.
To install most modules, you will go through a few basic steps:
- Download the module code from GitHub
- Set up module-specific options
- Add module to mirror configuration
Depending on the module, steps two and three may be more or less involved. For example, setting up Alexa requires more settings than adding snowflakes. Also, this particular Alexa module requires additional software (dependencies) to be installed before the module can be loaded.
RELATED: How to build your own futuristic smart mirror
Materials you will need
This guide assumes that you have already created a Smart Mirror. If you haven’t already, start here, but keep in mind the additional materials listed here based on your cost and space.
- Completed Smart Mirror
For the microphone and speaker, we recommend the original Google AIY Voice Kit. At $16, you’d be hard-pressed to find a cheaper mic/speaker combo. You don’t have to use the included carton; it may be more efficient to leave the components outside and run the microphone and speaker outside of the mirror.
A second version of the Google AIY Voice Kit is available, but it’s more expensive and includes a Raspberry Pi Zero that isn’t powerful enough to run awakened words or Magic Mirror software, so you should skip it.
Plug in your speaker and microphone, and you’re ready to install the Alexa module. If you are using the Google AIY kit, just follow its assembly guide to connect the microphone and speaker components.
Installing module dependencies
Before you can download and configure mmm-awesome-alexa, you need to install a few dependencies that the module relies on. It’s always a good idea to update your Raspberry Pi before installing anything else. On your Raspberry Pi, run the following command:
обновление sudo & ap & обновление sudo apt
Once your Raspberry Pi is updated, run the following commands one by one:
sudo apt-get установить sox libsox-fmt-all sudo apt-get установить swig3.0 python-pyaudio python3-pyaudio sox pip install pyaudio sudo apt-get установить libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools sudo apt-get установить libatlas-base-dev
Each command installs a dependency and they are all required to run. Just run the command, wait for the download and installation to complete, then run the following command.
Loading the module code
The first step to adding any module to Magic Mirror is to download the Github module code. To do this, you need to log into your Raspberry Pi, open a terminal, and navigate to the directory where the modules are stored. You will then use the download command to pull the code from Github. If you have shell access, you can do all of this remotely.
Once you have a terminal open, enter the following:
cd ~ / MagicMirror / modules
This command moves you to the working directory of the modules folder for the Magic Mirror software. Every time you upload a new module, you need to be there to keep everything organized. The next step is to download the software from Github using this command:
git clone https://github.com/dolanmiu/MMM-awesome-alexa.git
When it finishes, change the directories to the module with the following command:
The Alexa module requires a few additional dependencies to work properly. Run this command to install them:
npm install --only = prod
Now change directories to the newly created node_modules folder:
Delete the «Snowboy» folder added by the previous commands. We need a new version of Snowboy:
Next, we will download the latest version of Snowboy with the following command:
git clone https://github.com/Kitt-AI/snowboy.git
Before we continue, change the directory to the new Snowboy folder.
Now we need to remove the node_modules folder and install some additional dependencies. It’s important that you stay in the «Snowboy» folder for these steps; do not change directories. Run the following commands one by one:
rm -rf node_modules npm установить nan - сохранить npm install email@example.com - сохранить установка npm Npm Run Prepublish npm install --save-dev электронное восстановление нпм установить нан ./node_modules/.bin/electron-rebuild
The module is now fully loaded and installed.
Setting up the Alexa module