We all know this problem, we get up too late in the morning, so we have to get ready very quickly. Which means you don't have time to see what kind of weather it will be. But what you certainly have time for is looking in the mirror. What if we could combine the two? In this project I will make a Smart Mirror where you will be able to see the local weather forecast, the temperature in the room, the humidity in the room and how much light is present. You will be able to view all the sensor data in a self-made website.
Step 1: What Components Do You Need?
Below you can find the necessary components that are needed to complete this project.
• LCD Monitor with HMDI input
• Raspberry Pi 3B+
• SD Card
• HDMI cable
• Cables to connect the sensors to your raspberry pi
• DHT11 Temperature and Humidity Sensor
• TSL 2561 Light Sensor
• Any cheap RGB Led Strip
• Insulation to stick between the screen and the plexiglass for protection
• Plexiglass (size of the LCD Monitor)
• Reflective window Film
• Hardware to connect the wood (screws, glue, iron hooks, ..)
The maximum cost of this project will be €270,00 (If you have a pi and a spare LCD Monitor it will only be €130,00)
Step 2: Setting Up the Raspberry Pi
When you have all the components. You can start configuring the raspberry pi.
• Open Etcher on the computer
• Select the image that you downloaded earlier
• Select your microSD card
• Press the flash button and wait.
3. When the image on your microSd card, open it in windows explorer.
• Open the txt file "cmdline.txt"
• Write "169.254.10.1" at the end.
• Then save and close the file
4. Insert the microSd card in the Raspberry Pi.
• Connect power to the Raspberry Pi
• Connect a network cable to the pi and your computer
5. Download putty to connect to your raspberry pi
• Select for connection type SSH
• Hostname: 169.254.10.1 and Port: 22
6. Now we are going to connect the pi to the wifi
• Type the following command line:
wpa_passphrase 'Here comes your SSID' 'Here comes your password' >> /etc/wpa_supplicant/wpa_supplicant.conf
• After this command you type following lines:
ctrl + D
• If you want to see the ip of your pi type following line:
Step 3: Getting Your Code to the Raspberry Pi
- Open Pycharm
• Go to File --> Settings --> Build, Execution, Deployment --> Deployement
• Fill in everything as it appears on the screenshot above.
2. Now go to my github and download the files
Step 4: Setting Up the SQL Database
In this step we will be setting up the SQL database
- sudo apt update -y
- sudo apt install -y python3-venv python3-pip python3-mysqldb mariadb-server
- Now we are going to add a user and a password to the database
• CREATE USER 'FILL_USER_IN'@'localhost' IDENTIFIED BY 'FILL_PASSWORD_IN';
• CREATE DATABASE smart-mirror;
• GRANT ALL PRIVILEGES ON smart-mirror.* to 'FILL_USER_IN'@'localhost' WITH GRANT OPTION;
• sudo mariadb < sql/db_init.sql
Now we are going to connect the database to the mysql workbench
1. Go to mySQL connections
2. Click on "Setup a new connection"
3. Name your new connection
4. Hostname: 169.254.10.1, Port: 3306
5. Username and password = View previous step
6. Open the connection and go to administration
7. Click on Data import and import the sql file from my github
Step 5: Let's Start With the Hardware
Now we can finally start on the easy part. If you follow everything completely as shown on the images above, you shouldn't have any problems with this.
Step 6: Let's Start With the Mirror
- First we are going to make the back section
- Make sure you're Plexiglass and the LCD Monitor fits in the back section.
- Hang the pieces together with glue and screws
Now we are going to make the front section.
1. Make sure that the front section overlaps 1 cm over the back section on the inside
2. That way the Plexiglass can rest on that 1 cm.
After this we are going to attach the reflective film to the plexiglass (This may take a few takes)
1. Make sure your plexiglass is free of finger prints
2. Wet the plexiglass and the film with water
3. Now attach the film to the plexiglass
Step 7: Place Everything in the Frame
Now that the frame is fully assembled, we can start putting all the components in place.
First we're going to start by sticking the led strip around the housing. I used double-sided tape.
Then we drill a hole in the frame in such a way that we can connect the led strip.
Now that you are busy you can also drill 2 holes for your other sensors on the outside of your frame to place.
In such a way that we get better sensor data back.