Skip to content

This Smart Mirror Project is an interactive mirror display designed to offer real-time updates and personalised information such as, time and date, weather forecasts, news headlines a personalised greeting message.

Notifications You must be signed in to change notification settings

FunmiOlaitan/Smart-Mirror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Mirror

Description

This Python application creates an interactive smart mirror interface that displays real-time weather information, top news headlines, date, time, and a personalised greeting message. It utlises Python and its Tkinter library which is then run on a Raspberry pi 4 and displayed on a 5 inch HDMI display mounded behind a two-way mirror.

Media

Alt Text

Features:

  1. Weather Display:

    • Fetches and displays current weather information (temperature, description, and city) using the OpenWeatherMap API.
    • Shows weather icons corresponding to the current weather condition.
  2. News Display:

    • Fetches and displays top news headlines from NewsAPI.
    • Updates every 24 hours with the latest news.
  3. Date and Time Display:

    • Shows the current date and time.
    • Updates every second.
  4. Greeting Message:

    • Displays a personalised greeting message based on the time of the day (Good Morning, Good Afternoon, Good Evening).

Directory Structure

smart_mirror/
|-- smart_mirror_app/
|   |-- __init__.py
|   |-- smart_mirror_app.py
|-- resources/
|   |--sm_img
|   |-- icon_img/
|       |-- clear_sky.png
|       |-- few_clouds.png
|       |-- broken_clouds.png
|       |-- light_rain.png
|       |-- moderate_rain.png
|       |-- heavy_rain.png
|       |-- thunderstorm.png
|       |-- snow.png
|       |-- unknown.png
|       |-- CREDITS.txt
|-- config/
|   |-- config.json
|-- requirements.txt
|-- README.md
|-- LICENSE
|-- .gitignore
  • The smart_mirror_app/ directory contains the main application code.
  • The resources/ directory holds resources used by the application.
  • Within resources/icon_img/, holds the weather icon images.
  • Within resources/sm_img/, holds the images of the smart mirror and installation
  • The resources/CREDITS.txt file, provides credits for the sources of weather icon images used in the project.
  • The config/config.json holds API keys which is ignored by the .gitignore file to prevent it from being committed to version control.
  • The requirements.txt file lists the Python dependencies required for this project.
  • The README.md is the documentation file (you're reading it!).
  • The .gitignore file ignores the specifies untracked files to ignore which is config/config.json.

Getting Started:

Hardware Setup:

For the hardware setup of the Smart Mirror, you will need:

  • Raspberry Pi 4: Ensure there is sufficient RAM and storage to handle the application smoothly.
  • 5-inch HDMI display (or a display screen compatible with Raspberry Pi)
  • Two-way mirror: A special mirror that allows light to pass through while also reflecting light, enabling the display to show through the mirror.
  • MicroSD Card: Used to install the operating system (e.g., Raspberry Pi OS) and store application files.
  • USB Keyboard and Mouse: Required for initial setup and configuration of the Raspberry Pi.
  • Raspberry Pi charger: Ensure you have a compatiable power adapter ususally 5V, 3A is recommended to power Raspberry Pi 4.
  • Frame: A frame to hold the Raspberry Pi, display, and two-way mirror securely in place.
  • Mounting Hardware and tools: Depending on your setup, you may need mounting brackets, adhesive strips, or other hardware to securely attach the display and mirror to the desired surface. Basic tools such as screwdrivers and pliers may also be needed for mounting and assembling.

Software Setup

To set up and run the smart mirror application directly from your Code editor:

  1. Install the required libraries:

    • tkinter
    • requests
    • json
    • datetime
    • newsapi-python
    • PhotoImage
  2. Obtain API keys:

    • OpenWeatherMap API key: You need to sign up on OpenWeatherMap to get an API key.
    • NewsAPI API key: You need to sign up on NewsAPI to get an API key.
  3. Configuration:

    • Open the 'smart_mirror_app.py' file in a text editor.
    • Locate the following lines of code and remove these lines of code:
      # read config file:
      with open('config/config.json') as config_file:
          config = json.load(config_file)
    • Insert your API keys directly into the variables api_key and news_api_key in the 'smart_mirror_app.py' file:
      # Insert your API keys here
      api_key = "your_openweathermap_api_key"
      news_api_key = "your_newsapi_api_key"
    • Save the 'smart_mirror_app.py' file.
  4. Run the application:

    • Run the Python script 'smart_mirror_app.py'.
    • The application will launch in fullscreen mode and display weather information, top news headlines, date, time, and a greeting message.

Raspberry Pi Setup

To set up and run the smart mirror application directly from your Raspberry Pi:

  1. Prepare Raspberry Pi

    • Connect your Raspberry Pi to a power source, HDMI display, USB keyboard, and mouse.
    • Ensure your Raspberry Pi is set up and connected to the internet. If you haven't already set up your Raspberry Pi, follow the official Raspberry Pi documentation for guidance.
  2. Install Python:

    • Open a terminal on your Raspberry Pi.
    • Check if Python is installed by running the command:
      python --version
      
      If Python is not installed, you can install it using the following command:
      sudo apt-get update
      sudo apt-get install python3
      
  3. Clone the project repository:

    • Open a terminal on your Raspberry Pi.
    • Use the git clone command to clone the project repository from GitHub to your Raspberry Pi
     git clone https://github.com/FunmiOlaitan/Smart-Mirror.git
    
  4. Navigate to the project directory:

    • Use the cd command to navigate into the cloned project directory:
      cd smart_mirror
      
  5. Install dependencies:

    • Install the required Python dependencies listed in the requirements.txt file using pip:
      pip install -r requirements.txt
      
  6. Configuration:

    • Open the 'smart_mirror_app.py' file.
    • Locate the following lines of code and remove these lines of code:
      # read config file:
      with open('config/config.json') as config_file:
          config = json.load(config_file)
    • Insert your API keys directly into the variables api_key and news_api_key in the 'smart_mirror_app.py' file:
      # Insert your API keys here
      api_key = "your_openweathermap_api_key"
      news_api_key = "your_newsapi_api_key"
    • Save the 'smart_mirror_app.py' file.
  7. Run the application:

    • Execute the Python script smart_mirror_app.py to run the smart mirror application:
      python smart_mirror_app.py
      
    • The application will launch in fullscreen mode and display weather information, top news headlines, date, time, and a greeting message on your Raspberry Pi's display.

Assembly Setup:

To assemble the Smart Mirror, follow these steps:

  1. Mount the 5-inch HDMI display behind the two-way mirror.
  2. Connect the Raspberry Pi 4 to the HDMI display.

Customisation

  • Modify the city parameter in the SmartMirrorApp class instantiation to change the location for weather data.
  • Customise the get_weather_icon method in the WeatherDisplay class to add or modify weather icons.
  • Adjust the font styles and sizes in the Tkinter labels to customise the appearance of the interface.

Equipment Purchase Links

License

Contribution

Contributions to the project are welcome! If you have ideas for improvements or new features, feel free to open an issue or submit a pull request.

Contact

For any inquiries or questions, please contact me at [FunmilolaOlaitan@yahoo.com].

Enjoy your smart mirror experience! 🌟

About

This Smart Mirror Project is an interactive mirror display designed to offer real-time updates and personalised information such as, time and date, weather forecasts, news headlines a personalised greeting message.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages