Feature

Magic Mirror

Raspberry Pi-based Personal Assistant

Lewis Aburrow

Issue 76, November 2023

Image Credit: u/GuyInThe6kDollarSuit

For those of you who have watched The 6th Day movie from 2000 with Arnold Schwarzenegger, you may recall his character getting wished a happy birthday and shown his schedule as he looked into his mirror.

Some twenty years later, science fiction has become a reality as we simply ask our smartphone, Google Hub or Alexa Echo to describe our day ahead. If you’re a maker though, you may not want to settle for a commercially available device and instead want to custom make your own display. In maker Lewis’s case, he made his smart device into a full length mirror that displays all kinds of data from the weather to things such as upcoming Pokemon Go events, Minecraft server stats, Overwatch rating and levels, amd much more.

We caught up with Lewis to find out all the juicy details about his magic mirror.

Please introduce yourself to our readers, Lewis.

Hello, I’m Lewis and I’ve been busy making and breaking (then remaking) things for the last six years. While my formal education might not have included the now desirable STEM subjects, my unquenchable curiosity compensates for that, propelling me to explore every nook and cranny of knowledge that garbs my interest. I'm particularly drawn to topics that ignite someone else's passion because there's something irresistibly infectious about someone speaking passionately about their chosen subject.

This unfortunately results in me spending a concerning, yet enjoyable, amount of time on YouTube in awe of the creative work of fellow makers while contemplating if I'll ever find enough hours in a year to tackle my ever-expanding future catalog of possible projects.

What got you first interested in electronics?

That award goes to my twin brother. Six years ago we were both living in our original hometown (still do to this day in fact) but in separate houses. We had both shared the guilt of not seeing as much of your family as you should when you take them for granted for living so geographically close (like a five minute bicycle distance close).

We decided to spend some time together and the activity of choice, to build something.The project? A machine to mix you a drink on command. Despite being twins, he is far more creative in an organic artistic way whilst was inclined toward the logical and measurable arts, such as computers and mathematics.

We met up weekly and worked on it - it was an enjoyable time and we both taught and challenged each other. About halfway through the build we began to commit it to film (his idea) and then shortly after this he became busy with his own family. But the deed had been done - he had me hooked from the moment he brought his Arduino UNO to one of our evenings.

I had never heard of one before and was instantly struck by the fact I could write simple code, on a low cost machine (remember how I mentioned I have a habit of breaking things earlier?…) and it could sense and interact physically with the real world. A-MAZ-ING!

With his permission I carried on the project and shared its documentation on YouTube. DIY Machines the channel was born. Shouting timidly into the massive void that is the internet meant that it had little reaction at first - but at this point I was making for my own enjoyment and the filming was my documentation and a secondary reward to the finished project itself.

Over time I was lucky that the channel began to flourish and with the support of the unexpected kindness of the internet and my Patreon supporters I am now very fortunate to be able to work on my projects a few days a week whilst working to document them in reliable, reproducible detail for others to recreate and re-imagine.

What was the motivation behind making your digital mirror?

I needed a full length mirror at home and wanted to create something with a little bit of a surprise, a touch of magic to it. I looked at others online but they did not align with what I had in mind. I was looking to include dimmable lighting to ensure you can see yourself well - a key feature of any mirror for sure.(As an added bonus it also helps to improve the quality of the two-way mirrors reflectivity).

The addition of the PIR (Passive Infrared) sensor is aimed at reducing power consumption by turning the screen off for the vast majority of the time no one will be in front of the mirror. This further adds to the magic when a guest pauses in front of it only to be surprised by its hidden features, before promptly being insulated by the mirror's attitude problem!

How does it work and what key components does it use?

The heart of this Magic Mirror is a Raspberry Pi. I used a Pi 3B from an older project and this orchestrates the people detection and the display itself.

This is connected to an old computer monitor via HDMI.

A PIR sensor enables the power saving whilst COB LED lights in diffused aluminium U-shaped channels provide the lighting via a touch button dimmer circuit embedded in the mirrors surface.

The mirrored surface itself is made from an acrylic sheet with two-way mirror film applied. I chose acrylic as I was concerned about breaking glass during the build and wanted to cut a hole for the button into the mirror itself.

Can you tell us more about the Magic Mirror Software. Is that your creation or something open source?

Thankfully, as software is my achilles heel, there is a wonderful and powerful open source project named ‘MagicMirror²’. It’s easy to install the base components onto a Linux computer. To this you can then add your own choice of customisable ‘modules’.

