Greenhouse controller with Arduino. Do-it-yourself smart greenhouse - greenhouse automation scheme on the Arduino microcontroller greenhouse control

  • 02.03.2021

I had the idea to make an automatic greenhouse a long time ago. It came to implementation and I began to study greenhouse management and greenhouse automation. It turns out that an intelligent greenhouse is not so simple, there are a lot of subtleties that have to be taken into account. I’ll probably start with the main thing - how does the growth and maturation of different cultures occur and what are the parameters environment should be supported during these periods.

Air temperature

If tomatoes and cucumbers grow in a greenhouse, then the environmental parameters for these crops are similar. Tomatoes feel good at air temperatures from +18 to +25°C during the day and not lower than +16°C at night. Soil temperature from +10°C and above. For flowering and fruiting, the temperature can be slightly increased so that the fruits ripen faster and are larger.
At night, substances from the leaves go to the fruits. If the temperature is increased, the fruit will more actively pour. If the temperature is in the lower limits, then this contributes to the growth of shoots and roots - for long-term fruiting.

To maintain the desired temperature in the greenhouse, it is necessary to take into account seasonal temperature fluctuations in the area where the greenhouse is located. If this is the southern part of Russia, then you can focus on automatically lowering the temperature, and if the northern part of Russia, then you will also have to take care of the heaters.

So I'll start about ways to lower the temperature in the greenhouse. The easiest way to lower the temperature in a greenhouse is to create ventilation. For ventilation, "actuators" are used, which open the windows when the temperature rises.

There are autonomous "oil ventilators" - the essence of their work is simple, when the air temperature rises, the hydraulic oil expands and pushes the stem, thereby opening the window. When the temperature drops, it closes without any automation. But there are problems with them, the first problem is that if the air temperature is elevated and a cyclone suddenly flies with an increase in wind, the window may simply not have time to close and it may be torn off by strong wind currents. Well, the second problem is the flow of cylinders, but this can be noticed in time.

Greenhouse actuators

However, I decided to make the ventilation more intelligent. Linear actuators are sold in stores, with which you can open and close windows according to specified conditions. Because automation is always working, then ventilation can be connected to a common system, because the actuator costs no more than a hydraulic cylinder, and the possibilities are much greater. In combination with a wind sensor, an atmospheric pressure sensor and a temperature sensor, you can expand the capabilities of your greenhouse. For example, an atmospheric pressure sensor can monitor pressure drops, because it has long been known that with a rapid drop in atmospheric pressure, a strong wind is more likely to pass, and already the wind speed sensor will accurately show that it would be necessary to close all the windows.

Air humidity

This is the same important parameter in the greenhouse as the temperature, it should not fall below 60%. For different crops, this parameter can vary from 60% to 90%. Moreover, the parameter of air humidity varies depending on the stage of growth, flowering and fruiting. Therefore, greenhouse automation should provide the ability to change conditions or select already programmed programs for different crops and growth stages.

Ways to humidify greenhouses

Humidifiers and humidity sensors are used to humidify the air in the greenhouse, these can be ultrasonic humidifiers or high pressure sprayers. For ultrasonic humidifiers, reverse osmosis filters must be used, because. the piezoelectric element will quickly become unusable from the sun and other raids. But the nozzles of the high-pressure sprayer also become clogged, so a fine filter is needed.
For ultrasonic humidification, one fact should be taken into account, with ultrasonic humidification, the steam temperature is almost 40 degrees, i.e. when humidified, the overall temperature in the greenhouse will rise slightly. But ultrasonic humidifiers are an economical option, of course it is better to use a high pressure pump and special spray nozzles.

Soil moisture and watering

Another important parameter for greenhouses is soil moisture. In different stages of growth and maturation, this parameter changes. The greatest need of plants for moisture in the seedling period is up to 90-95%, as well as in the phase of fruit formation and fruiting.

Automatic watering systems

