House Humidity & Temperature Monitoring

Hello guys !

In order to start in the best way, a little story about the project.

I recently graduated and moved to Austria for my first position as an engineer. The country is beautiful but very cold & humid in winter season. I quickly started to notice some condensation on the windows every morning when I woke up as well as some mold crawling on the walls of the beautiful flat that I am renting.

It was my first encounter with such high humidity level ever, coming from the south of France, we do not really have such issue there.

So I was looking up for solutions on the internet & decided to gather some pieces and build my own monitoring system, in order to check the humidity level of each room of my flat as well as the ambient temperature.

The following project had some major guidelines :

  1. It has to be cheap.
  2. It has to be precise enough.
  3. I wanted something little, easy to carry & battery powered.
  4. I love plants & decided that it would be able to check for soil moisture in order to know wether or not I needed to water my plants. (Out of context but I just loved the idea ! :D )

This is a fairly easy project, however this is the most useful one I ever made. I am able to check every the humidity in every rooms and see if I need to react in order to stop the mold.

So let's get started.

Step 1: Gather the Components

Our project is fairly simple.

We will use an Arduino(nano in my case) as the brain, as it is very simple on the programming, cheap & replacable if needed.


A DHT-22 as a temperature & humidity sensor, there is a lower version called DHT-11, which is fairly crap in my opinion speaking of accuracy and for 3 more euros you can get the DHT-22 which is much more precise, accurate & can work accross a wider variety of temperatures.

An OLED display in order to display the data & have a visual interface between the sensors & the human that I am. I found that 64 by 128 is perfect as it is little, I could fit enough data on it & very easy to interface.

A YL-69 soil moisture sensor, to check whenever I need to water my lovely plants.

And this is basically all you need for the project.

Optionally I wanted the project to be powered using Lipos that I had around.
-You can as well make it work with a normal 9V battery very easily.

I wanted to be able to monitor the voltage of the Lipo batteries using some analog inputs on the arduino. I will give more informations on the following pages.

Additionally you will need the following :

  1. A piece of breadboard.
  2. ON/OFF switch *1
  3. A 9V battery connector
  4. 9V battery

And if you want to implement the lipos & the monitoring :

  1. 10K resistors *3
  2. 330R resistors *1
  3. LED *1
  4. Slider switch *1
  5. Lipo holders ( Or I will show you a 3D printed version that I currently use)
  6. 2 Lipo cells.

Step 2: The Full Schematic

You will find attached the full schematic. Please not that obviously you pick either the 9V battery part of the circuit or the LIPO battery part connected to VBAT.

I separated both circuit with red squares and put red title to highlight each.

Don't worry each connexion will be explained properly in the following steps.

Step 3: Getting the Right Setup

Make sure you've got Arduino IDE installed. And download the librairies coming with this step.

I will put the full code too, if you don't want to bother going on the testing of each components in the following steps.

Step 4: Connecting the DHT-22

The first step of the project is to connect the DHT-22 to the arduino.

The connection is fairly simple :


DHT-22 ------ Arduino


VCC ------ +5V

DATA ------D5

GND ------ GND

To test the DHT-22 connection to your Arduino we will implement the code embedded on this step.

Step 5: Connecting the OLED Display

The next step is to connect the OLED display.

This kind of display connects using the I2C protocol. Our first job is to find the correct I2C pins for your arduino, if you're using the Arduino nano, the I2C pins are A4(SDA) & A5(SCL). If you're using another arduino such as UNO or MEGA, look up on the official arduino website or on thedatasheet for the I2C pins.

The connection is as follow :

OLED ------ Arduino

GND ------ GND

VCC ------ 3V3

SCL ------ A5

SDA ------ A4

To test the OLED we will display the DHT data on the OLED display directly by uploading the code embedded on this step.

You should see the temperature & humidity displayed on the OLED display with a very fast sample rate as we didnt put any delay yet.

Step 6: Monitoring Soil Moisture

As I wanted to monitor the soil moisture of my plants we have to connect the YL-69.

This sensor is very interesting to me and it behaves such as when the soil is:

