DIY Smartmirror (A Mirror with a HUD)

I’ve decided to make this article english only. Mainly because I’m lazy but also because everyone who wants to do something similar should definitely understand english.

The question is: What the heck is a SmartMirror?

This Project was inspired by the MagicMirror found here. Sadly, that thing costs over 300€ so I’ve decided to build it in a smaller scale.

Good thing, that I had the insides of an Acer Aspire ZG5 Netbook lying around. In the end this whole project costed me about 60€.

First, a picture of the finished Smartmirror:

20140507_154918

 

Apart from showing the current time/date/weather/news it is also acting as a DLNA Renderer. Networking is done via Wifi.

 

THE HARDWARE

At first I tried the cheaper aproach and put some reflective film onto a normal pane, but sadly the result was also a pain. (Pun intended)

IMG_20140430_102002

This is the first photo of me testing the one-way-mirror sample of my local glasser. Since they had no other one-way-mirrors to cut out mine they took it from the sample and so it costed me only 10€. \o/ I also ordered a frame there.

Mirror Size: 16x23cm

 

IMG_20140430_145355

This is me testing the now cut out mirror. Note that it had to be bigger than the Panel because of the larger Motherboard behind it. This is NOT how it should be. The backlight bleeding and the lack of a sane viewing angle of the panel makes it easy to spot in this build.
The mirror should always be only as large as the panel.

The USB thumbdrive was later replaced with a tinier one. I’ve installed a simple Debian Wheezy on it.

 

20140507_125741

This is the custom-made frame. It costed a whopping 39,50€.

 

20140507_130131

Testing if everything fits inside the frame.

 

20140507_145340

 

To align the panel and keep the light away from everything else I took a piece of black cardboard, cut it to 16x23cm and put a notch for the panel in the middle.

 

20140507_152434

I’ve added some more cardboard to keep everything in place. Also, I cut out a hole for the webcam.

 

20140507_152834_converted

Some more cardboard to protect the panel from the heat of the mainboard.

 

20140507_154511

Mainboard with Wifi antennas built in and fixed with some hot glue.

 

20140507_203849

Planning the backside. It’s made of thicker high quality(?) cardboard.

 

20140507_231813

Finally the finished mirror from the back with holes for ventilation and the power button cut out.
Nobody will ever look at the back side.. right? RIGHT?

Again, hotglue. I seriously hope that this thing will never die on me because I’d have to rip the whole back cardboard apart. 🙁

The speakers were glued to the cardboard, because they sound better that way. Why? Sounding Box maybe? I have no idea.

 

THE SOFTWARE

 

Now to the software. As mentioned in the beginning this machine is running a simple Debian Wheezy installed on a tiny 16GB USB thumbdrive.

I’ve configured another user “smartmirror” which runs everything important. The Display basically shows a fullscreen chromium instance in kiosk mode with fluxbox in an X session without a mouse cursor. Simple, eh?

I’m running the X server with the /etc/rc.local file.

mount -t tmpfs -o size=100M none /home/smartmirror/.config
su smartmirror -c “xinit /home/smartmirror/starter.sh — :0 -nocursor & 2>1 >/dev/null

Here’s the code of /home/smartmirror/starter.sh

#!/bin/bash
xrandr –output LVDS1 –rotate left
#sleep 5
xset s off
xset -dpms
xset s noblank
fluxbox &
/usr/bin/chromium “–no-first-run” “–incognito” “–kiosk” “file:///home/smartmirror/smartmirror_light/index.html”

The smartmirror_light html stuff is located in this git repo.

The display is turned off if nothing moved in front of it in the last 60 seconds. I’m doing this with “motion” and the following configuration:

daemon on
process_id_file /var/run/motion/motion.pid
setup_mode off
videodevice /dev/video0
rotate 90
width 640
height 480
framerate 24
minimum_frame_time 0
netcam_tolerant_check off
auto_brightness on
brightness 128
contrast 255
saturation 255
hue 0
threshold 1500
threshold_tune off
noise_level 32
noise_tune on
despeckle EedDl
smart_mask_speed 0
lightswitch 0
minimum_motion_frames 1
pre_capture 0
post_capture 0
gap 60
max_mpeg_time 0
output_all off
output_normal off
output_motion off
quality 75
ppm off
ffmpeg_cap_new on
ffmpeg_cap_motion off
ffmpeg_bps 500000
ffmpeg_variable_bitrate 0
ffmpeg_video_codec swf
snapshot_interval 0
text_double off
webcam_port 8081
webcam_quality 99
webcam_motion on
webcam_maxrate 24
webcam_localhost on
webcam_limit 0
control_port 8080
control_localhost off
control_html_output on
quiet on
on_event_start /usr/local/bin/monitoron.sh