Automatic watering in a greenhouse is arranged differently, but in the end everyone comes to dosing watering. Soil moisture sensors can be used but with careful modification. Chinese printed circuit board humidity sensors can show accurate data for no more than a month, after which the metal surface of the contacts is destroyed and oxidized. If you use this sensor, then eventually the moment will come when you go into the greenhouse and you have a pool there, everything is flooded and your plants will probably die. Therefore, humidity sensors can be used in conjunction with a water flow sensor (water meter). It is necessary to measure the amount of water consumed per day and set this parameter. The soil moisture sensor can be used but with modification, the contacts must be of a material that conducts electricity and oxidized as little as possible. It may be copper, but it also oxidizes over time, but this is already good, because. You can clean the contacts once a year and use again. But it is better to try graphite rods, graphite conducts electricity and does not oxidize. I have not tried it yet, but I want to make such a sensor for the test. In general, it is necessary to take the indicators of the water meter as a basis, and you can turn off irrigation with a humidity sensor if it shows the maximum values. For example, in rainy weather, the water flow decreases many times, and the set amount of water for the flow sensor can be too much. So it is better to make control for watering combined.

Watering is switched on by means of a relay by a signal from a sensor or by time. The container for watering should be at a height and it is better to do watering by "gravity" simply by opening or closing the solenoid valve. Thus, you can make a more autonomous system, because. to power the controller and valves, a conventional battery and a solar battery will suffice. This principle of irrigation will be appropriate in places where power is often cut off for a long time.

soil temperature

Soil temperature - it is also important to regulate, because. Keeping soil temperatures within certain limits will help expand your greenhouse. For example, in this way you can increase the use of the greenhouse from early spring to late autumn, and grow some exotic plants. Temperature control in an automatic greenhouse can be done with heating elements. The stores sell heating wires that are laid on the bottom of the beds. Heating is controlled through the controller, which constantly reads data from the temperature sensor, which must be located in the ground. Those. The temperature sensor must be waterproof. When the temperature drops, the controller will signal the relay to turn on the power for heating. As soon as the soil temperature reaches the set limits, the controller will turn off the power from the heater. To prevent the heating element from failing from frequent switching on and off, it is better to use special dimmers that will gradually apply a load to the heater.

greenhouse on arduino


Greenhouse equipment

  1. Arduino Mega controller - aliexpress price $10
  2. Relay block for 8 channels - price on aliexpress $ 10
  3. DHT temperature sensors - aliexpress price $1
  4. Temperature sensors DS1820 - aliexpress price $1
  5. LCD I2C data display module - aliexpress price $3
  6. Soil moisture sensors - aliexpress price $1
  7. Light sensor - aliexpress price 1 dollar
  8. Electro magnetic valves for drip irrigation - 150 rubles apiece in a car shop
  9. Uninterruptible power supply unit for 12 volts without battery - 700 rubles, with a battery 2000 rubles.
  10. Electric door lock drive for cars (for windows) - 250 rubles in a car shop
  11. Float water level sensors - 200 rubles

Electrical load management


The Relay Shield board is suitable for controlling electrical equipment, the number of relays must correspond to the number of devices + a margin for the future, you can always add. The picture shows a 4 channel board. We will turn on / off the pump, electromagnetic taps. If you use a servo drive or an electric door lock for a car, you can open / close the windows.

Environmental parameters


The environmental parameters are read in the greenhouse using temperature and humidity sensors. This data can be used for ventilation.

Lighting control

You also need a photoresistor that will turn on the lighting.

Autowatering

A moisture sensor is needed for timely watering if the earth dries out. But automatic watering must be regulated by several sensors, because. the beds are usually long, and the sensor will not be able to provide accurate data for the entire area.

Timer

For additional automation circuits, you should get an Arduino clock board. For watering, it is worth using a timer in conjunction with an air humidity sensor. You can do a lot of things with a timer, and if you still use a calendar, you can increase or decrease the illumination interval depending on the requirements of plants of different crops.

Access to the greenhouse via the Internet

If you don’t want to limit yourself to only the offline version of the automatic greenhouse, you can buy a special network shield for 10 bucks on the same aliexpress so that you can control the greenhouse via the Internet. We can also use the network to connect video cameras. You can follow our plants via the Internet.

SMS alert

I don't want to get ahead of myself, here's an idea that came to mind. For example, if water is not pumped into the tank, the pump is clogged, or the window is jammed and the temperature in the room rises above 80 degrees, all this can lead to the death of plants. If we live in a country house, then we can look into the greenhouse once a day to see if everything is in order with the plants. But what if we are in another city? I think it is necessary to make a security algorithm to check the boundary parameters of the greenhouse. If one of the parameters is approaching a critical point, you can send an SMS using the GSM shield for arduiono, it costs about 50 bucks for aliexpress. We will always be aware if our plants are uncomfortable, and we can call a neighbor to check if everything is in order with the greenhouse.