Wet: the output voltage decreases.

Dry: the output voltage increases.

The connection is as follow:

YL69 ------ Arduino

VCC ------ D7

GND ------ GND

D0 ------ DO NOT CONNECT

A0 ------ A7

As you can see we connect the VCC pin of the module to a digital pin of the Arduino. The idea behind that is to power the module just when we want to do the measurement and not continuously. This is due to the fact that the sensor works by measuring the current that goes from one leg of the probe to the other. Because of this electrolysis occurs and it can destroy the probe pretty fast in high-moisture soils.

We will now add the moisture sensor to our code & display the moisture data with the DHT data on the OLED. Upload the code embedded on this step.

Step 7: Monitoring VBAT (9V Battery)

I wanted to know how low was the battery to not have any surprise one day & run out without being able to anticipate it.

The way to monitor the input voltage is to use some Analog pins of the arduino to know how much voltage is received. The Inputs pins of the Arduino can take 5V maximum but the battery used is generating 9V. If we connect directly this higher voltage we would destroy some hardware components, we have to use a voltage divider to bring the 9V below the 5V treshold.

I used two 10k resistors to make the voltage divider and dividing by a factor 2 the 9V and bring it to 4.5V max.

To display the fact that the battery runs low using a normal LED with a 330 ohmcurrent limiting resistor.

We will use the Analog pin A0 to monitor VBAT.

Follow the schematic to know how to connect the components :

We will now add it to our code code embedded on this step.

Step 8: Monitoring VBAT (2 Lipos Configuration)

I wanted to know how low was the battery to not have any surprise one day & run out without being able to anticipate it.

The way to monitor the input voltage is to use some Analog pins of the arduino to know how much voltage is received. The Inputs pins of the Arduino can take 5V maximum but the Lipos are generating at maximum 4.2*2 =8.4V .

The difference with the previous step is that in case of using 2 lipos in series to create a voltage > 5V to power up the Arduino board, we have to monitor each lipo Cell as they could discharge at a different rate. Keep in mind that you don't want to over discharge a lipo battery, it is very dangerous.

For the first Lipo there is no problem because the nominal voltage of 4.2V is below the 5V treshold that can endure the input pins of the arduino. however when you put 2 batteries in series their voltage adds up :

Vtot = V1 + V2 = 4.2 + 4.2 = 8.4 maximum.

If we connect directly this higher voltage to the analog pin, we would destroy some hardware components, we have to use a voltage divider to bring the 8.4V below the 5V treshold. I used two 10k resistors to make the voltage divider and dividing by a factor 2 the 8.4V and bring it to 4.2V max.

We will use the Analog pin A0 to monitor VBAT. Follow the schematic to know how to connect the components :

To display the fact that the battery runs low using a normal LED with a 330 ohm current limiting resistor.

We will now add it to our code embedded on this step.

Step 9: The Enclosure

I have the chance to own a 3D printer so I decided to print a case using standard PLA.

You will find the files attached, I designed the enclosure using Autodesk Inventor & Fusion360.

You can as well create your own design or just keep the breadboard as it is, the box itself adds nothing to the functionnalities.


Unfortunately my 3D printer hotend just died, so I could not print the enclosure yet, I will update my post whenever I receive the parts taken on Amazon.

Edit : it is now printed & you can see it on the pictures.

Step 10: Amelioration Perspectives

For now the project fits perfectly my needs.

However we can think about some points that we could improve:

  1. Reduce the battery consumption, we could improve the current consumption either changind hardware or improving software.
  2. Add bluetooth to connect to either an APP or to store data and do some more analysis over time.
  3. Add LIPO charging circuit to recharge it directly connecting to the wall.

If you think about anything do not hesitate to write it down in the comment section.

Step 11: Thank You

Thank you for reading this tutorial, do not hesitate to interact with me & others in the comment section. I hope you enjoyed the project and i'll see you next time for another project!

Pocket Sized Contest

This is an entry in the
Pocket Sized Contest

Share

    Recommendations

    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest
    • Trash to Treasure

      Trash to Treasure

    Discussions