📜 ⬆️ ⬇️

Use of the device on the basis of STM32 in the irrigation system for open ground

Foreword


About a year ago I described in the article a system for watering my plot - and now I will describe its further development. A year is quite a long time, and I managed to spend it with benefit. I am pleased to describe and tell you what I did.

Solvable tasks


Now filling the barrel is a routine and rather minor task. The main priority now is to teach the system to automatically start watering, and this is where the question arises - when exactly should I start watering? Immediately there is someone who advises me to watering the timer. Indeed, why not? Cheap and angry, and you can always say that I have everything in full openwork. But alas - this is not entirely true. The weather is inconstant, and even the most sophisticated timed variant will not be able to keep track of how many clouds there were today and how much the sun was shining. There is no reason to even talk about rain - the timer will ignore this fact. Although there are advanced options for timers with a rain sensor - but alas, they stand like a small plane.

As a result, of the variety of options, a variant of the system was chosen that would take into account the solar radiation accumulated by the plants and, upon reaching the required threshold, would supply water for watering the plants. Plus, we must not forget that it is necessary to automatically determine the cleanliness of the filter, the correctness of the switching of taps, do not give watering at night and too early in the morning. You also need to take into account the fact that in case of cloudy weather the plants do not need to give as much water as in sunny weather - but it is still needed.

Part of the equipment


As the heart of the system, a programmable logic controller “iTeplitz is a small controller” was released. Photo of the controller with the cover removed under the spoiler.
')
Photo controller
image

And this is exactly a programmable logic controller - there is a development environment for it, which allows not only to write a program in the industrial languages ​​of the IEC 61131-3 standard, but also to make online debugging with the monitoring mode. The demo version of the GX Developer-FX program is used as the programming environment. The controller itself is fully compatible with the Mitsubishi FX2N serial controller. As can be seen in the photo, the system is based on the STM32F103C8T6 microcontroller.

A little about its capabilities:

1. The number of steps of the program -2000. I will tell you about the steps in a little more detail.
2. Galvanically isolated 1-wire interface bus. Allows you to work with 128 sensors. Using the configuration utility, it searches for sensors and saves them in the non-volatile memory of the controller.
3. Galvanically isolated bus RS-485 interface with support for the modbus RTU exchange protocol. With the help of the setup utility, it can work both in the master mode and in the slave mode. Up to 64 slaves can be supported in total (when the controller is in the master mode).
4. Programming and debugging are performed using a micro-USB cable.
5. It has 8 digital inputs and 8 digital outputs, of which 2 outputs are equipped with relays with a load capacity of 5A 250V AC. Also has 2 analog inputs.
6. There is a 2nd port of the modbus RTU protocol - but it has a TTL interface and is designed to connect to data acquisition systems. Can work only slave mode.
7. Used real-time operating system.

The next actor is the light sensor. It is based on the STM32F030 microcontroller using a real-time operating system. It has a serial interface RS-485 with support for the Modbus RTU exchange protocol for data exchange and parameter settings. IP67 housing allows installation in the open air. Photo under the spoiler.

Light Sensor Assembly
image

For curious readers, I’ll tell you right away that the BH1750 sensor makes it possible to measure illumination more than 100 thousand lux by changing the width of the measurement window.
And there is one more distinctive feature of this sensor from thousands of others - he himself considers the accumulated power in J / cm2 / hour and, upon request, sends it to the network master. Upon delivery, each sensor has its own calibration certificate for radiation power of 1000 J / cm2 / hour and is immediately ready for use.

Control object itself


The object is a small plot of land measuring 5.5 mx 25 m, equipped with 6 drip irrigation lines. Drip tubes 16 mm with droppers every 30 cm with a water discharge of 1.6 liters / hour. That is, in theory, in one hour such a system could consume 800 liters of water. But since we do not use a booster pump to raise the water pressure, then under the pressure of gravity the flow values ​​are significantly lower.

Progress: installation on site


Here is what the mounted level sensors look like in a drum for filling control. As you can see, everything is bolted with copper wire without any special problems. Float type sensors, reed.

Barrel level sensors
image

And here, under the spoiler, you can see a mounted light sensor. Again, one screw solves all problems.

Light sensor - top view
image

And for clarity, the bottom view:

Light Sensor - Bottom View
image

And now the installation of the controller and power supply for the valve - do not judge strictly, the installation is done "as is." You can always do a lot more carefully - but here we are not considering the quality of installation, but the work of the system itself.

Window controller
image

And now a photo of the assembly of the mechanical disc filter unit and the irrigation valve.

Filter valve
image

Work program


I’ll say right away that the source of the program and the printout in pdf will be at the end of this section. No secrets from you, dear readers, in this article will not be.

So - filling the barrel. At the same time, the timeout of the pump operation time is monitored. If the filling lasts more than 30 minutes, then turn off the pump and show an alarm signal. If the barrel is filled in the allotted time - then set the flag of readiness for irrigation. Watering is possible only between 5:00 and 17:35. Time can be changed very easily. The first watering will be included as soon as the morning dose of absorbed solar energy is more than 180 J / cm2 / hour. After that, each subsequent watering will be included after 300 J / cm2 / hour. If solar activity is low and we did not get the morning dose before 10:35, watering will be turned on once and the system will wait for an increase in solar activity. To empty the barrel, a timeout of 50 minutes is given. If the time is exceeded - it means problems with the filter or valve. In this case, we issue a warning signal and turn off the watering. The amount of water used for irrigation is also monitored - if more than 8 barrels were used, the irrigation stops and a warning signal is given. The signal is not acknowledged - it will be reset in the morning of the next day. The execution time of such a program in the controller is 2 ms.

Below the spoiler is shown the process of debugging - online program monitor in runtime mode.

Online Debugging Program
image

I will not describe here all the temporary protective delays and the logic of the program - you can see it all yourself in the program. Here is the archive with the program and the printed version in pdf format.

Work results and conclusion


And now the most interesting is the results of the work. After starting the irrigation system, it became immediately apparent that the plants respond to irrigation. This is expressed in the quality of the berries. There are several raspberry bushes on the plot - if before the berries were soft to the touch and had average taste qualities, now they are what they should be. And the taste qualities are completely different - the berries have become more fragrant. There is also a cucumber planting - now even in extreme heat (and geographically I am in the south, in the Krasnodar Territory) leaves are not affected. And the cucumber has become more delicious.

The most important conclusion can be made this way: using these controllers and light sensors, you can build a decent irrigation control system not only for greenhouses, but also for planting in open ground. And it can take a worthy place along with the timer systems.

Further way


The next step is to connect the dosing groups based on Venturi injectors to the system to ensure accurate fertilizer feed through the drip irrigation system. This step will make a similar system out of reach for the quality of irrigation for timer systems. After the equipment is equipped with a humidity sensor, the system will be able to control the microclimate in the greenhouse. All this can be connected simply and cost-effectively - configuring the system now resembles a simple gameplay. On the progress of the work, I will definitely tell you, my dear readers.

Source: https://habr.com/ru/post/334192/


All Articles