Airing

There are several ways to maintain the optimum temperature. For greenhouses, the optimum temperature is +22 degrees, the maximum is +30 degrees and the minimum is +16 degrees. To begin with, we will use an oil thermal drive, I don’t know the price, because. a specialized one costs from 1,500 rubles, but you can make it yourself from an old car shock absorber and additional capacity for better expansion. In general, the idea is this, when the temperature in the greenhouse rises, the oil in the thermal drive cylinder expands and pushes the piston, which is connected to the window, thereby opening it. And vice versa, as the temperature drops, the thermal actuator closes the window. If everything is calculated correctly, then electronic devices to maintain the temperature are not needed, but we will make a fully automated greenhouse, in case of extreme heat. And we will add more fans that will turn on if there are not enough oil thermal drives.

Watering

We have already read a lot about growing plants in a greenhouse, so we also do dynamic watering, and maybe adapting to certain plants. We receive the main data for watering from humidity sensors, but sometimes it is necessary to specially make special watering according to the timer at the time of maturation or growth. To do this, we will write a script for a specific type of plant, but in the main we will use a humidity sensor. For irrigation, a large barrel is used, preferably dark in color, so that the water is heated in it, cold water cannot be watered. The barrel is placed at a height so that there is little pressure. A valve is connected to the barrel, which lets water into the dropper system. For complete control, it can be divided into sections with valves so that they do not overflow or underfill in different places, and use a separate humidity sensor for each section. Two water level sensors (minimum and maximum) must be inserted into the tank. According to these sensors, the pump will fill the barrel if there is little water there and turn it off if the barrel is full of water.

We bring it all to life with the help of the program

Once we come up with the exact scheme of automation, we can start programming sketches. The writing of the program is based on the C++ programming language. On the Internet you can find many examples that you just need to adjust to your tasks and change the numbers. At first, you will need to adjust the parameters and almost manually configure everything, and debug it in the process, so you will have to constantly monitor and adjust. It usually takes a couple of days, one to set up the second to check, but it would be better to be constantly aware of what is happening in the greenhouse at first, otherwise the sensor may not be there and respond poorly to changes. But then, when everything is debugged, it will be possible not to worry about the microclimate in the greenhouse, and just collect fresh vegetables and berries from the garden. Arduino programming is not difficult, there are many examples on the Internet. This lesson can be called a constructor for adults, fun and useful. The only thing I would like to say with all this is that arduino can solve everything, but for industrial scale use or for high reliability is in question. For reliability, it is better to use ready-made devices, although the arduino has been working for me for several years without problems.

Growing crops in greenhouse conditions involves the organization of a certain microclimate indoors. Otherwise, the greenhouse becomes not only of little use, but can also cause irreparable harm to seedlings. Provide plants the necessary conditions you can do it on your own. But, it will be more convenient and efficient to automate the processes that affect the climate inside the greenhouse. How to automate a greenhouse using ready-made and home-made devices - read the article.

Modern devices for the automation of greenhouses and greenhouses allow autonomous operation of irrigation, heating and ventilation systems. Today, there are several ways to automate the processes on which . Each of them has its own advantages and disadvantages.

Automation in greenhouses differs according to the principle of operation (method of bringing the mechanisms into action) into:

  1. Electrical. Such automation is characterized by ease of installation, the possibility of fine tuning. The disadvantages of electrical systems include their high cost, compared with other types of automated systems, and dependence on the source of electricity.
  2. hydraulic. Such technologies are reliable and absolutely safe: they are based on the principle of expansion of liquids when overheated. The disadvantages of the designs are the slow response to a decrease in temperature.
  3. bimetallic. Bimetallic devices are based on the ability of various metals to expand. Such systems are ideal for automating the ventilation system. The disadvantage of bimetallic automation is that it is not capable of powering heavy equipment.

The above automatic systems can be installed on any equipment that needs battery life. The choice of automated structures depends on the gardener's budget, the presence of a power grid near the site, and the dimensions of the greenhouse.

More about automation for greenhouses in our material:

Automation for a greenhouse on a microcontroller

Greenhouse automation is possible thanks to accurate sensors that read temperature, humidity and lighting levels inside and outside the greenhouse, timers that transmit information to a special controller. After that, the control system, based on the algorithms built into the program, evaluates the readings from the sensors and makes decisions to turn on or off the greenhouse actuators.

