DIY soil moisture meter. Homemade, stable soil moisture sensor for automatic irrigation system

Many gardeners and gardeners are deprived of the opportunity to daily care for planted vegetables, berries, and fruit trees due to work pressure or during vacation. However, plants need timely watering. With the help of simple automated systems, you can ensure that the soil on your site maintains the necessary and stable moisture throughout your absence. To build a garden automatic watering system, you will need a main control element - a soil moisture sensor.

Humidity sensor

Humidity sensors are also sometimes called moisture meters or humidity sensors. Almost all soil moisture meters on the market measure moisture using a resistive method. This is not a completely accurate method because it does not take into account the electrolysis properties of the object being measured. The readings of the device may be different at the same soil moisture, but with different acidity or salt content. But for experimental gardeners, the absolute readings of the instruments are not as important as the relative ones, which can be adjusted for the water supply actuator under certain conditions.

The essence of the resistive method is that the device measures the resistance between two conductors placed in the ground at a distance of 2-3 cm from each other. This is normal ohmmeter, which is included in any digital or analog tester. Previously, such instruments were called avometers.

There are also devices with a built-in or remote indicator for operational monitoring of soil conditions.

It is easy to measure the difference in electrical current conductivity before watering and after watering using the example of a pot with a house aloe plant. Readings before watering 101.0 kOhm.

Readings after watering after 5 minutes 12.65 kOhm.

But a regular tester will only show the resistance of the soil between the electrodes, but will not be able to help with automatic watering.

Automation operating principle

Automatic watering systems usually have a “water it or don’t water” rule. As a rule, no one needs to regulate the water pressure. This is due to the use of expensive controlled valves and other unnecessary, technologically complex devices.

Almost all humidity sensors offered on the market, in addition to two electrodes, have in their design comparator. This is the simplest analog-to-digital device that converts the incoming signal into digital form. That is, at a set humidity level, you will receive one or zero (0 or 5 volts) at its output. This signal will become the source for the subsequent actuator.

For automatic watering, the most rational option would be to use a solenoid valve as an actuator. It is included in the pipe break and can also be used in micro-drip irrigation systems. Turned on by supplying 12 V.

For simple systems operating on the principle “the sensor is triggered - the water flows”, it is enough to use a comparator LM393. The microcircuit is a dual operational amplifier with the ability to receive a command signal at the output at an adjustable input level. The chip has an additional analog output that can be connected to a programmable controller or tester. Approximate Soviet analogue of a dual comparator LM393- microcircuit 521CA3.

The figure shows a ready-made humidity relay along with a Chinese-made sensor for only $1.

Below is a reinforced version, with an output current of 10A at an alternating voltage of up to 250 V, for $3-4.

Irrigation automation systems

If you are interested in a full-fledged automatic watering system, then you need to think about purchasing a programmable controller. If the area is small, then it is enough to install 3-4 humidity sensors for different types of irrigation. For example, a garden needs less watering, raspberries love moisture, and melons need enough water from the soil, except during excessively dry periods.

Based on your own observations and measurements of humidity sensors, you can approximately calculate the cost-effectiveness and efficiency of water supply in areas. Processors allow you to make seasonal adjustments, can use the readings of humidity meters, and take into account precipitation and the time of year.

Some soil moisture sensors are equipped with an interface RJ-45 to connect to the network. The processor firmware allows you to configure the system so that it will notify you about the need for watering via social networks or SMS messages. This is convenient in cases where it is impossible to connect an automated watering system, for example, for indoor plants.

Convenient to use for irrigation automation system controllers with analog and contact inputs that connect all sensors and transmit their readings via a single bus to a computer, tablet or mobile phone. The actuators are controlled via a WEB interface. The most common universal controllers are:

  • MegaD-328;
  • Arduino;
  • Hunter;
  • Toro;
  • Amtega.

These are flexible devices that allow you to fine-tune your automatic watering system and entrust it with complete control over your garden.

A simple irrigation automation scheme

The simplest irrigation automation system consists of a humidity sensor and a control device. You can make a soil moisture sensor with your own hands. You will need two nails, a 10 kOhm resistor and a power source with an output voltage of 5 V. Suitable from a mobile phone.

A microcircuit can be used as a device that will issue a command for watering LM393. You can purchase a ready-made unit or assemble it yourself, then you will need:

  • 10 kOhm resistors – 2 pcs;
  • 1 kOhm resistors – 2 pcs;
  • 2 kOhm resistors – 3 pcs;
  • variable resistor 51-100 kOhm – 1 pc.;
  • LEDs – 2 pcs;
  • any diode, not powerful - 1 pc.;
  • transistor, any average power PNP (for example, KT3107G) – 1 pc.;
  • capacitors 0.1 microns – 2 pcs;
  • chip LM393- 1 PC;
  • relay with an operating threshold of 4 V;
  • circuit board.