on_event_end /usr/local/bin/monitoroff.sh

It doesn’t save files and also doesn’t provide the livestream of the camera in this config. The only thing it does is running /usr/local/bin/monitoron.sh if it detects motion and /usr/local/bin/monitoroff.sh 60 seconds after the last motion.

Now to the contents of those files:

root@smartmirror-7:~# cat /usr/local/bin/monitoron.sh
#!/bin/bash
export DISPLAY=:0
xdotool mousemove 0 0 && xdotool mousemove 0 1
xset -dpms
xset s off
root@smartmirror-7:~# cat /usr/local/bin/monitoroff.sh
#!/bin/bash
export DISPLAY=:0
xset dpms force off

Yes, using xdotool to simulate a moving mouse is the only way I know to enable the display again.

The DLNA Renderer stuff is done by gmrenderer-resurrect. It even includes a simple init script.

Wifi is done with wpa_supplicant and the /etc/network/interfaces file

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
post-up ifdown eth0
iface default inet dhcp

root@smartmirror-7:~# cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid=”SSID”
psk=NOTTELLINGYOUMYWIFIPASSWORD
}

I think thats it. If you got some questions about this feel free to ask in the comments or msg Hypfer on freenode.

11 Gedanken zu „DIY Smartmirror (A Mirror with a HUD)“

  1. wieso in englisch?
    schämst du dich über die deutsche Sprache?
    es nervt schon, wenn ein deutschsprachiger Blogger plötzlich bei OSBN in englisch Text verfasst.
    Danke für dein Unverständnis gegenüber deine Leser die nicht so Englisch sattelfest sind

    1. Primär weil ich zu faul War diesen Artikel in 2 Sprachen zu schreiben 😉
      Mit Scham und Ignoranz hat das nichts zu tun.
      Dieser Artikel wurde von mir jedoch unter dem englischen original verlinkt. Da macht sich deutsch nicht so gut.

    2. Wieso sollte er sich für die Deutsche Sprache schämen? Das ist doch Humbug. Wenn man bloggt, möchte man ein möglichst großes Publikum ansprechen. Da ist Englisch die erste Wahl, was ich nicht nur nachvollziehen kann, sondern selbst in dieser Form praktiziere. Heute kein Englisch zu können ist für mich einfach nicht nachvollziehbar.

      Zum Projekt: Tolle Idee, die zum Nachahmen angeht. Besonders toll finde ich es, dass du hier auf Linux setzt!

  2. Danke für die Anleitung.
    Ob sie nun auf englisch geschrieben, oder in der deutsche Sprache verfasst wurde ist mir so ziemlich egal.

    Wenn ich mir die Bilder anschaue, und ich muss dazu bemerken, da ist nichts beschrieben was mich sich nicht denken kann, finde ich den Rest ausreichend, denn die Konifgurationsdateien erkläären eigentlich den Rest und da jene in Englisch sind, kommt wohl ein Linux/Unixnutzer nicht drumherum etwas englisch zu lernen 😉

    Also, tolle Anleitung, wenn ich mal Zeit habe, ich habe noch einige alte massiv marode Laptops in Petto, welche das auch ganz Gut mitmachen würden 🙂

  3. Can you share your experience with the reflective film, for example where did you buy it (ebay?), what was the reflective/transmissive ratings, did you apply it directly on lcd screen or on top of a glass etc.. ? Also, how much better is it in regard to your current solution with the one-way mirror?

    1. I applied it to a glass pane and it just looked terrible. Like a reflective film attached to a glass pane and not like a mirror. :/ I threw it away so I cannot give you the reflective/transmissive ratings.

Schreibe einen Kommentar zu haio Antworten abbrechen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.