Temperature & Moisture Monitor

2,123

11

Introduction: Temperature & Moisture Monitor

About: Finding a simple solution to a problem.

There are two sure fire ways to quickly kill off your plants. The first way is to bake or freeze them to death with extremes of temperature. Alternatively, under or over watering them will cause them to wither or rot away the roots. Of course there are other ways to neglect a plant such as incorrect feeding or lighting but these usually take days or weeks to have much effect.


Although I have an automatic watering system, I felt the need to have a completely independent temperature and moisture monitoring system in case of a major failure with the irrigation. The answer was to monitor temperature and soil moisture content using an ESP32 module and posting the results onto the internet. I like to view the data as graphs and charts and so the readings are processed on ThingSpeak to find trends. However, there are many other IoT services available on the internet which will send emails or messages when triggered.

This Instructable describes how to build a stand alone temperature and moisture datalogger. The ubiquitous DS18B20 is used to measure the temperature in the growing area. A DIY tensiometer monitors how much water is available for the plants in the growing media. After the data from these sensors is collected by the ESP32, it is sent to the internet via WiFi for posting on ThingSpeak.

Supplies

The parts used for this monitor are readily available on Ebay or Amazon.

Digital Barometric Pressure Sensor Module Liquid Water Level Controller Board
DS18B20 Waterproof Temperature Sensor
Tropf Blumat Ceramic Probe
ESP32 Development Board
5k resistor
5-12V power supply
Assorted plastic tubing to fit tensiometer and sensor
Mounting box and wiring
WiFi connection



Step 1: Temperature Measurement

The waterproof version of the DS18B20 is used to measure the temperature. Information is sent to and from the device over a 1-Wire interface so that only a single wire needs to be connected to the ESP32. Each DS18B20 contains a unique serial number so that several DS18B20s can be connected to the same wire and read separately if so desired.

Arduino libraries and instructions are readily available on the internet to handle the DS18B20 and 1-Wire interface which greatly simplify the data reading sketch.

Step 2: Tensiometer Construction

The tensiometer is a ceramic cup filled with water in close contact with the growing media. In dry conditions, water will move through the ceramic until enough vacuum builds up in the cup to stop any further movement. The pressure in the ceramic cup gives an excellent indication of how much water is available for the plants.

A Tropf Blumat Ceramic Probe can be hacked to make a DIY tensiometer by cutting away the top part of the probe as shown in the picture. A small hole is made in the pip and 4 inches of clear plastic tube pressed onto the pip. Warming the tube in hot water will soften the plastic and make the operation easier. All that remains is to soak and fill the probe with boiled water, push the probe into the ground and measure the pressure.

There is plenty of information about using tensiometers on the internet. The main problem is keeping everything leak free. Any slight air leak reduces the back pressure and the water will seep away through the ceramic cup. The water level in the plastic tube should be about an inch from the top and should be topped up with water when required. A good leak free system will only need topping up every month or so.

Step 3: Pressure Sensor

A Digital Barometric Pressure Sensor Module Liquid Water Level Controller Board, widely available on eBay, is used to measure the tensiometer pressure. The pressure sensor module consists of a strain gauge coupled to an HX710b amplifier with a 24 bit D/A converter. Unfortunately, there is not a dedicated Arduino library available for the HX710b but the HX711 library seems to work well without problems instead.

The HX711 library will output a 24 bit number proportional to the pressure measured by the sensor. By noting the output at zero and a known pressure, the sensor can be calibrated to provide user friendly units of pressure.

It is vitally important that all the pipe work and connections are leak free. Any loss in pressure causes water to escape from the ceramic cup and the tensiometer will need frequent topping up. A leak tight system will work for weeks before needing more water in the tensiometer. If you do find the water level dropping over hours rather than weeks or months, consider using pipe clips at the pipe joints.

Step 4: Pressure Sensor Calibration

The HX711 library outputs a 24 bit number according to the pressure measured by the sensor. This reading needs converting into more familiar units of pressure like psi, kPa or millibars. In this Instructable millibars were chosen as the working units but the output can be easily scaled to other measurements. There is a line in the Arduino sketch to send the raw pressure reading to the serial monitor so that it can be used for calibration purposes.

Known pressure levels can be created by recording the pressure required to support a column of water. Each inch of water supported will create a pressure of 2.5 mb. The setup is shown in the diagram, readings are taken at zero pressure and maximum pressure from the serial monitor. Some people may like to take intermediate readings, best fit lines and all that guff but the gauge is quite linear and a 2 point calibration is good enough!

It is possible to work out the offset and scale factor from two pressure measurements and flash the ESP32 in one session. However, I got completely confused with negative number arithmetic! Subtracting or dividing two negative numbers blew my mind 🥴. I took the easy way out and corrected the offset first and sorted out the scaling factor as a separate task.

First of all the raw output from the sensor is measured with nothing connected to the sensor. This number is subtracted from the raw output reading to give a zero reference for no applied pressure. After flashing the ESP32 with this offset correction, the next step is to set the scaling factor to give the correct units of pressure. A known pressure is applied to the sensor using a column of water of known height. The ESP32 is then flashed with a suitable scaling factor to give the pressure in the desired units.

Step 5: Wiring

There are several versions of the ESP32 development board out in the wild. For this Instructable a 30 pin version was used but there is no reason why other versions should not work. Besides the two sensors, the only other component is a 5k pull-up resistor for the DS18B20 bus. Instead of using push on connectors, all the connections were soldered for better reliability.

The ESP32 development board had a built in voltage regulator so that a voltage supply of up to 12 V could be used. Alternatively the unit may be powered through the USB socket.

Step 6: Arduino Sketch

The Arduino sketch for the temperature and moisture monitor is quite conventional. First of all the libraries are installed and initiated. Then The WiFi connection is set up ready to post data to ThingSpeak and the sensors read. Pressure readings are converted to millibars before being sent to ThingSpeak with the temperature readings.

Step 7: Installation

The ESP32 is mounted in a small plastic box for protection. A USB power supply and cable can be used to power the module or alternatively the onboard regulator will cope with 5-12V DC supply.

A lesson learnt the hard way with the ESP32 is that the internal antenna is quite directional. The open end of the antenna pattern should point towards the router. In practice, this means that the module should usually be mounted vertically with the antenna uppermost and pointed at the router.

Now you can log into ThingSpeak and check that your plants are not baked, frozen or desiccated!


ADDENDUM
I have tried many ways in deciding when to water plants. These have included gypsum blocks, resistance probes, evapotranspiration, capacitance changes and even weighing the compost. My conclusion is that the tensiometer is the best sensor because it mimics the way plants extract water through their roots. Please comment or message if you have thoughts on the subject...

Arduino Contest 2020

Participated in the
Arduino Contest 2020

Be the First to Share

    Recommendations

    • Stone, Concrete, Cement Challenge

      Stone, Concrete, Cement Challenge
    • DIY Summer Camp Contest

      DIY Summer Camp Contest
    • Water Speed Challenge

      Water Speed Challenge

    Comments