It is the program controller that drives the irrigation system pump, fan and window closer, lighting and heating devices. Today, there are many controllers whose main task is to regulate the microclimate in the greenhouse. The price of the controller depends on the number of analog inputs and the memory of the device. The most affordable is the Atmega controller on the Arduino platform.

More information about the smart greenhouse based on the Arduino chip can be found at the link:

The automation program for the greenhouse on the microcontroller is focused, first of all, on such processes as:

  1. Setting the desired temperature and humidity.
  2. Turn on, turn off lighting fixtures depending on time of day and year.
  3. Management of the aeration system (opening and closing the windows, starting the fans when the air in the greenhouse is overheated).
  4. Management of the irrigation system depending on the stages of plant development.

Such automation allows you to achieve maximum results when growing even the most whimsical crops, but it has a high cost, so it can only be profitable on large and industrial agricultural facilities.

Greenhouse screening system

In large industrial greenhouses, to normalize the microclimate, greenhouse screening systems are also used. In the domestic economy, such systems show no less high performance.

The curtain system provides shading of the greenhouse, reducing the likelihood of overheating of the greenhouse due to solar radiation in the summer.

There are side and top screens of screening systems. At the same time, there are several types of canvases that perform different functions: full or partial dimming, saving thermal energy, keeping artificial light inside the greenhouse.

Often, to control the screening system, they use centralized control from a single automatic climate control system in the greenhouse.

If necessary, the Screen actuates the switch on the automation cabinet. In addition, the system can be included in the program of the general climate controller inside the greenhouse.

Homemade automatic greenhouse

To avoid financial costs, automated systems can be completely or partially made by hand. Of course, in order to create automation on the controller, you will need thermostats, cyclic and daily timers, a ready-made board diagram, communication channels with equipment. It will be much easier to organize automation for each individual process.

Most often, the irrigation system in the greenhouse is separately automated. The organization of the system depends on the dimensions of the panic. So, for small domestic greenhouses, a home-made drip irrigation system is often used.

The organization of drip irrigation has the following stages:

  1. Development of an irrigation scheme taking into account the individual dimensions of the greenhouse.
  2. Preparation of materials (drip hoses, water tank, filters, taps, connecting fittings, main pipe).
  3. Installation of the tank at a height of 0.1-0.2 cm, installation of filters for water purification.
  4. Wiring of the main water supply and branches of lines.
  5. Installation of overhead cranes on each branch.
  6. Connection of all components of the water supply using connecting fittings.
  7. Dropper installation.
  8. Filling the tank with water.

The semi-automatic irrigation system includes irrigation by solar distillation, in which water, evaporating from the reservoir, condenses on the hood and flows down to the plants through special gutters.

Installation of the machine in the greenhouse: thermovent for ventilation

The easiest way to control the temperature in a polycarbonate greenhouse is to install automatic ventilation vents. Most often, the automatic window is equipped with a thermal actuator, which sets the device into action when the temperature inside the greenhouse changes.

The principle of operation of the thermal fan is based on the ability of oils to expand when heated. In addition, on the thermal drive, you can set the desired temperature for automatic ventilation of the greenhouse. Expert advice will help you choose an automatic window opener:

The automatic mechanism is mounted on windows or transoms that do not have a large windage. The opener is installed inside the greenhouse, in the upper part of the structure to be opened. For its installation, you only need a screwdriver and self-tapping screws. The thermal actuator can also be mounted on the greenhouse doors.

Equipment: greenhouse automation (video)

Greenhouse automation is a modern, convenient way to increase yields in a greenhouse. All processes in automated greenhouses take place without human intervention, which is an indisputable advantage for gardeners whose garden plot is located far from their permanent place of residence. Having equipped the greenhouse with automation, you will stop worrying about how not to forget to open the window, turn on the lighting and heating devices in the greenhouse: the “smart” system will do everything for you, creating the most optimal conditions for the growth and fruiting of the crop!

GyverControl– a universal timer controller for a greenhouse and other places where automation is needed according to a timer or microclimate indicators / other sensors, has 10 separately configurable control channels, is assembled from inexpensive Chinese components and replaces several “store” controllers for various purposes: irrigation, lighting control, opening doors and more. It can be used both for greenhouses/beds, and for aquariums, terrariums, incubators and other automatic systems. Be sure to read the documentation on the controller (links above), it describes in detail about all the possibilities. Here is just a short list!

