Water-shower-monitor
Intro
As a student in my first year of Multimedia & Communication technology in Howest Kortrijk, I had to make a 'projectone'. This is a project where I have to combine all my other modules in one big project.
I make a shower monitor. This means that I store the water usage, the air temperature, the water temperature and the room humidity in a database. wich will be showed on a website. This website is used to show historik data of how much water everyone in the family uses. And the live room temperature and humidity of the bathroom.
You can also set a daily goal of how much water you want to use in a day. There is a led circle that shows while showering how much time you have left (the circle slowly fills). And if you go reach the goal a buzzer will alert you.
The purpose of this project is to make people shower for a shorter period of time. Wich is better for the environment and it will even help u save some money at the end of the day.
Downloads
Supplies
Making a Design
The first thing I did was making a design of how i wanted the project to look like.
So I went on tinkercad and made a 3D design of what I had in mind.
This is what I first came up with.
It is a 3D design of my bathroom and the shower monitor that I want making.
So I designed a box to fit all the components in and came up with this prototype.
After I printed the prototype I saw that the magnetic contacts could go through the 3D printed plate and that I forgot the holes for the LCD screen screws, so I made some adjustments and printend the final case.
Downloads
Wires
Befor I could get started on writing the code, I needed to have a wiring plan to make sure that all the components can be connected. As for a example I needed to use a pcf8574 to connect the LCD screen because there were not enough pins to just connect the lcd straight on the raspberry pi.
Normalised Database
To log and store all the sensor data I had to make a database.
I made a database with 3 tables.
1) SensorData
This table stores all the sensors.
2) History
This table stores the waterflow and the water temperature.
This table is for data that is connected to a user.
3) BathroomHistory
This table stores the bathroom temperature and humidity.
This table is for data that is not connected to a user.
To get this database on your Raspberry Pi, forward engineer this EERD in MySQLWorkbench to get the dumpfile of the database.
Writing the Code
Installing python packages
Before you can run anything, you need to install the following packages first.
- pip3 install mysql-connector-python
- pip3 install flask-socketio
- pip3 install flask-cors
-pip3 install
Enabeling interfaces
command: "sudo raspi config"
enable:
- i2C
- OneWire
- Serial
Writing the back-end
I used Visual Studio Code as coding environment for the whole project.
I wrote everything in functions and made use of threading to call the functions.
And I added some routes, to make the data availible for the front-end.
For the live data I used socket.io to communicate with the front-end.
Writing the front-end
After the back-end was finished I starten designing the front-end in 'Adobe xd'. That design was then used as guidline to make the webpage in html and CSS. After that I wrote the javascript to make everything work (loading the data, making the buttons react,...).
Link for all the source code (Github)
https://github.com/howest-mct/2021-2022-projectone-MessiaenTibo