Browsed by
Category: NerdProject

Building a magic mirror – Part 1 – The project

Building a magic mirror – Part 1 – The project

For this post, I thought I would share a project I’ve been working on for my family. For our family, we have a marker board in the kitchen that helps keep track of everything going on for myself, my wife and our kids. And while this is great in practice and does help. The fact that this is analog has been driving me nuts for YEARS. So I wanted to see if we could up this with a magic mirror.

Now I have a magic mirror in my office that I use to help stay focused, and I have here how I manage it via Azure Dev Ops. But I’ve never really done a post detailing how I built this mirror for those interested.

First Hardware Requirements:

In my case I’m using an old Raspberry Pi 3 that I happen to have just sitting around the office, and I’ve installed the Raspberry Pi linux OS on that device.

Outside of that, I’ve got the basics:

  • Power supply cable
  • HDMI Capable
  • Monitor
  • 64 GB Micro SD card
  • SD Card Reader

Now I have plans to hook this to a larger TV when I set it up in the kitchen, but for right now I’ve just got a standard monitor.

Goal of the Project

For me, I found this video on YouTube, and thought it was pretty great, so this is my starting point for this project.

Setting up the Raspberry PI – Out-of-the-Box

To download and install the OS, I used the Raspberry Pi image manager found here. I used the SD card reader I had in the office to format the SD card, and then install the OS.

Once that was completed, I booted up my raspberry pi, and finished the setup which involved the following (there is a wizard to help with this part):

  • Configure localization
  • Configure Wifi
  • Reset password
  • Reset Hostname
  • Download / Install Updates

Finally, one step I did to make my life easier is to enable SSH to the raspberry pi, which allows me to work on it from my laptop rather than setting up a keyboard / monitor / mouse permanently.

You do this by going to the “Settings” on the Raspberry Pi, and going to the “Interface” tab, and selecting “Enable” for “SSH”.

Now that my Raspberry Pi is running, we come to the meat of this, and that’s getting the magic mirror running:

Step 1 – Install Node.js

You need Node.JS to run everything about the magic mirror, so you can start by running these commands against your raspberry pi:

curl -sL | sudo -E bash -
sudo apt install -y nodejs

From there, I cloned the magic mirror repo to Raspberry Pi.

git clone

Then enter the repo from the command prompt:

cd MagicMirror/

Then you need to install NPM to be able to work with the MagicMirror installation. This takes the longest, and the first time I ran this I actually had to use sudo to make sure it completed the install.

sudo npm install

A good recommendation from the magic mirror site is to copy the default config so you have a backup. You can do that with this command:

cp config/config.js.sample config/config.js

Finally you can start your MagicMirror with:

npm run start

Now, the next part was tricky, if you reboot your RaspberryPi, the magic mirror will not start automatically, and you need to do some more configuration to make that happen. Most documentation will tell you to use pm2, and I would agree with that, but if you try to run the commands on the most recent Raspberry Pi, you’ll find that pm2 is not installed. You can resolve that with this command:

npm install pm2 -g

Then run the following commands to configure your MagicMirror to run on startup.

pm2 startup

After running this command you will be given a command to run to enable pm2 on startup, run this command.

Then run the following:

cd ~

Put the following in the file, and then hit Ctrl-X then Y

cd ~/MagicMirror
DISPLAY=:0 npm start

Finally run these commands to finish configuration

chmod +x
pm2 start

pm2 save
sudo reboot

After that you’ll see your monitor displaying the default configuration for the MagicMirror.

Next post I’ll walk you through the steps I took for configuring some of the common modules to get it working.

Cool Nerdy Gift Idea – Word Cloud

Cool Nerdy Gift Idea – Word Cloud

The holidays are fast approaching, and this year I had a really cool idea for a gift that turned out well, and I thought I would share it. For the past year and a half, I’ve had this thing going with my wife where every day I’ve sent her a “Reason X, that I love you…” and it’s been a thing of ours that’s been going for a long time (up to 462 at the time of this post).

