ECE-4180-A Fall 2019 Final Project
Developed and maintained by:
- Christian Graham
- Alex Mathis
- Sergio Prudencio
- Steve Sung
The idea behind this project is to build a device that functions as a mirror and allows users to connect with existing home automation assistant devices and software to provide relevant features and information. One could convert any mirror into a personal assistant.
- Features
- Time Display
- Date
- Weather Forecast
- Live Reddit Feed
- Spotify Integration
- Alexa Interface
- JEOPARDY Game Integration
- Pages Functionality
- Parts List
- Two-Way Acrylic Mirror
- Mirror Frame
- Wood Planks
- Miter Saw
- Screws
- Drill
- Raspberry Pi 4
- Micro SD Card
- Micro HDMI Adapter Micro HDMI to
- HDMI Female Cable
- LCD Display
- Extension Cord
- Alexa (optional)
- Connections
In this section we will focus on setting up all the necessary components and software to run the Magic Mirror software and install a few of the modules we have running in this version of the software. To do this, ensure you have access to the Raspberry Pi, a Micro SD Card, and all the necessary peripherals to interface with the Pi.
- Necessary Components / Software
- Raspberry Pi 4*
- Micro SD Card
- Etcher (SD Imaging Software)
- First we’re going to download the latest version of Google’s AIY variant of the Raspbian Linux Distribution. Visit the following website and download the latest img.xy file.
- Next, use the Etcher SD Imaging Software to flash the img.xy file to your Micro SD Card.
- Insert the Micro SD Card into your Raspberry Pi and boot the Pi. The Pi should boot directly into the AIY Raspbian OS.
- Take a moment to familiarize yourself with the OS if you’ve never used Raspbian before. Set your date/time, create an account with user ID / password, and get connected to your network. The Raspberry Pi 4 supports both wired and wireless network connections.
- Installing the Magic Mirror software is as easy as cloning the projects GitHub repository. To do this, open up the terminal and paste the following string:
bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"
- NOTE: Visit the official site for all documentation.
- I recommend pressing “y” when it asks you if you would like to install PM2 as this is the mirror softwares autoboot function. After installation it should boot directly into the mirror software. 3. The mirror software can be closed with “ctrl+Q”.
- At this point if the mirror software closes for any reason it will reboot itself every 10 seconds. To stop this, open up the terminal and enter the following string:
pm2 stop MagicMirror
- If you would like to restart the mirror software, type the following string:
pm2 start MagicMirror
- To access the mirror software’s config file, visit the following file path:
/home/pi/MagicMirror/config
- Here you should find a file called “config.js”. This is the mirror software’s configuration file. If, for any reason, you mess up your config file simply copy the sample config file (same folder) and rename it to “config.js”.
- Open “config.js” with any text editor. Here you can change the mirror’s time format, default language, default units, modules, etc. This is where the majority of our time will be spent when editing the mirror’s functionality.
- If you do not want a module to display on the mirror, simply comment it out or delete it (bracket to bracket). Remember to save your work before leaving the text editor.
2. I removed the following modules:
- Newsfeed
- CurrentWeather
- WeatherForecast
- Calendar
- UpdateNotification
- Alert
- Further, I changed the default language to
english
(“en
”),timeFormat
(“12
”), andunits
(“imperial
”).
- We’re going to start by installing a specific weather module called MMM-3Day-Forecast by nigel-daniels.
- Official Page:
- Open the terminal and navigate to your modules folder, you can do this by pasting the following string into the terminal:
cd ~/MagicMirror/modules
- Clone the GitHub repository by pasting the following string in the terminal:
git clone https://github.com/nigel-daniels/MMM-3Day-Forecast
- Once that’s done, to install additional dependencies paste the following strings into the terminal:
cd ~/MMM-3Day-Forecast
npm install
- Make your way to the mirror softwares config.js file and paste the example module info below: 6. NOTE: Please visit the official page for additional parameters modifications.
{
module: 'MMM-3Day-Forecast',
position: 'top_left',
config: {
api_key: 'xxxxxxxxxxxxxxxxxxxxxx',
lat: 37.3397352,
lon: -121.894958,
units: 'M',
lang: 'en',
interval: 900000
}
},
- You must now visit the following website, sign up for an account, and retrieve an API key in order to retrieve real time weather info.
- Once you have acquired the API key, return to the config.js file and paste your API key in the weather module you just created. Additionally, you may update the latitude and longitude of the location it’s polling weather.
- Next we’ll install a Spotify module that interacts with the Spotify API called MMM-Spotify by eouia.
- Official Page:
- Open the terminal and navigate to your modules folder, you can do this by pasting the following string into the terminal:
cd ~/MagicMirror/modules
- Clone the GitHub repository by pasting the following string in the terminal:
git clone https://github.com/eouia/MMM-Spotify
- Once that’s done, to install additional dependencies paste the following strings into the terminal:
cd ~/MMM-Spotify
npm install
- Make your way to the mirror softwares config.js file and paste the example module info below: 6. NOTE: Please visit the official page for additional parameters modifications.
{
module: "MMM-Spotify",
position: "bottom_left",
config: {
style: "default", // "default" or "mini" available
control: "default", //"default", "hidden" available
updateInterval: 1000,
onStart: null, // disable onStart feature with `null`
allowDevices: [], //If you want to limit devices to display info, use this.
// allowDevices: ["RASPOTIFY", "My iPhoneX", "My Home speaker"],
}
}
- Before Spotify will work we’ll need to set up a Spotify developer account and retrieve the API key. Go to the following URL:
- Once there, navigate to “dashboard” > “create an app”
- Setup the app and hit “edit settings”
- Change the redirect URI’s to the following:
http://localhost:8888/callback
- Now copy your Client ID and Client Secret. We will need these for the next few steps.
- Make your way to the following path and rename spotify.config.json.example to spotify.config.json:
/MagicMirror/modules/MMM-Spotify
- Once you’ve done this, open the .json file and paste your Client ID and Client Secret. Save and close this file.
- You can retrieve authorization by pasting the following strings in the terminal:
cd ~/MagicMirror/modules/MMM-Spotify
node first_auth.js
- Lastly, we're going to install a module that allows us to control the mirror directly through an Amazon Echo. This module is very powerful and can be used in a number of ways. The module is MMM_AlexaControl by JoChef2.
- Official Page:
- Open the terminal and navigate to your modules folder, you can do this by pasting the following string into the terminal:
cd ~/MagicMirror/modules
- Clone the GitHub repository by pasting the following string in the terminal:
git clone https://github.com/JoChef2/MMM-AlexaControl.git
- Once that’s done, to install additional dependencies paste the following strings into the terminal:
cd ~/MMM-AlexaControl
npm install
- Make your way to the mirror softwares config.js file and paste the example module info below: 6. NOTE: Please visit the official page for additional parameters modifications.
{
module: 'MMM-AlexaControl',
position: 'middle_center',
config:{
image: true,
pm2ProcessName: "mm",
vcgencmd: true
}
}
- Once the mirror software is booted up, ensure your smart mirror and Amazon Echo are on the same network.
- Search in the Alexa App for new devices or say: "Alexa, discover my devices".
- A list of new devices should populate as this module uses fake WEMOS devices to control certain aspects of the smart mirror.
- Say “Alexa turn [device name] on/off.”
2. Device Names are as follows:
- Page #
- Refresh
- Restart pm2
- Stop pm2
- Reboot pi
- Shutdown pi
- Monitor
- Remove the monitor stand from the LCD panel
- Trace the monitor on to the black styrofoam and cut with an exacto knife. The black styrofoam is used to fill and ensure the blank area surrounding the monitor also functions as a mirror.
- Place the modified black styrofoam backing into the back of the mirror frame and position the monitor facing down (screen facing the front of the mirror).
- Using a miter saw, create four 4”x10” and two 2”x4” wood pieces.
- Drill two 4”x10” pieces to the bottom of the mirror frame, bracing the bottom of the monitor.
-
Drill two 2”x4” pieces to the bottom left and right of the monitor, bracing the sides.
-
Drill the remaining 4”x10” pieces on the top, mirroring the bottom, to complete securing the monitor. Finish by drilling strips of thin wood to prevent the monitor from falling out backwards.
- At this point you must find some way to attach the Pi to the back of the wood frame, wire everything up, and project complete!