The assembly diagram is presented below.

After assembly, connect the module to the power supply and soil moisture level sensor. To the comparator output LM393 connect the tester. Using a construction resistor, set the response threshold. Over time, it will need to be adjusted, perhaps more than once.

Schematic diagram and pinout of the comparator LM393 presented below.

The simplest automation is ready. It is enough to connect an actuator to the closing terminals, for example, an electromagnetic valve that turns the water supply on and off.

Irrigation automation actuators

The main actuator for irrigation automation is an electronic valve with and without water flow control. The latter are cheaper, easier to maintain and manage.

There are many controlled cranes and other manufacturers.

If there are problems with water supply in your area, purchase solenoid valves with a flow sensor. This will prevent the solenoid from burning out if the water pressure drops or the water supply is cut off.

Disadvantages of automatic irrigation systems

The soil is heterogeneous and differs in its composition, so one moisture sensor can show different data in neighboring areas. In addition, some areas are shaded by trees and are wetter than those located in sunny areas. The proximity of groundwater and its level relative to the horizon also have a significant impact.

When using an automated irrigation system, the landscape of the area should be taken into account. The site can be divided into sectors. Install one or more humidity sensors in each sector and calculate its own operating algorithm for each. This will significantly complicate the system and it will hardly be possible to do without a controller, but subsequently it will almost completely save you from wasting time awkwardly standing with a hose in your hands under the hot sun. The soil will be filled with moisture without your participation.

Building an effective automated irrigation system cannot be based only on the readings of soil moisture sensors. It is imperative to additionally use temperature and light sensors and take into account the physiological need for water of plants of different species. Seasonal changes must also be taken into account. Many companies producing irrigation automation systems offer flexible software for different regions, areas and crops grown.

When purchasing a system with a humidity sensor, do not be fooled by stupid marketing slogans: our electrodes are coated with gold. Even if this is so, then you will only enrich the soil with noble metal in the process of electrolysis of plates and the wallets of not very honest businessmen.

Conclusion

This article talked about soil moisture sensors, which are the main control element of automatic watering. The principle of operation of an irrigation automation system, which can be purchased ready-made or assembled yourself, was also discussed. The simplest system consists of a humidity sensor and a control device, the DIY assembly diagram of which was also presented in this article.

You can often find devices on sale that are installed on a flower pot and monitor the level of soil moisture, turning on the pump if necessary and watering the plant. Thanks to this device, you can safely go on vacation for a week without fear that your favorite ficus will wither. However, the price of such devices is unreasonably high, because their design is extremely simple. So why buy if you can make it yourself?

Scheme

I propose for assembly a circuit diagram of a simple and proven soil moisture sensor, the diagram of which is shown below:

Two metal rods are lowered into the bud of the pot, which can be done, for example, by bending a paper clip. They need to be stuck into the ground at a distance of about 2-3 centimeters from each other. When the soil is dry, it does not conduct electricity well; the resistance between the rods is very high. When the soil is wet, its electrical conductivity increases significantly and the resistance between the rods decreases; it is this phenomenon that underlies the operation of the circuit.
A 10 kOhm resistor and a section of soil between the rods form a voltage divider, the output of which is connected to the inverting input of the operational amplifier. Those. the voltage on it depends only on how moist the soil is. If you place the sensor in moist soil, the voltage at the op-amp input will be approximately 2-3 volts. As the soil dries out, this voltage will increase and reach a value of 9-10 volts when the soil is completely dry (specific voltage values ​​​​depend on the type of soil). The voltage at the non-inverting input of the op-amp is set manually with a variable resistor (10 kOhm in the diagram, its value can be changed within 10-100 kOhm) in the range from 0 to 12 volts. Using this variable resistor, the sensor response threshold is set. The operational amplifier in this circuit works as a comparator, i.e. it compares the voltages at the inverting and non-inverting inputs. As soon as the voltage from the inverting input exceeds the voltage from the non-inverting input, a power supply minus appears at the output of the op-amp, the LED lights up and the transistor opens. The transistor in turn activates a relay that controls the water pump or electric valve. Water will begin to flow into the pot, the soil will become moist again, its electrical conductivity will increase, and the circuit will turn off the water supply.
The printed circuit board proposed for this article is designed to use a dual operational amplifier, for example, TL072, RC4558, NE5532 or other analogues, one half of it is not used. The transistor in the circuit is used with low or medium power and PNP structure; for example, KT814 can be used. Its task is to turn the relay on and off; you can also use a field-effect transistor switch instead of a relay, as I did. The supply voltage of the circuit is 12 volts.
Download the board:

(downloads: 330)

Soil Moisture Sensor Assembly

