Smart Zonnescherm
My Project is a smart sunscreen. It is for people who like to hang out outside but dont want to bother with constantly having to manually open en close a sunscreen.
The sunscreen has a some sensors to detect what the weather is outside. if the measured values go outside of certain chosen parameters, the sunscreen will automatically close and will reopen if values go back inside those parameters.
- Anemometer to detect when the windspeed gets to high
- Temperaturesensor to measure the temperature
- lightsensor to measure brightness
The sunscreen also has an LCD display which show the different measured values from the sensors,shows the IP adress and gives a notification if the screen opens or closes.
Via the website you can change what the parameters are for the windspeed, temperature and brightness, you can also manually open and close the sunscreen.
And finally theres a viewable history of the different weather measurements and timestamps of when sunscreen opened and closed.
Supplies
Control System:
- Raspberry PI 4 Model B
Electronics:
- set of 220 Ohm resistors
- 2 x 9V 2A power supply
- 5V 3A power supply (PI power supply)
Sensors and modules:
- TDC-03A-100-5 NTC Temperature sensor
- LDR (Light dependent resistor)
- Anenomometer
- MCP3008 - 8-channel 10-Bit ADC with SPI Interface
- PCF8574 8-bit I/O Expander for I²C Bus
- LCD DISPLAY
Casing:
- Multiplex Box
- Raspberry pi Case
- Tablecloth
Tools:
- Solder and soldering iron
- Drill
- SuperGlue
- 3mm screws
Downloads
Prototyping
Here are the electrical scheme and the breadboard scheme.
Make sure you connect everything exactly like seen in the schemes.
Check if everything all the power supply pins are correct and you have added the safety resistors before powering everything on.
Check for shorts!
Setting Up PI
First we need to set up our raspberry PI.
The PI will be responsible for running the backend, frontend and the Server.
We shall install an image which provides some packages to start off with.
1. Install custom PI image
First we need to install an image to our PI.
Image can be found here: https://studenthowest-my.sharepoint.com/:u:/g/personal/dagobert_harinck_student_howest_be/EX7mzawCWfZJhvhJeq9LcL8BG_2BN8LXtiPwNGvarQ2c9A?e=aawSNA
Tutorial for installing an image using win32-disk-imager:
https://www.ubackup.com/windows-10/win32-disk-imager-windows-10-64-bit-6988.html
The image already has several packages installed which are needed for the project:
- Apache webserver
- MariaDB
- Python
2.Connect to PI
Connect the PI with an ethernet cable to your pc.
You make an SSH connection to the PI with IP-address:192.158.168.169 with the user: student en password: 'W8w00rd'
Make sure to change your password afterwards.
3.Enable interfaces
We need to enable some interfaces for the project to work.
Ise the following command:
sudo raspi-config
And enable I2C and SPI.
Make sure to reboot the PI afterwards.
Database
First make sure to download the repository via GITHUB:
https://github.com/howest-mct/2021-2022-projectone-HarinckDagobert
Above is the EER diagram of the database.
I am using 4 tables to store all my data
1. Acties
The acties table stores the actions of Actuator (sun screen motor). It stores wether the sun screen opens or closes. This table has a one-to-many link to the historiek table.
2. Historiek
This table stores all logs of sensors and actuators. It stores the date,value and ID of the device. It optionally has an ID of an actie if the device is an actuator. The Historiek table has a many-to-one relationship to the device table
3. Device
The Device table contains all the info about the devices. It stores the name, type, measuring unit, description and cost. It has an one-to-many relationship to the parameters table
4. Parameters
This table stores the different parameters where the sun screen is allowed to open in. It stores the maximum wind speed, minimum temperature, minimum brightness and the days the sun screen can open in.
To install this database on the PI you need to go over to my GitHub page and download the repository. Run the SQL files in the database-export folder. Do this is MySQL workbench or PhpMyadmin.
Backend
Make sure you have gone to GITHUB and downloaded the repository.
In the backend folder is the entire backend.
All Python packages are already installed and the folder already contains class in /helpers,
the main program is named app.py.
note: if you change Mysql password, change it as well in config.py
Project starts on boot
Make a file named myproject.service,
write following into file:
[Unit]
Description=ProjectOne Project
After=network.target
[Service]
ExecStart=/usr/bin/python3 -u /home/student/<name_of_repo>/backend/app.py
WorkingDirectory=/home/student/<name_of_repo>/backend
StandardOutput=inherit
StandardError=inherit
Restart=always
User=student
[Install]
WantedBy=multi-user.target
Execute following commands:
sudo cp myproject.service /etc/systemd/system/myproject.service sudosystemctl enable myproject.service
Frontend
Make sure you have copied the contents of the Frontend directory from Github.
Follow these commands:
sudo nano /etc/apach2/sites-available/000-default.conf
Replace DocumentRoot /var/www/html
with
DocumentRoot/home/student/<name_repository>/front-end
Edit the rights of the root folder:
nano /etc/apache2/apache2
Change
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
to
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
Restart apache2:
service apache2 restart
That's all you need to do for the frontend to work, you can access the website at its IP-address in a browser.
Housing
Electronic Housing
For the housing i used 4 plates of trovicel (a type of PVC plate) and glued them together into a 30x30cm box.
I cut out one of the plates and attached magnets to it so i can easily open the box to access my electronics.
To attach the magnets i used a 3mm drill and then screwed the magnets in place
Anemometer
Anemometer:
To attach the anemometer i screwed it in place on the top of the housing.
I drilled another hole of around 5mm in diameter to fit the cable through into the housing.
NTC, LDR and Button
Sensors:
To attach the other sensors and buttons i first soldered them to jumper cables.
I am not very good at soldering so i will not explain how to in this instructable but here is a good explanation: https://www.instructables.com/Soldering-1/
After soldering everything i drilled 3mm holes in the top of the housing and let the cables through.
The hole isnt big enough for the sensors so they sit tightly on top.
Depending on the size of your sensors it might be better to use a different size of drill.
LCD Display
Display:
I sawed out the dimensions of my LCD display on the side of the housing.
Make sure to measure your display because it won't be the same size as mine.
If the hole is the right size, the display will fit in tightly but if it is loose you can glue it or use duct tape
Power Supply
There's 3 power supplies for this project:
- Raspberry PI USB-C power supply
- breadboard powersupply 9V
- anemometer powersupply 9V
For the anemometer power supply i used a normal universal adapter and cut of the end so i could fit into my breadboard.
To fit everything together i used a multi-socket adapter and glued it to the inside bottom of the box.
Attaching Electronics
To attach the electronics i used glued the breadboard to the inside of the box.
I then glued a Raspberry PI casing to the inside, this casing can hold the PI firmly.
Attaching Motor and Screen
To attach the motor i used some screws and 2 bend plates.
I used 2 copper pipes.
1 smaller one i bend the end of so it fits over the motor.
I then welded this to the bigger pipe and had it attached on both sides.
For the screen i used some table clothed and used double sided tape to attach it to the pipe.
At the end of the screen i used a second copper pipe to act as a weight so the screen extends fully.
You can use other materials for the sun screen but this is what i used.
you should be finished now congratulations!