This project is completely open, that is, any of you can make a controller for a greenhouse with your own hands, GyverControl combines a controller for irrigation, lighting, ventilation and much more. The most important thing is that you can make yourself such a smart greenhouse controller at cost, i.e. at the retail price of Chinese components. And it's very cheap.

Iron:

  • ArduinoNano(ATmega 328p) as main system controller
  • 7 channels with 5V logic output, to which you can connect a conventional relay, solid state relay, power switches (transistors, transistor-based modules)
  • 2 channels servos, conventional model servos of large and small sizes are connected
  • 1 channel control of a linear electric drive with limit switches for limiting movement and with timeout operation
  • Air temperature sensor ( BME280)
  • Humidity sensor ( BME280)
  • 4 analog sensors(soil moisture or others)
  • Reference (real) time module RTCDS3231 self-powered
  • Big LCD display(LCD 2004, 20 columns, 4 rows)
  • Government - encoder
  • Support for DHT11/DHT22 humidity sensors, DS18b20 temperature sensors and thermistors

Software chips:

  • Storing all settings in non-volatile memory ( not reset on reboot)
  • Soil moisture sensors (all analogue sensors) are not energized, they are energized only at the time of the survey., which allows you to extend the life of even the cheapest soil moisture sensors (voltage is applied 50 ms before the poll and turns off 50 ms after).
  • Optimized data output to the display
  • Each of the 10 channels (7 relays, 2 servos and 1 drive) has individual settings and can work on a timer or on sensors
  • 4-6 operating modes per channel: three different timers and conditional operation from sensors, PID and dawn modes
  • Servo works with my library ServoSmooth, this ensures their smooth movement: smooth acceleration and deceleration with limitation top speed, as well as the absence of jerks and unplanned movements at system startup
  • The linear drive has limit switches,external buttons for management and speed setting movement. PWM driver frequency - 31 kHz, i.e. does not squeak
  • Debug Screen, where all current information about the state of hardware and sensors is displayed
  • Graphs temperature and humidity and readings from analog sensors for the last 24 hours
  • Service menu, allowing you to manually control each piece of iron

Application as greenhouse/box controller:

  • Intermittent watering (relay)
    • Scheme with individual pumps / valves
    • Scheme with one pump and several valves
  • Watering based on readings from soil moisture sensors
  • Lighting control (relay) with reference to the time of day
  • Ventilation (drive opens the window/servo opens the damper) by temperature or humidity sensor
  • Humidification (activation of the humidifier) ​​by air humidity sensor
  • Heating (turning on the heater) by temperature sensor
  • Performing servo actions (pressing buttons on devices, turning handles, turning shutters, moving objects) according to a sensor or timer

Application as aquarium controller:

  • Dawn mode for LED strips (via MOSFET) and incandescent lamps (servo drive)
  • PID controller for maintaining water temperature
  • Servos (2 pcs) for food dumping
  • The remaining channels can be used by timers to start filters / aerators / lights

