Magic Mirror with Intel Compute Stick
Joe Angell
Update: November 26th, 2017
It's been two months, and so far everything is working perfectly. I haven't had to restart the browser at all, while with the Pi/Chromium pages would just stop updating and I'd have to either refresh the page or restart Chromium itself. Windows updates automatically trigger in the middle of the night, and since I was able to get Chrome to launch on startup properly I don't even need to be aware that it happened. I can treat the mirror as just another appliance, which is how I want it to work -- I have enough computers to keep maintained.
The only issues I had were very minor and easily resolved. A few late Windows post-install messages that would pop up in the first few days, but they were dismissed easily . A Windows update once opened a dialog in the screen to let me know it was going to automatically reboot in the middle of the night, but I haven't seen any of those since. AirPlay doesn't really work, but the speakers are so bad in that TV that it hasn't been much of a concern. I haven't had any problems beyond that.
The Compute Stick does have a fan. Since I moved it to the outside of the mirror in an attempt to improve wifi signal strength, I hear it a bit more in a dead-quiet bathroom in the morning. I actually thought it was the neighbors vacuuming, and that the sound was just barely coming through the walls, but it was just the stick. Moving it back into the mirror case would probably completely silence it, but I haven't had a reason to mess with it just yet.
Overall, I'm quite happy with my switch to the Compute Stick. I find Windows much easier to use than Linux, and I was able to get it to do what I wanted it to do very quickly. Some people like Linux, and want as lean as a system as they can get, but I just want something that will do what I want it to do with as little hassle as possible, and here that was the Intel Compute Stick running Windows.
September 10th, 2017
I've had a customized version of Michael Teeuw's Magic Mirror running on a Raspberry Pi 2 for a couple of years now. I was never happy with the Pi, though. It takes about 3 minutes to boot to the desktop, it's slow, Linux is just generally a pain to deal with, and I kept getting random failures that were difficult to track down in Chromium due to the aforementioned slowness.
After a particularly annoying week of errors, I decided to replace the Pi with a second generation Intel Compute Stick with an Atom x5 processor running Windows 10. The biggest down side is cost, as the $125 price tag is more than four times that of the Pi. However, it is much faster than the Pi, has built-in wifi (I don't need to buy a wifi module, although the Pi 3 does include wifi these days), 32 GB of onboard storage (I don't need to buy an SD card) and because it runs Windows, networking, file sharing, LAN access and so on are much simpler to deal with.
Costs
The Pi 2 Model B costs $35. Pi 3 Model B is the same price, and includes wifi, but if you have a Pi 2 like I did it'll be another $10 for a USB wifi module. You may also need a power supply (~$10), unless you can run it off USB. You will need a micro SD card (~$10) to install the OS on. You're looking at a minimum of $45, and up to $65.
The Intel Compute Stick I got costs $125 on Amazon. It includes wifi, Bluetooth, a case, and an SSD, as well as a USB power supply. You don't need any other parts. So while the Compute Stick is about 3x-4x more than a Pi, it is actually closer to 2x-3x depending on the accessories you need to get. This still gives a nice cost savings to the Pi, but at the expense of having to fiddle with more components and generally slower hardware.
You can also get an Intel Compute Stick that comes with Ubuntu Linux instead of Windows, which brings the price down substantially because you're not paying for the Windows license. I specifically did not want to use Linux, which is why I got the Windows model.
Windows vs. Linux
Which brings us to the "cost" of Linux vs Windows. I'm comfortable with Windows, having used it in some form for more than 20 years. I'd prefer macOS, but I can't justify the cost of cramming even the cheapest a Mac mini behind my mirror. Overall I find that macOS is the easiest OS to use, and would do everything I want for the mirror with less trouble than Linux or Windows, but Windows is a reasonably close second. Linux is a distant third due to the need to edit config files, and manage anachronisms like a case-sensitive file system, and how things never seem to quite seem to work right out of the box (for example, getting it to reconnect to wifi automatically, which you'd think it would just work, but apparently it doesn't without a bunch of tinkering).
I admit that my familiarity with both Windows and macOS biases me towards them. But even so, I didn't have to do a lot of research to make things work in those -- every issue I encountered was solved with some simple googling and easy steps, usually directly from the UI. I found that on Linux it took a lot more googling and tinkering to get things working at all. Maybe if I was more familiar with Linux I wouldn't be so annoyed with it, but it seems to try pretty hard to make me not like it.
All told, it took me about 3-4 hours to convert from the Pi to the Compute Stick, including setting up Windows, doing Windows updates, installing all the software, customizing it, getting everything to auto-login and launch properly, physically mounting the hardware in the mirror, and writing most of this article.
Setup
There are still a lot of little switches to flip, but it's pretty much all through the Windows UI, and doesn't require editing any configuration files.
To do the initial configuration, I plugged the Compute Stick into my A/V receiver, and plugged in its USB power supply, using a normal TV for the display. I used the wireless keyboard and mouse that I was using on the Pi to set it up, which uses up one USB port on the Compute Stick.
Next was setting up Windows 10. It's worth noting that the Compute Stick does support 64 bit Windows, but defaults to 32 bit; you can change this from the BIOS, but I didn't notice it when I was doing my my setup so I just went with the 32 bit install. I don't think it really matters for this application. The full Windows installation was under 10 minutes of following the instructions. Nothing special here. I also updated and set up the Intel Remote Keyboard, which comes pre-loaded and lets you control Windows from a mobile device with a free app. Mouse movement is a little slow and seems to pause before it starts moving the cursor, but otherwise it seems fine.
The next step is downloading Chrome, so that I can run the page in kiosk mode. The Atom processor is zippy enough (I mean, it's no Core I7, but it's more than fine for a mirror), and is x86 compatible, so it runs all standard Windows software -- I just grabbed the normal x86 version of Chrome from Google's site. It's possible there there's a kiosk mode in Edge that I could have used Edge (I didn't look into it), but since I use Chrome to develop my Magic Mirror variant on my PC, I thought I'd use the same browser here.
The last thing to install is the Apache/PHP stack via XAMPP. I did a standard install without changing any options, which put XAMPP into C:\XAMPP. It took about 15 minutes to finish the installation.
While that ran, I set up file sharing. No more SFTP -- I can just copy files across the LAN with Explorer. They do make you run around a bit to set this up, though. FirstI had to go into the Wifi settings and toggle Make this PC discoverable so that it would show up on the LAN for other machines through Finder/Explorer. I also had to go into Advanced sharing settings in the Network and Sharing Center and toggle Turn on file and printer sharing, as explained here. Finally, I went to the C:\xammp\htdocs in Explorer, got Properties, went to Advanced Sharing, and shared that directory with read/write access for my account. Now I could easily copy new files over right from my development machine.
I wanted Windows to boot right to the desktop, so I setup automatic log in by following these instructions. This requires a small change to the registry, and is pretty straight forward. I think it was the same process 15 years ago, too.
The last important change was disabling display sleep from the Windows Power & sleep settings so that the display stays on all the time. The Compute Stick also has a power saving setting in the BIOS, but it's disabled by default. I also disabled Windows notifications, since I didn't want them popping up over Chrome.
I made a few other minor tweaks, like changing the name of the Compute Stick to "MagicMirror" so I could more easily find it on my LAN. I didn't bother setting a static IP for it like I did for the Pi, since I could easily access it by its hostname.
Testing
After copying my the MagicMirror directory to the Compute Stick, I launched Chrome and tested it out by going to localhost:MagicMirror . In far less time than Chromium on the Pi, I saw my mirror page running perfectly.
To automatically launch XAMPP on startup, I tried just adding a shortcut from C:\xampp\xampp-control.exe to the Window 10 startup folder, as described here. I launched the XAMPP control panel and set it to automatically start Apache whenever it opens, and to minimize itself on opening. I did the same thing for Chrome, adding a shortcut and changing its Target field, to end with --kiosk http://localhost/MagicMirror. Double-clicking that icon launched the mirror page just as it had on the Pi, without any window decorations around the page.
Unfortunately, after rebooting the machine I found that XAMPP launched after Chrome, so initial I saw that the page wasn't reachable in Chrome. Luckily, Chrome figured out the problem and once XAMPP launched it automatically reloaded the page. However, XAMPP's control panel did not launch minimized as I had instructed, so it covered Chrome's window.
I decided to fix this with a simple Windows batch file that I placed in the Windows startup directory, and removed the two.
::Start XAMPP, which starts Apache START /b /DC:\xampp xampp_start.exe :: Wait 20 seconds for Apache to start up. We probably don't have to wait this long, but it doesn't hurt. TIMEOUT 20 :: Launch Chrome in Kiosk mode pointing to the Magic Mirror page "C:\Program Files\Google\Chrome\Application\chrome.exe" --kiosk http://localhost/MagicMirror
That worked perfectly.
I also noticed that the mouse pointer doesn't hide automatically in Chrome on Windows. To fix this, I installed AutoHideMouseCursor. Its simple, it automatically launches when you boot Windows, and it has a configurable timer.
Final boot times are 21 seconds to the login screen, 35 seconds to the desktop, 55 seconds to my batch file, and 1 minute 15 seconds to a fully running Magic Mirror (mostly due to the 20 second delay I imposed in my batch file.. On the Pi, it would take 3 minutes just to get to the desktop, and another minute or two to get Chromium up and displaying the mirror page.
AirPlay Support
I installed LonelyScreen's Airplay receiver so that I could stream audio from my phone to the mirror. Installation was easy, and it worked fine out of the box. The only thing I did was rename the AirPlay identifier from LonelyScreen to Magic Mirror. It automatically restarts on launch, and although it does open a window on startup it is covered with Chrome's window, so it's no problem.
It seems that LonelyScreen doesn't support controlling the volume from the iPhone, though; it just plays at a constant volume level. That's a bit of a problem when I don't have any other easy way to control the volume of the TV or Windows. Since I rarely use the mirror for AirPlay anyway (the speakers aren't exactly high quality here), I just left it as is for now. There are a number of other AirPlay receiver solutions out there, some free and some paid, that I can try in the future if I decide to go back to this, but if I'm going to pay for something I'll probably buy some decent Bluetooth or AirPlay speakers instead and have better sound quality to boot.
Final Setup
Before I put the Intel Compute Stick in the mirror housing, I installed the remaining Windows updates. The main bottleneck seemed to be the download speed, but it did eventually finish and install itself.
Before unplugging the stick from my A/V receiver, I went to the Windows Display settings and changed the Orientation to Portrait mode, thus matching the rotated TV I'm using in the mirror. You can't set this at the BIOS level like you can with the Pi, so the initial boot screen will still be in landscape orientation, but that's not something expecting to see often anyway.
I couldn't rely on the USB port on TV for power as I did with the Pi, as the Compute Stuck draws more power. Luckily I had installed two power outlets behind the mirror, so I was able to plug its 5v 3A USB power supply in there. A bonus of this is that if I needed to turn off the TV, the Compute Stick wouldn't have lost power as well, as the Pi does when I had it powered from the TV. The wall outlet is recessed, so I used a short extension cored to make it fit, and tapped the USB power supply to the wall above the outlet. The Compute Stick has a case, so I didn't have to worry about it shorting against the monitor's metal shielding like with the Pi, and I simply used 3M VHB tape to stick it to the metal shielding of the TV.
Another nice feature of the Compute Stick is that it turns on as soon as it receives power. This meant that I didn't need access to the stick to turn it on manually, and if I lost power it would reboot itself without intervention.
WiFi Speed
The Compute Stick comes with a short HDMI extension cable, which I used to connect it to the TV, as there wasn't enough room otherwise. With everything installed and mounted, I went to fast.com to test the download speed, but it only reported about 5 Mbps to my router (and my 250 Mbps internet connection). This was likely due to the Compute Stick sitting between the wall and the metal shielding of the TV, both of which are probably interfering with the wifi signal just like it did with the Pi. 5 Mbps was fine for downloading the small bits of information used by the mirror, but Windows updates, Chrome updates, Remote Desktop and AirPlay streaming all require a more reliable connection. For AirPlay and Remote Desktop, it's not so much about bandwidth as it is about lost packets.
On the Pi I was able to use a USB extension cable to run the wifi module outside of the mirror. For the Compute Stick I bought a 3' HDMI extension cable, and moved the entire stick outside of the mirror, where it wouldn't be visible. This also helped keep it cool by moving it away from the hot back of the TV (the Compute Stick has a small, quiet fan in it to keep it cool). As for wifi speed, this only increased it to around 9 Mbps. Better, but much slower than my iPhone 7 Plus gets when placed in the same location. I didn't think to test the speed while I was setting it up in my office, so I'm not sure what it runs at under more ideal circumstances. This is good enough for now, though, as the mirror webpage works fine.
Overall, I'm happy with the final result, the simpler maintenance and better performance I'm getting from the Intel Compute Stick and Windows, so I think it was worth it.