# IoT - Humidity controller By Petter Eriksson (pe222rg) at LNU #### Project description My project is based on the fact that my bathroom has just been remodeled because of moisture damage. My plan is to actively monitor the humidity in my bathroom and finding the best setting for the ventilation in the bathroom. My plan is to have 5 days for each setting and I will then monitor which setting has the most optimal percentage of openness. #### Project timeline My timeline has been troublesome since I had troubles with getting my hardware from the supplier. It has been a lot of work happening over the last days to finish this project in time, and I would have loved to go deeper into what I could have done if the time was there. Even though this course may be over this is something that I will continue to work on onwards. #### Objective As mentioned above my old bathroom was damaged by moisture and had to be completely gutted. I had a machine in my bathroom for 4 weeks sucking out all the moist. Now that I have a brand new bathroom I wanna make sure it will not get damaged by moisture again, thats where my sensor comes in. I will use it over the summer to measure the change in temperature and humidity based on the settings on my ventilation. Hopefully this will lead to a bathroom free of dangerous levels of moist and therefore a bathroom that can survive a long time before it has to get gutted again. #### Materials Here is where I would have loved to have more, my plan before this project was not only to measure the moist in my bathroom but also to measure the moist in all my big plants, in and outside, as well as creating a digital weather station. When I realized I would not be getting the material in time i decided to only measure the moist in my bathroom for this project. | ESP32 | DHT11 | Battery | Breadboard | Totalt | | --------------------------------------------------------------------- | --------------------------------------- | --- | ---------- | ------ | | Development board with a ESP32 chip for bluetooth and wifi connection | Digital temperature and moisture sensor | | | | | 94kr | 28kr | | | 122kr | My total for this was 122kr, but I had some cables and a battery at home that I did not need to buy for my project. My project was meant to be much bigger than this so my cost ended up really low. I bought the ESP32 and DHT11 from sizable.se and the other parts I dont remember where I bought them. #### Computer setup Since I am using a ESP32 board I chose to use Atom as my IDE after getting some feedback from Discord. I used PyComs plugin Pymakr as well. First i downloaded Atom as my IDE, then i installed the plugin Pymakr from PyCom. When you have connected your ESP32 board to your computer you need to remember to press to buttom on the board to flash it. When this is done you can open your IDE, in my case Atom. #### Putting everything together My ESP32 board is connected to the DHT11 sensor with 3 cables, Cable 1 goes from DHT11 GND to ESP32 Pin GND Cable 2 goes from DHT11 VCC to ESP32 Pin 3V3 Cable 3 goes from DHT11 DAT to ESP32 Pin 14 #### Platform The platform that I have chosen is Adafruit, a free open source cloud platform. I choose this platform since I am using a ESP32 board for my projevt. I used MQTT-protocol to send the sensor data from my ESP32 to my MQTT-server. The platform is free and I do not intend om paying for any services for this project, Adafruit does have a version that cost money. #### The code I imported Pin and Timer from the machine, time, network, MQTT, sys and DHT are the other importations i made. Below you have the code for my sensor data. It publishes data in another place which will warn me if the humidity reaches 70% or more. If its below 70% it will only be saved in the normal feed for humidity. ![](https://i.imgur.com/VmDjDvZ.png) #### Transmitting the data I decided to send my data every 30 minutes since I do not see the benefit of collecting the humidity in my bathroom more often than that. The data is sent over Wi-Fi by MQTT-procotols to Adafruit. #### Presenting the data The data from my sensors is saved every 30 minuts as well to line up with the updated data that is sent every 30 minutes. ![](https://i.imgur.com/tpjd0I7.png) ![](https://i.imgur.com/6Q6NAMw.png) #### Finalizing the design Here is what my project looks like right now, I am going to make a box for it and make it more estetically appealing but this is how it looks like right now. ![](https://i.imgur.com/Tp8mXyn.png) I am genuinely a bit dissapointed since I wanted to make a bigger project using several sensors to give me a full control of my home environment. The delay in my hardware delivery made me have to cut the biggest parts of my project and slim it down to this.