Other uses:

  • The system supports 4 analog sensors, these do not have to be soil moisture sensors, the Chinese have a lot of other "module sensors" that similar connected to the diagram:
    • Light sensor: "smart" lighting system, backup lighting
    • Thermistor(up to 80 degrees): object heating control
    • sound sensor: closing the window when there is a lot of noise from outside (why not? =))
    • IR sensor(fire sensor) - different options for signaling, or even extinguishing (turn on the pump with water, open the servo tap)
    • Rain sensor: closing windows, signaling, turning on pumps for pumping out
    • Water level sensor/ water presence sensor: automatic filling of the tank, automatic pumping of water from the tank / basement by a pump, shutting off water lines in case of leakage, leakage alarm
    • Gas analyzers in the range: a signaling device or even ventilation (open the window) by level carbon monoxide and other industrial gases
    • Optic obstacle sensor: fantasy is needed here
    • Potentiometer: as an additional system control body
  • The servo is a fairly versatile thing, it can open / close the dampers, it can press the buttons of other devices, rotate the adjustment knobs of other devices, with an attached connecting rod it gets the ability to linearly move objects / sliders of other devices. There are servos different sizes, from micro (2 kg/cm) and medium (13 kg/cm) to very powerful (50 kg/cm)
  • The relay can close the power contacts and control any devices, the relay can also turn on the power supply (for example, an LED strip). The relay can be placed in parallel with the wires to the button of another device, and it will turn it on or off.
  • Version 1.4 and above allows you to maintain the temperature using a PID controller, for
    terrariums / incubators / any temperature maintenance:
    - Send a PWM signal to a field effect transistor that controls heating
    - Turn the servo knob of the network dimmer
  • Version 1.4 and above has a Dawn mode that allows you to use the controller to
    aquarium / terrarium and other "animal farms"
  • The main governing body is encoder, the handle of which can rotate and press(she is a button). When the system starts, we get to the channel 0 setting. By rotating the encoder knob, you can move the selection cursor (arrow) through the menu items. To change the value of the selected item, you need to press the encoder knob and turn it while holding it pressed. You can also click on the button, the cursor will change from an arrow to a checkmark > , and by rotating you can change the selected value. Clicking again will return an arrow with which you can select another menu item. Hold down turn while channel name selected - change channel to tune. We scroll to the right and we will have 7 relay channels, two servos and a linear drive in order.
  • To go to the mode setting, you need hover over it and click the button without turning. A window for setting the mode will open, which can be exited by clicking on the inscription BACK (back). By holding and rotating the knob on the selected mode name, you can change the mode, there are 4 in total.
  • At the root of the menu(channel selection) scrolling to the left of channel 0 will be the debug screen ( DEBUG) and service mode ( SERVICE). The debug screen shows all the current positions of relays, actuators, and sensor readings. Turning the crank on the debug screen sequentially scroll through daily charts readings from sensors: air temperature, humidity and readings from analog sensors. Divisions on the graph have a step 1.6 hours. On the service screen, you can control any channel in manual mode; when the service screen is active, the automation does not work, the system is completely in manual mode. By turning the knob, you can select the desired channel, servo position or current time setting, and change it by holding the turn.
  • If a turn on the system with the handle clamped encoder, will happen full reset channels and modes.

Channel modes

  1. Timer– simple periodic timer: periods are set PAUSES and time WORKS in HH:MM:SS format. With the PAUSE period, the selected action is performed and performed during the OPERATION period. For example, PAUSE costs 1 hour, WORK costs 10 seconds. Every hour there will be an action for 10 seconds, that is, if a relay channel is selected, the relay will turn on and off after 10 seconds, then turn on again after an hour and turn off after 10 seconds, and so on. How the channel behaves in the OPERATION section is set in the DIRECTION parameter, that is, it can be on off and off/on(relay), right left and left right(servo) and open close and close/open(linear drive). This mode is not tied to real time, rebooting the system resets the current timer. Attention! WORK should not be longer than PAUSE!
    • Min. value: 1 second
    • Max. value: 999 hours
    • Real time tethering: no
  1. TimerRTC- a periodic timer, unlike the previous one, has a link to real time, has a setting PERIOD inclusion and duration WORKS(in seconds) to be performed, and START– the initial hour from which the countdown of the period begins ( for periods longer than 2 hours). For example, period 15 minutes, work 10 seconds: every 15 minutes, an action will be performed for 10 seconds. Real time binding works as follows: the action will be performed with the selected period from the beginning of the hour, that is, if 15 minutes is selected, then the action will be at 0, 15, 30 and 45 minutes everyone hours. If the selected PERIOD is more than an hour (from two or more), then you can select the START hour from which the countdown will start. All periods are multiples of 24 hours, so work starts at the same hours every day! Example: PERIOD 8 hours, start hour 0. The action will be executed at 0000, 0800 and 1600 every day. If you set the start hour (START) to 3 o'clock, then the action will be performed at 3, 11 and 19 o'clock every day. When the power is reset, the next action will be performed in the near time of the "alarm clock". Attention! WORK should not be longer than PERIOD!
    • Selectable periods: every 1, 5, 10, 15, 20, 30, 60 minutes and 1, 2, 3, 4, 6, 8, 12, 24 hours
    • Application: irrigation in hydroponic systems, ventilation without sensor
