Software for a smart mirror that informs the user of basic weather, time, and news events, and supports Google Calendar integration.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
public
py_scripts
.gitignore
.travis.yml
LICENSE
README.md
package-lock.json
package.json
server.js

README.md

Smart Mirror Travis

Software for a smart mirror that informs the user of basic weather and calendar events, maintained with a PIR motion sensor that detects movement and maintains monitor display.

Table of Contents

Running Software

dashboard

Smart Mirror Dashboard

Run in terminal:

cd [to the location you want to keep it]

git clone https://github.com/n3a9/smart-mirror.git

cd smart-mirror

npm install

npm start

Go to localhost:1337 in a browser.

Motion Sensor Monitor Control

Inside py_scripts, run detect_motion.py to check that your motion sensor is properly connected and working.

Then run monitor_control.py in the same directory as monitor_on.sh and monitor_off.sh, which will turn off the monitor after 10 seconds of no motion, and turn on the monitor upon new movement.

Hardware Set Up

Things you need:

  • Raspberry Pi with an OS, like here
  • An old monitor from which the casing can be removed

monitor1 monitor2 monitor3

  • 2 way mirror, like here (I got the 3mm to be safe, but 1mm will work)
  • PIR motion sensor, like here

Motion Sensor Connection

Connect VCC (power - shown in pictures with black wire) to pinout 2 or 4 for 5V (3.3V will not work with sensor).

Connect OUT (output - shown in pictures with white wire) to pinout 7 for GPIO4 (where the code is looking for data).

Connect GND (ground - shown in pictures with grey wire) to pinout 6 to ground and connect the circuit.

rasbperry-pi motion-sensor

Customize Data

Weather Data

This uses the OpenWeatherMap API found here.

You can change the units and location of the weather data that is being pulled.

Navigate to smart-mirror/public/app/weather/weather.service.js

In the function getWeather(), you will find url: [long url to pull weather data].

To change Zip Code

Default location is Los Altos. Replace ?zip=94024,us with ?zip=[yourzip].

Make sure not to add any spaces or underscores.

To change weather units

Default units is Fahrenheit.

For Kelvin, delete &units=imperial.

For Celcius, replace &units=imperial with &units=metric.

News Source

News API allows for us to change the source of our news from this list.

Navigate to smart-mirror/public/app/news/news.service.js.

In the function getNews(), you will find url: [long url to pull news data].

To change source, change from source=time to the source of your choice by removing time. In the news list, below the icons, is the parameter you should use to replace time (Time was set as default).

Google Calendar

In order to add Google Calendar, you have to create a client-id. To do this:

  1. Ensure the calendar you want to use with your smart mirror is publicly accessible.
  2. Go to https://console.developers.google.com/flows/enableapi?apiid=calendar and create a new project.
  3. Then click on Go to Credentials, then select Overview and then Credentials again until you reach this screen. google-calendar
  4. Click on the second tab called OAuth consent screen.
  5. Select an email address, select a product name and then hit save.
  6. Then navigate to the original credentials tab, and select Create credentials -> OAuth client ID
  7. Select web application, then add http://localhost:8000 and http://localhost:1337 as Authorized Javascript origins, and select Create.
  8. It will then give you a pop-up, giving you your client-ID and client secret.
  9. Copy your client-ID.
  10. In the project directory, navigate to smart-mirror/public/app/calendarAPI.js
  11. At the top of the file, replace var CLIENT_ID = 'insert-client-id-here'; with var ClIENT_ID = '[YOURCLIENTID]'
  12. Run the project, and then authorize access to your public calendar.

License

MIT