Close
0%
0%

Juliet Magic Mirror

An IoT device that displays the weather, news, time, and can play music: all on a beautiful, clean interface

Similar projects worth following
Juliet is a "magic mirror" which is able to display information like the weather, news, and the time on a mirror surface. By using an LCD screen behind a piece of two-way mirror and setting the background to black, we can make the mirror look reflective, while text on the screen shines through.

The LCD screen is powered by a Raspberry Pi running a python script which controls the Linux framebuffer, allowing full control over the whole screen using the pygame library.

Plans for the mirror include sound responses (show the time if a clap is heard), dimming lights in the room based on motion detected on a camera, displays for basic information (weather, time, news, stocks, etc.), and event notifications / calendar integrations.

To start, let me shed some light onto some of the problems that Juliet aims to solve:

  • There is no simple, cheap, clean interface for showing information in a condensed fashion
  • There is no cheap way to easily control simple home automation such as lights and music
  • The interface must be responsive and able to highlight details of the information provided
  • There are no fully modular and open to expansion solutions available

So with the problems outlined, here's what I intend the project to become:

  • An interface for showing basic information that is useful for the current day (weather, news, stock tickers, interesting quotes, upcoming TV shows, traffic monitor, etc.)
  • Be able to dive deep into these modules to get more information from them (weekly forecasts, temperature high/lows, wind speed, for a weather example)
  • A controller for basic house functions (turning off/dimming lights when no motion on the camera is detected, thermostat control)
  • An easy to install and build device that is configurable to the end user's specifications
  • A cheap but nice looking panel which can be installed in under an hour or two
  • And last of all, I really want this to be as modular as possible so that other users can fork and expand on the software to add their own modules

Ideally this device would be placed somewhere in the open that gets seen a lot, such as in a kitchen or a hallway to a bathroom or similar. This would be best as the user would constantly get updated with information as they live their lives normally.

Some things that I don't intend for this device to become (at the moment, who knows what the future holds :) )

  • Voice command listening device - it seems like other products are already moving into this space... but perhaps adding inter-operability is an option. Right now the voice processing seems a little too complex, comparable to a news module which is simpler to implement and offers more information
  • Complete home automation - I don't have any plans for integrating a smart toaster or whatever crazy IoT technology strikes your fancy... perhaps when the project is more mature you could add your own implementation! :)
  • Security device - This one I'm on the fence on. Maybe there could be an implementation for quick locks (or some RFID door opening device), but I don't think that the main goal of the project is home security.

Here's the first prototype video of the weather module with the mirror mounted to the LCD screen:

So without further ado, here's the current software breakdown of the project (as of 3/18/16)!


The Python program can be broken up into multiple subsections. The three main parts are the graphics and main program code, importer, and modules. The program starts by having the importer look through the "modules" directory. The importer looks for every file named *.py recursively and imports them into their own, separate modules. The importer does this by using the imp library included with python. This allows the program to call on the submodule's functions by going through a python dictionary with the name of the file as the key. This layout allows ease of use of the modules.

The modules themselves all inherit from the main parent module, juliet_module. This module has the base variables mod_name, mod_id, and mod_rect. These attributes define the name of the module, the id at runtime, and the rectangle the module takes up on the screen. In addition to these, there is a changed variable which is used when updating modules to check if the module's rectangle needs to be updated. juliet_module also contains the functions draw and update, which get called every frame during the main program loop.

The graphics program is supposed to be a separate forked process which runs separate from the main program at this point, though this is currently not implemented and juliet_graphics is called from the start. In the final project, the code would be called by a juliet_control module, which handles importing and starting the graphics and other modules. In addition,...

Read more »

  • 1 × Raspberry Pi model A+ Can be replaced by any similar Raspberry Pi
  • 1 × LCD Screen
  • 1 × Two-Way Mirror 10" x 17"
  • 1 × HDMI Cable
  • 1 × USB power cable

