Moisture Sensor for Planters

by danielgass in Circuits > Arduino

438 Views, 3 Favorites, 0 Comments

Moisture Sensor for Planters

copie_20210117-142842.png

Purpose of the project

The aim of the project is to permanently monitor the humidity level of a planter and to warn in case of water shortage.

Constraints of the project:

  • Controls once per hour.
  • Long operating time of the device. Use of a special component to put in deep sleep.
  • Warning on low battery voltage. When the device detects the low battery level warn with a two-tone sound of 20 seconds once per hour.
  • Warn on low humidity. When the device detects a lack of water, warn with a continuous sound for 20 seconds once an hour. Continuous sound during detection is not recommended in case no one is present to hear it.This avoids unnecessary discharge of the battery.

The project files are downloadable HERE

Components (Electronic Part)

copie_20210117-144009.png

  • Atmega328P kit with quartz and 22pF capacitor
  • Circuit TPL5110
  • 3.3V regulator MCP1700-3302E
  • Battery holder 18650
  • Battery 18650
  • Capacitor 0.33µF
  • 1µF ceramic capacitor
  • Led diode
  • Active Buzzer
  • Resistors 100k (3x), 10k, 470, 100
  • Push button
  • Anticorrosive capacitive probe SEN0193
  • Printed circuit board (3x7 cm)
  • Mounting connectors (male and female)
  • Female rider

Scheme of the Device

copie_20210117-144947.png

The system is made up of three parts:

  • The power supply and the standby component.
  • The controller.
  • The peripherals.

The device is controlled by a TPL5110 circuit which ensures the power on (every hour in my case). The advantage of this device is to consume very little current in standby (around 20µA). In standby mode the downstream components are off. The global consumption is thus minimized. The circuit is powered by a 18650 type battery. The longevity of the device depends on the capacity of the battery (see below for detailed explanations on the power consumption of the device). The power supply is completed by a 3.3V MCP1700 regulator which ensures electrical stability.

The controller is a Atmega328P type. A 16Mhz quartz crystal ensures the timing. The RESET, RDX and TXD pins will be connected to a USB/TTL converter for programming. In operation when the controller has finished the controls/actions linked to the peripherals (humidity sensor and supply voltage) the output Pin 13 will switch to LOW to reset the timer TPL5110. A jumper (SW1) allows to cut this link during programming.

Peripherals:

  • Humidity detection probe SEN0193. It is of capacitive type which avoids corrosion in humid environment. It provides a voltage that indicates the degree of humidity. It is connected to the analog input A0.
  • A voltage divider connected to the output of the timer is used to measure the battery voltage. The analog input A1 is used for this measurement.
  • An active buzzer informs about lack of water or low battery level. - An indicator light (LED) will be used to check the proper functioning of the controller. This LED will light up for one second when the controller is started. This indicates that the controller has started properly.

Remark concerning the timer unit: I started the project with a TPL5111 timer (I acquired a model TPL5110 afterwards). I voluntarily left the TPL5111 variant for demonstration purposes. It may be useful in other projects.

Note about the battery. The project uses a rechargeable battery. Any alternative (rechargeable or not) delivering more than 3.5V (<6V) can be used. You will find in the project documents an Excel file that allows you to make longevity calculations. It should be kept in mind that the leakage current of the batteries reduces the useful life. In the case of a 18650 battery (1000mAh) the duration of one year is a reality observed on other projects. Pay attention to the quality of the battery, choose a renamed manufacturer (VTC5A-Sony, 25R Samsung or MJ1 LG).

It is advisable to go through a proof of concept phase to become familiar with the various components, possibly for the initial loading of the "Bootloader", the setting of the timer duration and the calibration of the probe.

Programming

copie_20210117-145516.png

In this article we assume that the controller is equipped with the bootloader program. If this is not the case, we will easily find how to do it on this site. (Like: https://www.instructables.com/How-to-Upload-Bootloader-to-Any-Arduino-/ )

The connection to the PC will be done through a USB/TTL interface using RTS, TX and RX signals. If you only use RX and TX then the RESET button will be used when transferring the program (look at the youtube video cvyq-qohljg).

The program is relatively simple.

Section A - Contains the declarations of the inclusions and PINs used. The "DisplayMode" variable allows the console mode to be used to display the value of the measurements on the screen when the program is running. The value of "SoilMoistureMin" is to be changed depending on the moisture level you want to measure.

Section B - PIN Initialization

Section C - Measurements.

1 - Reading of the probes (probe and battery) and possibly (DisplayMode) display of the values on the PC console.
2 - Comparison of the battery level in relation to the low threshold. If the voltage is below the threshold (3.5V), a discontinuous sound is emitted for 20 seconds.

3 - Comparison of the level of the probe in relation to the threshold. If the value is higher than the threshold, a uniform sound is emitted for 20 seconds.

4 - End of the program. An impulse is given to the timer TPL5110 to put it into sleep mode. The controller is then switched off.

Section D - Display function of measured values when the "DisplayMode" indicator is set to "True".


During programming, remove jumper SW1 to disable the timer.

Assembly and Packaging

copie_20210117-145846.png

Mounting on the printed circuit board is easy and does not require any special comment.

The part covering allows to hide the electronic device and to make the whole thing aesthetic.

Equipment list:

  • Plywood (0.7cm and 0.4cm)
  • Scroll saw
  • Wood glue
  • Clamp joint
  • Wood sealant
  • Pumice paper
  • Painting
  • Brush

The housing is made of several layers of cut wood. The whole is glued and painted. The electronic device can then slide inside to become invisible. The battery (too large) will be fixed behind the planter (by a scratch tape) and connected to the device by a thin cable.