It may happen that when the soil dries out, the relay does not turn on clearly, but first begins to click quickly, and only after that it is set in the open state. This suggests that the wires from the board to the plant pot are picking up network noise, which has a detrimental effect on the operation of the circuit. In this case, it would not hurt to replace the wires with shielded ones and place an electrolytic capacitor with a capacity of 4.7 - 10 μF in parallel to the soil area, in addition to the 100 nF capacity indicated in the diagram.
I really liked the work of the scheme, I recommend repeating it. Photo of the device I assembled:

Hello everyone, today in our article we will look at how to make a soil moisture sensor with your own hands. The reason for self-production may be wear of the sensor (corrosion, oxidation), or simply the inability to purchase, a long wait and the desire to make something with your own hands. In my case, the desire to make the sensor myself was due to wear and tear; the fact is that the sensor probe, with a constant supply of voltage, interacts with the soil and moisture, as a result of which it oxidizes. For example, SparkFun sensors coat it with a special composition (Electroless Nickel Immersion Gold) to enhance the service life. Also, to extend the life of the sensor, it is better to supply power to the sensor only at the time of measurements.
One “fine” day I noticed that my irrigation system was moistening the soil unnecessarily; when checking the sensor, I removed the probe from the soil and this is what I saw:

Due to corrosion, additional resistance appears between the probes, as a result of which the signal becomes smaller and the arduino believes that the soil is dry. Since I am using an analog signal, I will not make a circuit with a digital output on the comparator to simplify the circuit.

The diagram shows a comparator for a soil moisture sensor; the part that converts the analog signal to a digital one is marked in red. The unmarked part is the part we need to convert humidity into an analog signal, and we will use it. Below I have given a diagram for connecting the probes to the arduino.

The left part of the diagram shows how the probes are connected to the arduino, and I showed the right part (with resistor R2) in order to show why the ADC readings change. When the probes are lowered into the ground, a resistance is formed between them (in the diagram I displayed it conventionally R2), if the soil is dry, then the resistance is infinitely large, and if it is wet, then it tends to 0. Since two resistances R1 and R2 form a voltage divider, and the middle point is the output (out a0), then the voltage at the output depends on the value of resistance R2. For example, if resistance R2=10Kom then the voltage will be 2.5V. You can solder the resistance on the wires so as not to make additional decouplings; for stability of the readings, you can add a 0.01 µF capacitor between the supply and out. The connection diagram is as follows:

Since we have dealt with the electrical part, we can move on to the mechanical part. For the manufacture of probes, it is better to use a material that is least susceptible to corrosion in order to prolong the life of the sensor. You can use stainless steel or galvanized metal, you can choose any shape, you can even use two pieces of wire. I chose “galvanized” for the probes; I used a small piece of getinax as a fixing material. It is also worth considering that the distance between the probes should be 5mm-10mm, but you should not do more. I soldered the sensor wires onto the ends of the galvanized sheet. Here's what we ended up with:

I didn’t bother making a detailed photo report, everything is so simple. Well, here's a photo of it in action:

As I already indicated earlier, it is better to use the sensor only at the time of measurement. The best option is to turn it on via a transistor switch, but since my current consumption was 0.4 mA, it can be turned on directly. To supply voltage during measurements, you can connect the contact of the VCC sensor to the PWM pin or use the digital output to supply a high (HIGH) level at the time of measurements, and then set it to low. It is also worth considering that after applying voltage to the sensor, you must wait some time for the readings to stabilize. Example via PWM:

Int sensor = A0; int power_sensor = 3;

void setup() (
// put your setup code here, to run once:
Serial.begin(9600);
analogWrite(power_sensor, 0);
}