View all 6 components

  • Licenses and Open-Source Technology

    Matt Lagarenne04/18/2016 at 04:37 0 comments

    Since this project is open-source and will be completely open for anyone to download and use, it is important that I get the documentation and licensing correct so that the open-source community is also able to help contribute in an easy, well-understood way. To that end, here are the sources that I am currently using:

    weathericons.ttf - SIL Open Font License

    Comme-Thin.ttf - SIL Open Font License

    python-forecast.io - FreeBSD License

    pygame - LGPL

    Since the project is early on in development, this is all that I have. In order to comply with the above licenses, I need to do a couple of things if I want to include them in my source code:

    1. Include the SIL Open License text file in my source
    2. Include the FreeBSD clause with the forecast.io source
    3. Explain to users how to download pygame somewhere in my README

    This means that I have complete control over the license that I choose provided I do the above things, since none of these are copyleft and require me to adapt a certain license.

    Since I want the project to be as open as possible and for people to be able to submit their own modules to expand the platform, I am going to choose to also use the FreeBSD clause, since it protects my code from simple copying without credit. This means that people are able to modify it and use it to make their own modules but are free to use their own licenses if they wish if they choose to make a module. To that end, I also do not think that it is necessary to force people to use a certain license. As long as I have my code covered, I am safe from unauthorized copying.

  • Finally Updated Project with Concept Screens

    Matt Lagarenne04/18/2016 at 04:00 0 comments

    I updated the project with concepts screens of what the final outputs will look like. Ideally the information is contained in modules that can be re-positioned using some kind of outside app which generates a configuration file which contains the information for displaying modules on the main screen, and contains triggers for how to get to the module-specific screens. For instance, if you say, "Weather", and a weather module is installed, the screen will switch to a full-screen version of that module, displaying more detailed information. This could also be the same for the agenda, music, and stock market modules when they get implemented. I've also been thinking about how all these modules are going to be able to update quickly. I think I'm going to research more into window managers and see how they implement, well, window managing and see if I can learn anything from them. I am also looking into having the main process daemon-ize when the command is run, and then being updated through some command line interface which communicates with the main process by telling it what to do. I know that the cmus music player for Linux does this, so I will have to look into it. Hopefully I can use the Linux internals, since they are proven to work and I would learn something new. Other than that, I've been busy with a number of other projects but have been doing a lot of conceptual thinking of how I want to lay out the architecture of this project. Going forward I will have to be mindful of the fact that I may switch to a C program using OpenVG, so I will need to document how my code works so that I can port it easily. Or perhaps write C bindings for use with Python so that I get the great modules in python and the important screen drawing code in OpenVG for speed.

  • 2-Way Mirror Mounted

    Matt Lagarenne04/04/2016 at 16:27 0 comments

    I finally got around to mounting the 2-way mirror to the LCD screen. I took some 3M double-sided heavy duty mounting tape and applied it to the LCD screen bezel. Then I cut off the excess overhang and flipped the LCD screen onto the mirror. Since I have extra mirror overhang around the LCD screen, I used some black electrical tape to stop any light from coming through the sides and ruin the full-mirror effect.

    I also recorded a small video showing the program displaying the beginnings of a weather app. The app can already find the weather for the current day and the next week, but right now it only displays the weather. I will have to write some code in order to find out the size of the boxes that are made by the different weather icons in real time, which shouldn't be too hard. I have to think about how I want to layout the weather module in relation to the rest of the screen elements. I will hopefully have that designed and the plans uploaded by the end of the week.

  • Looking into Other 2D Graphics

    Matt Lagarenne03/18/2016 at 15:10 0 comments

    So I've been looking into 2D graphics programming recently because I was a little displeased with pygame's performance ( I'm a gamer at heart so I love that smooth 60 FPS :) ). I was looking into the specs of the Raspberry Pi models that I owned and noticed that pretty much all of the RPi's use the same graphics processor. This processor supports OpenGL ES, an implementation of OpenGL for Embedded Systems (hence the name...). In addition to OpenGL, there is another standard by Khronos (the group that maintains OpenGL) called OpenVG - a 2D vector drawing API for hardware-accelerated graphics. If I could develop a C library for this and then make python bindings for it, it could potentially save me lots of CPU power. Before I switch though I should check to see if pygame is already using this API. Alternatively, I could look into this repository I found: https://github.com/ajstarks/openvg. This is a project for exploring OpenVG on the Raspberry Pi. I should take a look into this at some point in the future to see if I could integrate it instead of writing my own libraries.

  • Fixed Unicode Strings not Displaying Correctly

    Matt Lagarenne02/23/2016 at 01:59 0 comments

    Fixed the code not displaying unicode strings correctly in python 2.7, at least for the weather-module. In this case, the fix was to use the line

    from __future__ import unicode_literals

    at the beginning near the rest of the imports. This tells python to use unicode as the default encoding scheme for the strings in the file. If not used, the icon text is rendered as a bunch of "icon not found" boxes.

  • Two-Way Mirror Purchased!

    Matt Lagarenne02/17/2016 at 03:16 0 comments

    I bought the actual two-way mirror three days ago and have been kicking away at setting up the actual Raspberry Pi for showing the screen. I got a whole 2'x4' sheet of it which is cut down to 11"x18". Two-way mirrors are actually like acrylic plastic, so they are cut in the same way. I had mine cut by the shop that sold it to me, since it was just a simple rectangle. I have to get some foam adhesive strips to mount the plastic to the LCD now.

View all 6 project logs

Enjoy this project?

Share

Discussions

Matt Lagarenne wrote 03/01/2016 at 23:01 point

@Tony Legrone I got the panel from a random 100 dollar monitor that I found on Amazon. I took the screws off the plastics and ripped it open. I'm left with the power supply, HDMI interface, and some speakers, which works pretty well for what I intend to do with the project

  Are you sure? yes | no

Tony Legrone wrote 03/01/2016 at 17:00 point

This is a very interesting project. Can you tell me where you got that LCD panel?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates