Make A Magic Mirror Display Your Weather Conditions using an API

Wouldn’t it be cool to build your own “Magic Mirror”? In case you haven’t heard of them, a Magic Mirror is a frame that holds a one way mirror, but behind that mirror is a flat screen monitor which you can use to display whatever interesting information you desire. Some popular ideas include but are not limited to:

1. The weather: it’s good to know if it will rain or if a cold front is coming through

2. Your calendar: it can remind you of any appointments or deadlines coming up

3. The news: filter your news feed to your favorite sports team or by local news

4. Traffic: display a google map with your route shown and any issues with slowdowns

Magic mirrors can display a great deal of information.

If this sounds like an awesome idea to you (and why wouldn’t it!) then you don’t need a mainframe computer to run it, you can simply use a Raspberry Pi.

A Raspberry Pi is basically a tiny computer, it’s about the size of a credit card.
Despite it’s compactness it’s fairly powerful and very popular with people making custom projects like video game emulators, media servers, drones, and you can even cluster several Pis together!

Once you have the mirror, frame, monitor and Raspberry Pi all assembled together, you need to make sure all the software is downloaded and installed.

Raspbian is the operating system that will run your Pi, and Chromium is the web browser that will be configured to run as a kiosk. Since the Raspberry Pi has built in wifi, you don’t need to worry about running a network cable to the mirror.

We’ll also need to have Apache installed as the web server that will host our page. Finally, there are several good dashboard choices we can use such as MichMich’s Magic Mirror on Github.

Finally, we change the weather settings to reflect our location. This is what the configuration looks like:

params: {
 q: ‘Tampa,Florida’,
 units: ‘imperial’,
 lang: ‘en’,
 APPID: ‘<insert your API Key here>’

The free API key can be obtained from OpenWeatherMap.

Just save and exit, then you won’t be taken by surprise from the weather gods.

Show your support

Clapping shows how much you appreciated Moises Vargas’s story.