void loop() (

delay(10000);
Serial.print("Suhost" : ");
Serial.println(analogRead(sensor));
analogWrite(power_sensor, 255);
delay(10000);
}

Thanks everyone for your attention!





Homemade, stable soil moisture sensor for automatic irrigation system

This article arose in connection with the construction of an automatic watering machine for caring for indoor plants. I think that the watering machine itself may be of interest to the DIYer, but now we will talk about the soil moisture sensor. https://site/


The most interesting videos on Youtube


Prologue.

Of course, before reinventing the wheel, I surfed the Internet.

Industrial humidity sensors turned out to be too expensive, and I was never able to find a detailed description of at least one such sensor. The fashion for trading “pig in pokes”, which came to us from the West, seems to have already become the norm.


Although there are descriptions of homemade amateur sensors on the network, they all work on the principle of measuring soil resistance to direct current. And the very first experiments showed the complete failure of such developments.

Actually, this didn’t really surprise me, since I still remember how, as a child, I tried to measure the resistance of the soil and discovered... an electric current in it. That is, the microammeter needle recorded the current flowing between two electrodes stuck into the ground.


Experiments that took a whole week showed that soil resistance can change quite quickly, and it can periodically increase and then decrease, and the period of these fluctuations can be from several hours to tens of seconds. In addition, in different flower pots, soil resistance changes differently. As it turned out later, the wife selects an individual soil composition for each plant.


At first, I completely abandoned measuring soil resistance and even started building an induction sensor, since I found an industrial humidity sensor on the Internet, which was described as induction. I was going to compare the frequency of the reference oscillator with the frequency of another oscillator, the coil of which is placed on a pot with a plant. But when I started prototyping the device, I suddenly remembered how I once came under “step voltage”. This prompted me to do another experiment.

And indeed, in all the homemade structures found on the network, it was proposed to measure the soil resistance to direct current. What if you try to measure AC resistance? After all, in theory, then the flowerpot should not turn into a “battery”.

I put together a simple diagram and immediately tested it on different soils. The result was encouraging. No suspicious tendencies towards increasing or decreasing resistance were detected even within several days. Subsequently, this assumption was confirmed on an operating irrigation machine, the operation of which was based on a similar principle.

Electrical circuit of a soil moisture threshold sensor.

As a result of research, this circuit appeared on one single chip. Any of the listed microcircuits will do: K176LE5, K561LE5 or CD4001A. We sell these microcircuits for only 6 cents.


The soil moisture sensor is a threshold device that responds to changes in resistance to alternating current (short pulses).

A master oscillator is assembled on elements DD1.1 and DD1.2, generating pulses at intervals of about 10 seconds. https://site/

Separating capacitors C2 and C4. They do not allow direct current generated by the soil into the measuring circuit.

Resistor R3 sets the response threshold, and resistor R8 provides hysteresis of the amplifier. Trimmer resistor R5 sets the initial bias at input DD1.3.


Capacitor C3 is an anti-interference capacitor, and resistor R4 determines the maximum input resistance of the measuring circuit. Both of these elements reduce the sensitivity of the sensor, but their absence can lead to false alarms.

You should also not choose a microcircuit supply voltage lower than 12 Volts, as this reduces the real sensitivity of the device due to a decrease in the signal-to-noise ratio.


Attention!

I don't know if prolonged exposure to electrical pulses can have harmful effects on plants. This scheme was used only at the stage of development of the irrigation machine.

To water the plants, I used a different circuit, which generates only one short measuring pulse per day, timed to coincide with the time of watering the plants.

The poet Andrei Voznesensky once said: “laziness is the engine of progress.” It is perhaps difficult to disagree with this phrase, because most electronic devices are created precisely for the purpose of making our daily lives easier, full of worries and all sorts of hectic affairs.

If you are reading this article now, then you are probably very tired of the process of watering flowers. After all, flowers are delicate creatures, you overwater them a little, you’re unhappy, you forget to water them for a day, that’s it, they’re about to fade. And how many flowers in the world have died just because their owners went on vacation for a week, leaving the poor green creatures to wither in a dry pot! Scary to imagine.

It is to prevent such terrible situations that automatic watering systems were invented. A sensor is installed on the pot that measures soil moisture - it consists of stainless steel metal rods stuck into the ground at a distance of a centimeter from each other.

They are connected via wires to a circuit whose task is to open the relay only when the humidity drops below the set value and close the relay at the moment when the soil is saturated with moisture again. The relay, in turn, controls the pump, which pumps water from the reservoir directly to the root of the plant.

Sensor circuit

As is known, the electrical conductivity of dry and wet soil differs quite significantly; it is this fact that underlies the operation of the sensor. A 10 kOhm resistor and a section of soil between the rods form a voltage divider; their midpoint is connected directly to the input of the op-amp. The voltage is supplied to the other input of the op-amp from the midpoint of the variable resistor, i.e. it can be adjusted from zero to supply voltage. With its help, the switching threshold of the comparator, in the role of which the op-amp operates, is set. As soon as the voltage at one of its inputs exceeds the voltage at the other, the output will be logical “1”, the LED will light up, the transistor will open and turn on the relay. You can use any transistor, PNP structure, suitable for current and voltage, for example, KT3107 or KT814. Operational amplifier TL072 or any similar one, for example RC4558. A low-power diode, for example, 1n4148, should be placed in parallel with the relay winding. The supply voltage of the circuit is 12 volts.

Due to the long wires from the pot to the board itself, a situation may arise that the relay does not switch clearly, but begins to click at the frequency of the alternating current in the network, and only after some time is set in the open position. To eliminate this bad phenomenon, you should place an electrolytic capacitor with a capacity of 10-100 μF in parallel with the sensor. Archive with the board. Happy building! Author - Dmitry S.

Discuss the article SOIL MOISTURE SENSOR DIAGRAM