You are on page 1of 14

instructables

Magic Mirror

by khinds10

Wall Based Magic Mirror for Current Weather & Time Display

Step 1: Flashing RaspberriPi Hard Disk / Install Required Software (Using Ubuntu Linux)

Magic Mirror: Page 1


Download "RASPBIAN JESSIE LITE" Insert the microSD to your computer via USB adapter
https://www.raspberrypi.org/downloads/raspbian/ and create the disk image using the dd command

Create your new hard disk for DashboardPI Locate your inserted microSD card via the df -h

Magic Mirror: Page 2


command, unmount it and create the disk image with layout changes / file system resizing to take effect
the disk copy dd command
$ sudo shutdown -r now Auto-Connect to your WiFi
$ df -h /dev/sdb1 7.4G 32K 7.4G 1%
/media/XXX/1234-5678 sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Add the following lines to have your raspberrypi
$ umount /dev/sdb1 automatically connect to your home WiFi (if your
wireless network is named "linksys" for example, in
Caution: be sure the command is completely the following example)
accurate, you can damage other disks with this
command network={ ssid="linksys" psk="WIRELESS
PASSWORD HERE" }
if=location of RASPBIAN JESSIE LITE image file
of=location of your microSD card Reboot PI to connect to WiFi network

$ sudo dd bs=4M if=/path/to/raspbian-jessie-lite.img $ sudo shutdown -r now


of=/dev/sdb (note: in this case, it's /dev/sdb,
/dev/sdb1 was an existing factory partition on the Now that your PI is finally on the local network, you
microSD) Setting up your RaspberriPi can login remotely to it via SSH. But first you need to
get the IP address it currently has.
Insert your new microSD card to the raspberrypi and
power it on with a monitor connected to the HDMI $ ifconfig Look for "inet addr: 192.168.XXX.XXX" in
port the following command's output for your PI's IP
Address Go to another machine and login to your
Login raspberrypi via ssh

user: pi pass: raspberry $ ssh pi@192.168.XXX.XXX Start Installing required


packages
Change your account password for security
$ sudo apt-get update
sudo passwd pi
$ sudo apt-get upgrade
Enable RaspberriPi Advanced Options
$ sudo apt-get install vim git python-smbus i2c-tools
sudo raspi-config python-imaging python-smbus build-essential python-
dev rpi.gpio python3 python3-pip libi2c-dev python-
Choose: 1 Expand File System requests Update local timezone settings

9 Advanced Options $ sudo dpkg-reconfigure tzdata select your timezone


using the interface Setup the simple directory l
A2 Hostname change it to "MagicMirror" command [optional]

A4 SSH Enable SSH Server $ vi ~/.bashrc

A7 I2C Enable i2c interface Enable the English/US add the following line:
Keyboard
$ alias l='ls -lh'
sudo nano /etc/default/keyboard Change the following
line: XKBLAYOUT="us" Reboot PI for Keyboard $ source ~/.bashrc

Magic Mirror: Page 3


Fix VIM default syntax highlighting [optional] $ vi simpletest.py

$ sudo vi /etc/vim/vimrc Change the following line:

uncomment the following line: sensor = Adafruit_DHT.DHT11 Comment the line out

syntax on DHT11 Install pin = 'P8_11' Uncomment the line and change the pin
number to 16
$ cd ~
pin = 16 Run the test
$ git clone
https://github.com/adafruit/Adafruit_Python_DHT.g... python simpletest.py

$ cd Adafruit_Python_DHT/ You should see a metric reading of Temp and


Humidity displayed on the command line.
$ sudo python setup.py install

$ sudo python ez_setup.py

$ cd examples/

Step 2: Supplies Needed: 12" X 24" Acrylic See-Through Mirror, 3mm

Step 3: Supplies Needed: Balsa Wood Strips 0.125 X 0.5 Inches

Magic Mirror: Page 4


Step 4: Supplies Needed: 12x24 Inch Black Picture Frame

Step 5: Supplies Needed: OLD Android Tablets (x2)

Magic Mirror: Page 5


Step 6: Supplies Needed: DHT11 Humidistat

Step 7: Supplies Needed: RaspberriPi Zero (or Regular RaspberriPi Should Work)

Step 8: Build and Wire the Device

DHT11 Humidistat

VCC -> 5V

GND -> GND

DATA -> GPIO 16 / PIN 36

Magic Mirror: Page 6


Step 9: 3D Print Brackets

In the /construction folder of the project 3D print the following attachments to build the picture frame borders and
tablet holders.

Print the Following Tablet Holders:

tablet-mounts.stl

Print the Following Frame Corner blocks and balsa wood attachments:

mirror-corner-blocks.stl

mirror-corners.stl

mirror-sides.stl

Magic Mirror: Page 7


Step 10: Assembly

Gather together the frame balsa wood strips and the 3D printed attachments

Magic Mirror: Page 8


Step 11: Assembly (cont.)

Assemble the balsawood strips inside the corner brackets (sliding the balsawood through the side brackets, make
sure they're square against the corners of the picture frame. Paint everything black with spray paint.

Magic Mirror: Page 9


Step 12: Assembly (cont.)

Screw the corners to the 4 corner blocks to hold the frame together.

Step 13: Assembly (cont.)

Attach the tablets and Raspberry PiZero to the wood to eventually fix to the wall.

Magic Mirror: Page 10


Step 14: Assembly (cont.)

Attach to the wall the board. (Note the 2 screws on the top left and right, they will be used to hold up the picture
frame with frame border attached to place in front of the tablets to shine through the mirror)

Magic Mirror: Page 11


Step 15: Finish Assembly

Finally replace the cardboard piece inside the picture frame with a two way mirror and on each corner of the
picture frame screw into the corner (3D printed) blocks to hold the picture frame to the frame border.

Magic Mirror: Page 12


Magic Mirror: Page 13
Step 16: Software Required

Create the Device Hub Project hosted on a PHP Create the tablet clock website
enabled webhost of your choice for the top tablet
to get data Create a PHP enabled website online with the
contents of the "tablet" folder in this project.
https://github.com/khinds10/DeviceHub
Configure the website: In the "tablet/server" folder of
Create Weather Tablet Project for the bottom the project, copy the config.shadow.php file to a file
tablet named "config.php" Edit the "config.php" configure
the $deviceHubAPI value to point to the device hub of
https://github.com/khinds10/WeatherTablet your choosing from the referenced project above
(https://github.com/khinds10/DeviceHub)
Setup Startup Scripts, Temp Logger to API script
each 3 minutes Example Apache2 Configuration File for the tablet
clock PHP website
In the raspberrypi folder of the project copy the
settings.shadown.py file to settings.py with the host DocumentRoot /var/www/tablet ServerName
file of the DeviceHub project above you have setup. myclocktablet.com ServerAdmin
webmaster@myclocktablet.com ErrorLog
$ crontab -e Add the following lines: ${APACHE_LOG_DIR}/error-clock-tablet.log
CustomLog ${APACHE_LOG_DIR}/access-clock-
*/3 * * * * python tablet.log combined Options FollowSymLinks
/home/pi//MagicMirror/raspberrypi/temp-check.py AllowOverride All Require all granted

Verify the display starts working on reboot FINISHED!

$ sudo reboot

Magic Mirror: Page 14

You might also like