Alexa, how can you add it to Magic Mirror?

If you built a smart mirror, you already have practical access to calendars, weather and news. But you can do more than that! Magic Mirror software allows you to add modules for additional functions, such as Alexa for voice control.

Other developers create these modules. The options vary from useful, such as Alexa or presence detection (through a camera or passive infrared sensor), to entertaining, such as snowflakes and Spotify playback information.

We recommend mmm-awesomee-alexa as it seems to be well maintained by an active developer, although there are other Alexa modules for the Magic Mirror software.

If you prefer to install the Google Assistant, Google offers a complete tutorial to install the Assistant on a Raspberry Pi, which includes steps, images and download links.

Although there are some Magic Mirror modules for Google Assistant, our research revealed that the modules were problematic, often crashing or covering the replica information. If you want a simpler configuration, we recommend that you add the Google AIY kit and use your specific tutorial.

To install most modules, you must follow some basic steps:

Download the module code from GitHub

Configure module specific options

Add the module to the replication configuration

Depending on the module, steps two and three may be more or less involved. Alexa settings require more settings than the addition of snowflakes, for example. In addition, this particular Alexa module requires the installation of additional software (dependencies) before downloading the module.

The materials you will need

This guide assumes that you have already created a Smart Mirror. If you have not already done so, start there, but consider the additional materials listed here in your costs and space considerations.

Smart Mirror Finished



For the microphone and speaker, we recommend the original Google AIY voice kit. At $ 16, it will cost you to find a cheaper combination of microphone and speaker. You do not need to use the included cardboard box; It may be more effective to leave components out and operate the microphone and speaker out of the mirror.

A second version of the Google AIY Voice Kit is available, but it is more expensive and includes a Raspberry Pi Zero, which is not powerful enough to execute wake words or Magic Mirror software, so you should skip it.

Connect the speaker and microphone and you will be ready to install the Alexa module. If you use the Google AIY kit, just follow its assembly guide to connect the microphone and speaker components.

Installation of module dependencies

Before you can download and configure mmm-awesome-alexa, you need to install some dependencies on which the module is based. It is always a good idea to update your Raspberry Pi before attempting to install anything else. On your Raspberry Pi, start by executing this command:

sudo apt update && sudo apt upgrade

Once your Raspberry Pi is updated, run the following commands one by one:

sudo apt-get install sox libsox-fmt-all

sudo apt-get install swig3.0 python-pyaudio python3-pyaudio sox

pip install pyaudio

sudo apt-get install libasound-dev portaudio19-dev libportaudio2

libportaudiocpp0 ffmpeg libav-tools

sudo apt-get install libatlas-base-dev

Each command installs a dependency, and all are necessary to execute. Simply run a command, wait for the download and installation to finish, and then run the following command.

Module code download

The first step in adding any module to the Magic Mirror is to download the Github module code. To do this, you must log in to the Raspberry Pi, open the terminal and change the directory in which the modules are stored. Then you will use a download command to extract the Github code. If you have access to the shell, you can do all this remotely.

Once you have an open terminal, type the following:

cd ~ / MagicMirror / modules

This command takes you to the working directory of the module folder for the Magic Mirror software. Every time you download a new module, you will want to be here to keep everything organized. The next step is to download the Github software with this command:

git clone

When finished, change the directories to the module with the following command:

cd MMM-awesomee-alexa

The Alexa module requires some additional dependencies to function properly. Run this command to install them:

npm install –only = prod

Now, change the directories to the newly created node_modules folder:

cd module_node

Alexa module programming

Remove the snowboy folder to which the previous commands were added. We need a new version of Snowboy:

rm -rf snowboy

Next, we will download the latest version of snowboy with the following command:

git clone

Before continuing, change directory to the new nowboy scarpeta.

cd snowboy

Now we need to delete the node_modules folder and install some additional dependencies. It is important that you stay inside the snowboy folder for these steps; Do not change directory. Run the following commands one by one:

rm -rf module_node
npm install nan –save
npm install node-pre-gyp@0.12.0 –save
npm install
npm run prepublish
npm install –save-dev electron-rebuild
npm install nan

Now the module is completely downloaded and installed.

Alexa module configuration

Now that the mmm-awesomee-alexa module is installed, we need to configure it. The first step is to change the directories to the root of the module. In the terminal type the following command and then press Enter:

cd ~ / MagicMirror / modules / MMM-awesomee-alexa

This Alexa module has a configuration wizard; We want to execute it. In terminal type:

npm run config-helper

You will see a message asking for a Customer ID. Since you are setting up a custom echo, you will have to open a browser and go to the Alexa developer site. Then, log in with your Amazon account.

Once you are logged in, click on the "Start" button. You are creating a device, so click on "Products" and "Create product".

On the next screen, give your product a name and a product ID: we suggest «Magic_Mirror_Alexa» for the name and «YourFirstName_MM_Alexa» for product identification. Select Smart Home for the category and enable hands-free and far-field options. You will see a series of yes or no questions, select “No” for all and then click on “Next”.

On the security profile screen, click on “Create new profile”. Use the same name for your security profile as for the product ID. Then type the description you want and click Next.

Check the agreement and click Finish.

Click on your newly created product, then the security profile, and you will see a customer ID and a customer secret.

Configuring the URL

In the type of return URL entry allowed:

Then click on the Add button. Scroll down and click on the update box to finish adding the URL.

In the terminal, you will see a client ID request. Copy the client ID of the browser, paste it into the terminal and then press Enter. Now the terminal will request a client secret. Return to the browser, copy the client's secret, paste it into the Terminal and press Enter.

When you are prompted for the device ID, enter the name you created earlier as the product ID (Magic_Mirror_Alexa in our example).

When you are prompted to provide a return URL, type the following command and press Enter:

The terminal will display a custom link. Copy that and paste it into your browser. Then, log in with your Amazon account, if prompted. Click Allow on the next screen.

You will see an error in the browser, but do not worry. This is what is expected. Scroll through the URL of the error page and find the "Code = xxxxxxxx" section.

Copy the letters and numbers that appear between "code =" and "& scope" and paste them into the terminal. Press Enter when finished.

When asked if you want to generate the MagicMirror configuration, type Y and press Enter.

You will be asked what word to wake up. Alexa is the default selection, so press Enter.

Answer no by using lite mode and visualization.

The configuration wizard will generate the information of your module. It will look like this:

Copy those lines. We have to add them to the Magic Mirror configuration.

Add the Alexa module to the Magic Mirror configuration

Next, change the directory to the Magic Mirror configuration folder with the following command:

cd ~ / MagicMirror / config

And open the config.js using the nano command:

nano config.js

Just after the first instance of}, (which is the end of the module) press Enter to create a blank line before the next {entry (which is the beginning of a new module).

On the new blank line you created, paste the module code from the steps in the configuration wizard. The automatically generated code has an error; You will also need to type a comma after the last parenthesis for your module to end with "}," (without the quotes).

Use Ctrl + x to close the file. When prompted, type "y" to confirm the save and press Enter to keep the file name the same.

The module is finished. To restart the Magic Mirror software with the module in place, type pm2 restart mm and the Magic Mirror software will restart. Alexa should now work on your Magic Mirror.

This is one of the most complicated modules that you can configure for the Magic Mirror. But for other modules, the basic steps are the same, download the code, configure the specific module options, add the module to the configuration. You can add snowflakes to your mirror, or motion detection, or even show your Google photos.