There are a few from the main stock modules provided by the projects creators - along with hundreds more from 3rd party developers. Some serve a large appeal such as for HomeAsisstant, Philips Hue, and Live Train Times - others are more niche such as Fortnite Static displays and Blood Glucose monitoring.

Is there a limit to what information it can display, and what kind of information is your mirror showing?

The creators of the MagicMirror² project created an API which allows for anyone to install ready made modules or create their own. The first limit you’ll come up against is screen space.

My design allows for screens as small as a Raspberry Pi specific display all the way up to repurposing 60”+ TVs. Thankfully, for the smaller displays, you can configure modules which have a time relevancy (such as expected travel time for your morning commute) to only appear at certain times. This then frees up space for other modules at other times (perhaps your meal plan when you return home after work).

We can understand displaying data such as what's playing on Spotify, the weather, etc. but what is shown for gaming apps like Fortnite that you list on your web page?

Modules such as the Fortnite module lists player stats from the game. If you enjoy Age of Empires 2 like I do, there is a module which shows the ranking of specified player IDs from aoe2.net.

There are also modules which show upcoming Pokemon Go events, statistics from your Minecraft server, your Overwatch rating and level, and many more!

There is a maintained list available here: https://github.com/MichMich/MagicMirror/wiki/3rd-Party-Modules

Here’s an example module to show Sydney trains departing from a selected station. Uses raw GTFS data from NSW Transport API.

We love the attitude function. Are those messages random?

Yes, the mirror shows them on a timed rotation. I have mine randomly select a new one each morning - how better to start your day?! The list is a text file so thankfully you do get to curate the level of sass and abuse you can expect.

Was there much in the way of prototyping? And, what design challenges did you need to overcome?

I would love to be able to build a full-scale feature complete prototype of every project off camera before repeating the build again whilst documenting it on camera. I strive to ensure that if someone decides to put their trust in me by going ahead and investing their own precious time and money on the components and building process then it needs to work. However, though my very kind Patreons go a long way to help cover the costs, I’m not yet at the point of building two or more for every project.

When I was starting on my Maker journey I would re-create other people's projects in an effort to expand my knowledge and skill set (I still do this today of course). One particular project's instructional video turned out to skip steps and make alterations to earlier steps off camera without letting you know they had gone back and, for example, added screws to a glued joint because the glue was not suitable later.

This made it near impossible to follow and resulted in my own wasted time and money. As a result of this - I work very hard to ensure my projects are well documented and reproducible. I don’t want anyone else to experience this same feeling. This is why it take me two to three months to produce and share each project - it won’t be shared online until I’m comfortable it is reliably reproducible.

I was able to test certain aspects of this project before committing to the final build. For example the choice of mirrored surface. Early on I needed to decide between buying a pre-cut glass two-way mirror or using acrylic and applying my own two-way / privacy film to it.

In this case I ordered a 10cm squared sample of the glass and an A4 sheet of acrylic and some film to test this. The glass worked well, but I was concerned for its cost and safety. The acrylic was more resilient but it took some time for me to find the best process for applying the film. Several A4 sheets later and you see what is in my final build video.

The selection of tools I use is also something I try to limit. For example, I was hesitant to use the router to create the channels for the LED’s in this project as not everyone has a hand router. Ultimately, after some consideration, I decided that as these LED channels could be omitted if the maker wanted to without affecting the core functions of the project, then I could include the additional tool.

I acknowledge not everyone has a 3D printer either, but one of the main themes for the channel revolves around what you could do with a 3D printer. The prices of 3D printers continue to fall as the quality and speed improves. I really do imagine (and hope) they may become as ubiquitous as inkjet printers in the near future. Ideally the 3D printer of the future would use a more eco-friendly material. - I’m sure many people are working on developing one.

Are there any tricks to using and applying the mirror film? What would you do differently if you were to do it again?

I watched countless other online makers explain how they applied their mirror film whilst looking for the commonality in their instructions. After a while it appeared that cleanliness, liberal application of soapy water between the surfaces and patience was key.

I practised on a couple of A4 sheets of acrylic sheets which I had spare. This was certainly worthwhile. The first application resulted in a lot of air pockets and bubbles. The second A4 practice was much better (I applied much more soapy water and cover the acrylic with the mirrored film just a few cm’s at a time whilst working the air out as I went).

Don’t be afraid to carefully peel it back a short distance and re-apply it if you feel you could do a better job. It’s better to get the air out as you see it then try and scrape it out after the application of the film is complete.