Period Once a day When it works
1 minute 1440 Every minute
3 min 480 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57 min. every hour
5 minutes 288 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 min. every hour
10 min 144 0, 10, 20, 30, 40, 50 min. every hour
15 minutes 96 0, 15, 30, 45 min. every hour
30 minutes 48 0.30 min. every hour
1 hour 24 Every hour
2 hours 12 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22 hours of each day (+ start hour shift)
3 hours 8 0, 3, 6, 9, 12, 15, 18, 21 hours of each day (+ start hour shift)
4 hours 6 0, 4, 8, 12, 16, 20 hours of each day (+ shift by starting hour)
6 hours 4 0, 6, 12, 18 hours every day (+ start hour shift)
8 ocloc'k 3 0, 8, 16 hours every day (+ shift by starting hour)
12 hours 2 0, 12 hours every day (+ shift by starting hour)
24 hours 1 0 hours every day (+ offset by start hour)
  1. week(former Day) - a simple timer for one action with real-time reference, has a setting On(time in HH:MM:SS format) – the time from which the action is active, and Off(time in HH:MM:SS format) – time from which the action is not active. There are also 7 "cells" - days of the week days, from Monday to Sunday. When reloading, the action will return to the correct position according to the current time. Example: the timer is set to 6 and 20 hours (Start and Stop). The action corresponding to the current channel and the Direction parameter will be active from 6 am to 8 pm, and inactive from 8 pm to 6 am the next day. During a sudden reboot, the system will perform the action as it should be at this time interval, that is, from the previous example, if a sudden reboot occurs between 6 and 20 hours, the system will activate the action on the channel at startup. Attention! On must be less than Off!
    The mode also has a setting Global, which forces any other mode to work "on schedule" Week. What it gives: for example, you can set up watering on Tuesday and Friday from 17 to 18 pm (from the barrel), check the global box and set the Sensor mode for watering. How it will work: the system will water this canal according to the Sensor mode, but it will only do it according to the schedule (Tuesday and Friday 17-18).
    • Day of the week selection
    • Time selection: 0-23 hours, multiple of 1 hour
    • Real time tethering: yes
    • Application: ideal for lighting and occasional watering
  1. Sensor– action based on the sensor. With polling period PERIOD the selected sensor called SENSOR and when the threshold value is exceeded THRESHOLD an action is performed according to the selected channel (relay/servo/drive). The polling PERIOD is specified in seconds or minutes (as you increase). The sensor is selected from the list: T.VZD.- air temperature, V.VZD. SENS_1 on SENS_4. The threshold value is set from 0 to 1023 in steps of 1 up to 50 and in steps of 10 starting from 50 (soil moisture sensors have a value range of 0-1023). For example, an air temperature sensor is selected, the polling period is 1 hour and the threshold value is 25. Every hour the system checks the temperature, if it exceeds 25 degrees, the action corresponding to the channel will be performed (turn on the relay, open the window). An hour later, the check will be made again.
    • Application: opening/closing flaps based on temperature/humidity (actuator), irrigation based on soil moisture, fan/humidifier control (relay) or dampers (servo) based on temperature/humidity.
  1. PID(for channels 3, 4 and servo) – proportional-integral-derivative controller, allows to maintain the controlled value with high accuracy (heater-temperature, damper-temperature, fan-temperature, fan-humidity, and so on). The mode is available for channels 3 and 4 (marked with an asterisk), as well as both servo channels in servo mode. Has odds settings P, I, D(D will probably not be useful to you in real work, but it is still there). Choose Sens– input signal source – one of the sensors, as in the Sensor mode ( Airt.- air temperature, Air h.– air humidity and 4 analog sensors (soil moisture) with SENS_1 on SENS_4). Setting set indicates to what value of the reading from the selected sensor the regulator will try to bring the system. Setting
    T sets the iteration period of the calculation, for slow processes it makes sense to set more (read in a separate chapter "Tuning the PID controller"). Settings min and max are responsible for the minimum and maximum control signal from this channel, for channels 3 and 4 it is a PWM signal, the operating range is 0-255. For servo channels, this is the angle, 0-180 degrees.
    Application : maintenance of a given value (temperature, humidity) in a non-relay way, i.e. smoothly and without sharp inclusions. The PWM signal can drive the transistor that is responsible for the heater. The servo can turn dampers (ventilation) or dimmer knobs to control network heaters, fans and other equipment.
  1. Dawn(for channels 3, 4 and servos) - "dawn" mode for controlling lighting with a smooth dawn and sunset. The mode is available for channels 3 and 4 (marked with an asterisk), as well as both servo channels in servo mode. Turns on smoothly Start for Dur minutes, then turns off at the hour Stop during Dur minutes. Turns on up to the maximum value specified in max, and turns off until min. On channels 3 and 4, this value sets the duty cycle of the PWM signal, the operating range is 0 - 255. You can control a field-effect transistor, for example, an LED strip. On servo channels, the operating range is 0 - 180, degrees of rotation of the servo shaft. It can control the mains dimmer knob, for incandescent or dimmable LED lamps.
    Application: organization of lighting conditions close to real, for aquariums, terrariums, chicken coops, etc.