But what was really cool was this year for our anniversary I decided to take a nerdy approach to making something very sentimental but easy to make. Needless to say, it was very well-received, and I thought I would share.

What I did was used Microsoft Cognitive Services and Power BI to build a Word Cloud based on the key words extracted from the text messages I’ve sent her. Microsoft provides a cognitive service that does text analytics, and if you’re like me you’ve seen sentiment analysis and other bots before. But one of the capabilities, is Key Word Extraction, which is discussed here.

So given this, I wrote a simple python script to pull in all the text messages that I exported to csv, and run them through cognitive services.

from collections import Counter
import json 

key = "..."
endpoint = "..."

run_text_analytics = True
run_summarize = True 

from import TextAnalyticsClient
from azure.core.credentials import AzureKeyCredential

class KeywordResult():
    def __init__(self, keyword, count):
        self.keyword = keyword
        self.count = count 

# Authenticate the client using your key and endpoint 
def authenticate_client():
    ta_credential = AzureKeyCredential(key)
    text_analytics_client = TextAnalyticsClient(
    return text_analytics_client

client = authenticate_client()

def key_phrase_extraction(client):

        if (run_text_analytics == True):
            print("Running Text Analytics")
            with open("./data/reasons.txt") as f:
                lines = f.readlines()

                responses = []
                for i in range(0, len(lines),10):
                    documents = lines[i:i+10]
                    response = client.extract_key_phrases(documents = documents)[0]

                    if not response.is_error:
                        for phrase in response.key_phrases:
                            #print("\t\t", phrase)
                            responses += [phrase]
                        print(, response.error)
                # for line in lines:
                #     documents = [line]

                with open("./data/output.txt", 'w') as o:
                    for respone_line in responses:
            print("Running Text Analytics - Complete")
        if (run_summarize == True):
            print("Running Summary Statistics")
            print("Getting output values")
            with open("./data/output.txt") as reason_keywords:
                keywords = reason_keywords.readlines()
                keyword_counts = Counter(keywords)
                print("Counts retrieved")

                print("Building Keyword objects")
                keyword_list = []
                for key, value in keyword_counts.items():
                    result = KeywordResult(key,value)
                print("Keyword objects built")

                print("Writing output files")
                with open("./data/keyword_counts.csv","w") as keyword_count_output:
                    for k in keyword_list:
                        print(f"Key = {k.keyword} Value = {k.count}")
                        key_value = k.keyword.replace("\n","")
                        result_line = f"{key_value},{k.count}\n"
                print("Finished writing output files")
    except Exception as err:
        print("Encountered exception. {}".format(err))

Now with the above code, you will need to create a text analytics cognitive service, and then populate the endpoint and the key provided. But the code will take each row of the document and run it through cognitive services (in batches of 10) and then output the results.

From there, you can open up Power BI and point it at the text document provided, and connect the Word Cloud visual, and you’re done. There are great instructions found here if it helps.

It’s a pretty easy gift that can be really amazing. And Happy Holidays!

MagicMirror on the Wall

MagicMirror on the Wall

So lately, my wife and I have been going through a spending a lot of time organizing different elements of our lives. Specifically Covid-19 has created a situation where our lives are very different than what we are used to previously. And it has caused us to re-evaluate the tips and tricks we used to organize our lives.

One such change has been the need to coordinate and communicate more with regard to the family calendar and a variety of other information about our lives. So I decided if we were going to bring back “The family bulletin board”, that I wanted it to integrate with our digital footprint and tools to make life easier.

After doing some research, I settled on MagicMirror, mainly because of articles like this. And I had a spare monitor, with a Raspberry Pi 3 lying around the office, so I figured why not. The plan was to implement the initial prototype and get it working in my office, and then invest in something better for my wife to help manage everything.

So I have to admit, this was surprisingly easy to setup. And did not require much in the way of effort. I was even able to automate pushing updates to this device pretty easily. So if you are looking for a cheap option for getting something like this working, I recommend MagicMirror.

Here’s the current state of the PoC:

So for a walk through, I went through the following steps:

  • Download Raspbian OS, and flash the Micro SD card using Etcher.
  • Put the Micro SD into the Raspberry Pi and boot it up. From there you will get a step-by-step wizard for configuring wifi and setting up passwords, etc.
  • From there, I executed the manual installation methods found here.

That was really it for getting the baseline out of the box. From there I had a nice black screen with holidays, date/time, and a few other widgets. From there the next step was to install the widgets I cared about. You can find a list of the 3rd party widgets here.

Now I wanted MagicMirror to load up on this monitor without me having to do anything, so I followed the steps here. I did make some additional modifications from here that helped to make my life easier.

The one problem I ran into was the process of updating the device. I could have just remoted into the device to execute updates to config files, and other scripts. But for me, this was frustrating, I really want to keep configurations for this kind of stuff source controlled as a practice. So I ended up creating a github private repo for the configuration of my MagicMirror.

This worked fine except for the fact that every time I needed to update the mirror, I had to push a file to the device, and then copy it over and reboot the device.

So instead what I ended update doing was building a CI/CD pipeline that pushes changes to the magic mirror.

So what I did was the following:

  • Create a blob storage account and container.
  • Create a ADO pipeline for my GitHub repo.
  • And added only one task to my repo:
- task: AzureCLI@2
    azureSubscription: '{Subscription Name}'
    scriptType: 'bash'
    scriptLocation: 'inlineScript'
    inlineScript: 'az storage blob upload --connection-string $BLOBSTORAGE -f configdev.js -c test -n configdev.js'

Now whenever I push an update to the master branch, a copy of the config file is pushed directly to blob storage.

Now came the problem of how do I get the device to pull down the new config file. If you look at the instructions about for making Magic Mirror auto start, it mentions an file, which I updated to be the following:

cd ./MagicMirror
cd config
curl -0 https://...blob url.../config.js
cp config.js
cd ..
DISPLAY=:0 npm start

Now with this update the magic mirror will pick up a fresh config on every restart. So all I have to do is “sudo reboot” to make it pickup the new version.

I’m going to continue to build this out, and will likely have more blog posts on this topic moving forward. But I wanted to get something out about the beginning. Some things I’ve been thinking about adding are:

  • Examine the different types of widgets
  • Calendar integration
  • Google Calendar integration
  • To Do Integration
  • Updating to shut off at 8pm and start up at 6am
  • Building ability to recognize when config has been updated and trigger a reboot automatically

Remote Gaming – Lessons Learned

Remote Gaming – Lessons Learned

So I’ve made no secret on this blog of my interest in gaming. And how its been something that I’ve picked back up over the past year. And I have to say the one positive that came out of the many changes COVID-19 has caused in our families life is how much we’ve embraced gaming.

About 18 months ago, I joined a small group of friends and we decided to take a stab at gaming more. And we started with Dungeons and Dragons, and playing a game night once a month.

See the source image

Now it started out great, I will admit we had a lot of fun. But the hardest part was organizing everything. From scheduling with everyone’s busy schedule, to location, child care, etc. Which honestly was a pretty difficult, coordinating the schedules of 8 adults all of which have kids.

When COVID-19 hit, we all found ourselves stuck at home, and everyone’s plans dropped. And honestly it took our monthly game night, and made it a weekly game, and its been really great. We’ve gotten much closer as friends, and honestly it gave all of us something to look forward to every week.

So that being said, we did it by taking our game and going virtual with it. And for this post I thought I would share the setup and how we took our game virtual. You don’t have to be playing dungeons and dragons, but its a great way to reconnect with people. A great side note is that we had a friend, who work took away from our area, who we used to see once a year, I now see him and game with him every Saturday, and have for the past 3 months.

Break out the Digital Tools:

For our team, we really started using the following tools to help make our game go digital and be as much fun as it was in person:

  • DND Beyond – This one to be fair we were using before the pandemic. But its become more important than before. We track our character sheets here.
  • Roll20 – We started using Roll20 to handle the digital game board. This is a great tool for managing your games and letting things play out on maps.
  • Facebook Messenger – We use this to handle the video calls, and honestly did because of familiarity of other members of our group. And things have worked pretty well, especially with Facebook rooms.
  • Discord – We leverage this tool to consolidate our chat during the game, and it’s been great. My players are able to talk, share handouts, or have direct conversations with me directly during the game.
  • OneNote – We created a shared notebook, where the players share their notes with each other to their benefit.

As I mentioned it’s been really helpful to be able to find new ways to connect as we deal with the uncertainty, and I definitely recommend stepping out of your comfort zone and finding news ways to engage, even in this crazy new world.

Stem with Kids – Quarantine

Stem with Kids – Quarantine

So for something completely different. My family and I have been making sure that we do some STEM activities with our kids.  And if you’re like me, they are just as much fun for me as they are for the kids.

So I feel very blessed, in that both of my kids are very analytical, and that really means for me we get to do a lot of fun things that take me back to my childhood.

When I was growing up, I came from a family of educators, going back 3 generations. So education is something that has found its way into all aspects of our lives. And I’m very thankful for that because my brother and I grew up with a love for learning written into our DNA.

The other thing I grew up with was technology, and my dad had computers in our house from the earliest parts of my childhood. So I try to find activities that really flex that logical, analytical part of their brain. So here are some of the things that we do for this type of activity.

Legos and Building toys

I’ve made no secret that I’ve been a fan of Legos from when I was a kid. And honestly there is so much to do with kids for this. The most important key to success here is that you need to instill this idea that they get to enjoy the act of building.

For my kids from an early age, we drilled into them one saying “the best part about Legos is you get to build it again.” and this has instilled an idea that for my kids that the act of building is the fun part, and now I can honestly say I think they enjoy building more than playing with the models.

The other key here is what we don’t do, our kids can save 1 model they build, that’s it. The rest are broken down to start again.  What this does is makes them focus on building more. We take pictures of their creations and they get to keep those. And celebrate the effort, not the result.

We do this with other toys, my daughters personal favorite are magnatiles.  And encourage them to build and then have them take pictures.


This was a new one for us, but it was fantastic. We got my daughter the littlebits music inventor kit which can be found here. And it was amazing. It comes with wires, and electronic components but they are connected using magnets. The app gives easy to follow videos that let the kids walkthrough building the circuits and devices.

But more than that, they then have activities to do after, which I thought was pretty great. After my daughter built a synthesizer guitar it had video lessons on how to play it that added extra value to the experience.

Problem Solving Challenges

Another thing honestly is that we do a lot of problem solving challenges. Things like asking the kids to solve a problem. Part of the idea is to encourage our kids to see a problem and try to figure out ways to solve it.

His can include giving them specific Lego challenges that they need to build and testing the results. This further encourages grit in our kids by pushing them to try and solve it and encouraging the effort and not just the result.


This one is great for when they really want to build their imagination. Honestly the educational value of minecraft is pretty well documented, but it’s a great place for kids to build without resource constraints.

I’ve watched my kids build some amazing structures in minecraft just by giving them a random idea. Things like:

  • Build a bridge
  • Build a tower
  • Build a train and train station
  • Build a batcave
  • Build a warehouse for your stuff

And these type of actions can give your kids just enough direction to go and let their imagination run wild.

Craft station

So for our kids we find the best option possible to facilitate creativity, and that includes creating a art station for my daughter with a mix of different options. Her art station includes an easle and paper and items like the following:

  • Paints
  • Markers
  • Pencils
  • Colored Pencils
  • Stamps
  • Inkpads
  • Stencils

The end goal of this is to task our kids with creating things rather than consuming.


Another great activity to help kids with STEM is just cooking. Cooking involves the following:

  • Thermodynamics
  • Heat and transferance
  • States of matter
  • Physics
  • Measurements
  • Following directions

Cooking is a fun activity that fosters creativity and science. It’s a great simple activity that can make sure to stimulate their brains.

Those are some of the things that we do to pass the time and engage in stem activities with the kids. And honestly they have led to some of the best memories with my kids. And feel free to comment with what activities you are doing.