By the time I got to the final application on camera I managed a near ideal application. There certainly are little air bubbles which remain but due to the mirror's size they are not immediately noticeable.

You mention a web based tool to help make configuring additional modules easier. How's that coming along?

Oh wow, so that has proven trickier than I expected! As I said earlier, software is my achilles heel but I thought it would be a good idea to corner myself with a challenge. (Lesson learnt!)

I had a basic version working (https://www.diymachines.co.uk/magic-mirror-module-configuration-creator) but realised as I delved deeper that the sheer number of possible modules multiplied by their number of unique possible configurations presented a bigger problem than I had envisioned.

My development on that is paused for now and I hope to return to it in the future as my skills continue to grow.

Could makers make a similar mirror but use a much smaller monitor, frame and mirror?

Absolutely. It is a very scalable project. Mine is rather large because I wanted a full length mirror. A large TV was something I had considered installing in a portrait orientation but the project as a whole was becoming surprisingly heavy. This is why I switched to a smaller computer monitor positioned near the top.

If you didn’t want to do much wood working you might consider buying a picture frame you like. This would provide the frame and glass/plastic. Simply apply mirror film to this and then find a suitable screen. I believe there may even be apps for tablet computers you could use as a way of repurposing an old tablet.

It's great to see that you've used your 3D printer to improve the appearance of your LED strips, PIR and air vents. What's your 3D printer of choice and why?

3D printers are amazing. To me it still feels like magic when you submit a print before heading to bed to then wake up and find a physical object fabricated with such a procession on your desktop at home.

My very first 3D printer was a ‘Buccaneer’ by a company called Pirate 3D. They became a very famous example of the dangers of backing projects on Kickstarter. They raised $1,438,765 from over 3,500 backers but ultimately failed to deliver all but about 40% of the backers' rewards. I was very fortunate to receive one, though it was a little troublesome to use. It had sparked a flame in me similar to when my brother showed me an Arduino Uno years later. I was hooked again.

After almost a year it broke but I now knew it was something I wanted to continue using. I saved up some money and with some help from my partner bought myself my very first Prusa. An i3 Mk2.

This was a step-change in performance and ease of use. Having built it from a kit bought from Prusa Printers I also knew how to maintain and repair it myself. Over the years I upgraded it to a Mk3’s and now have traded that in for a Mk4. I think it’s a wonderful machine. Whenever I have needed support or advice, Prusa has just been an instant chat message away. OEM and 3rd party spares are common and the large and friendly user base provides a remarkable hive mind of advice.

I also have an Elegoo Neptune 4 Pro but, though it has no specific issues, I find myself turning to my Prusa in the first instance each time. PrusaSlicer is well maintained and feature rich, its close tie-in with Prusa Connect (their online printer management software) helps me effortlessly manage print queues, which in turn effortless interfaces directly with the printer over WiFi.

If someone wants to build something similar, where is the best place for them to get all of the build instructions?

I highly recommend my instructional video. I consider this the main instruction set and is what I spend most of my time on when documenting any of my projects. (http://youtube.com/diymachines). If you prefer detailed written instructions supported by photos then I also document my builds on Instructables:
https://www.instructables.com/member/DIY+Machines/

If you encounter any issues you’ll find a super supportive and kind group of fellow makers on my Discord server. https://discord.gg/BcdPvPDw34

Is there anything that our readers should know that we haven't already covered?

On every PCB which I design you’ll find an inspirational quote which I believe in. I would also like to say - if you're new to making and are yet to begin your first project I strongly encourage you to take a leap of faith in yourself and just start doing. You will make mistakes, but it’s always better than making nothing.

Finally, where do you go for your inspiration? Do you have any influencers or websites you frequent?

Inspiration comes to me from everywhere and everyone. Sometimes it’s a thought that just springs to mind, others it’s when I sit down and try actively thinking about what the next project might be. I keep a list in Trello on my phone so I can add to it wherever I am.

I follow a lot of other makers. A few examples would be ‘Wintergatan’ who's approach to verifying design ideas and the occasional nugget on useful ways to use Fusion 360 are welcome.

I’m a big fan of Adam Savage (Adam Savage’s Tested) and enjoy learning about his making and general life advice during his Q&A sessions. I genuinely would love to spend some time as his assistant in the hope some of his wisdom and ethos might rub off on me.

The ‘DroneBot Workshop’ channel provides somewhat dry but both high quality and highly informed information and examples on a large variety of electronic devices and concepts.