Relay channel settings

  1. Direction– how the relay behaves when activated by a timer/sensor. ON OFF or OFF-ON
  2. TYPE OF– relay operation logic
    • Relay- the relay channel behaves like a normal relay, can be used to control any DC or AC load (control network devices): watering with individual pumps, watering with individual valves from a pressurized water source, controlling humidifiers, heaters, fans, lighting devices and everything else similar. Does not depend on other channels.
    • Valve- type of relay channel for a system where there is a common pump / valve from a water source and several individual valves for watering different areas. A relay channel configured as a valve simultaneously with its activation (by timer/sensor) activates another channel/channels configured as general.
    • General- type of relay channel for a system where there is a common pump / valve from a water source and several individual valves for watering different areas. A relay channel configured as common has no mode settings. Instead, he activated by itself simultaneously with any other channel configured as valve. Automatically deactivates itself when there are no inactive valve channels.

Servo channel settings

  1. Direction– how the servo behaves when activated by a timer/sensor. turn in direction MIN-MAX angle or vice versa MAX-MIN corner
  2. limits– servo rotation angles from 0 to 180 degrees in steps of 10
  3. Additionally: in the sketch in the settings section there is a setting for the maximum speed of the servos (SERVO1_SPEED and SERVO2_SPEED) and their acceleration for acceleration and deceleration (SERVO1_ACC and SERVO2_ACC). I did not add them to the settings of the service menu and channels, because. they are not needed very often.

Drive channel settings

  1. Direction– how the drive behaves when activated by a timer/sensor, OPEN CLOSE or CLOSE-OPEN
  2. Time-out- the time that the signal will be given to the movement of the drive. The limit switch (if any) will interrupt the movement of the drive

Dear colleagues!
I would like to slightly supplement the publications already available on the forum with a small article that complements the series of affordable automation for summer cottages. STM32 as a series of microprocessors may well complement the group of automation devices built on Arduino.
A bit of history - why such a system was born at all. Most recently, I became the proud owner of 140 remontant raspberry bushes, and of course, I made a landing. Despite the fact that efforts have been made, the result was deplorable. The planting was covered with mulch and equipped with drip irrigation - but more than half of the bushes turned out to be unviable by autumn. Moreover, surprisingly, no pests or diseases were noticed. That was the impetus for starting work.
First of all, a water analysis was carried out - and it turned out that the water has a composition that is not very well perceived by raspberries. The sad news is that it is impossible to use water, which is simply in abundance on the site, without a special preparation system. Of course, the Internet is to help me - and the results are simply shocking ... The price of a finished system exceeds 270 thousand rubles, and you can’t just buy it - it’s made individually, and for my volumes, Sony has too much performance. It became a shame for the state - and now, after a year (!) of work, a system was born that successfully passed the tests and this year will manage the watering and top dressing of my plantings. And not just raspberries.
Actually, you will rightly notice - these are open landings, and here closed ground is being discussed. Yes - the fact is that my colleague, who has 3 greenhouses, became interested in the project. And now controllers have been made for him in a small series, the photos of which you see below

A few technical details - a debug board with stm32f103c8t6 installed is used as the main board. Power supply 220V AC, there is a galvanically isolated RS485 bus and also a galvanically isolated 1-wire bus. The controller is freely programmable - it is fully compatible with the Mitsubishi FX2N controller by commands.
Supports Modbus RTU exchange protocol both master and slave. Also has a 2nd serial communication port - but only modbus RTU slave support.
Due to the presence of a 1-wire bus, it easily works with common DS18B20 temperature sensors. And it supports up to 128 pieces.
Also in this publication I would like to add a video of the operation of a system of 4 controllers operating via the modbus bus.

Why did I decide to post this? Yes, it's very simple - after all, not everyone can pick up a soldering iron and assemble what he needs. This controller makes it possible to realize any idea or idea of ​​a farmer without special knowledge.
A little chaotically described the system - excuse me. If you have any questions - you are welcome, I will answer as much as possible. Also, if this post is missed, I will publish materials on how this system will be installed in the greenhouse. I hope this experience is helpful.