For bathroom

Greenhouse control circuit using Arduino. Automatic greenhouse with ventilation and watering

Dear Colleagues!
I would like to slightly supplement the publications already available on the forum with a small article that complements the series of accessible automation for summer cottages. STM32 as a series of microprocessors may well complement the group of automation devices built on Arduino.
A little history - why such a system was born in the first place. Just recently I became the proud owner of 140 remontant raspberry bushes, and of course, I planted them. Despite the fact that efforts were made, the result was disastrous. 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. What’s surprising is that no pests or diseases were noticed. This was precisely 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 accepted by raspberries. The sad news is that this means that without a special preparation system it is impossible to use the water that is simply available in excess on the site. Of course, the Internet helps me - and the results are simply shocking... The price of a ready-made system exceeds 270 thousand rubles, and you can’t just buy it - it’s made individually, and for my volume the Sony has too much productivity. It became a shame for the country - and now, after a year (!) of work, a system was born that successfully passed tests and this year will control the watering and fertilizing of my plantings. And not only raspberries.
Actually, you will rightly note that these are open plantings, but here we are discussing closed ground. 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, photos of which you see below

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

Why did I decide to make such a publication? Yes, it’s very simple - after all, not everyone can pick up a soldering iron and assemble what they need. This controller makes it possible to implement any farmer’s idea or idea without special knowledge.
I described the system a little chaotically - sorry. If you have any questions, you are welcome, I will answer everything as much as possible. Also, if this post is missed, I will publish materials on how this system will be installed in a greenhouse. I hope this experience will be useful.

Schematic diagram and installation example in

greenhouse thermostat on the ATmega8 microcontroller.

One way to heat greenhouses is to use electricity. With good and smart automation, it is possible to ensure a high efficiency of the heating system, as well as ease of maintenance and automation in maintaining the set temperature. The efficiency of a greenhouse can be significantly increased by heating the soil and maintaining air temperature. When developing this device, a homemade 5 kW electric boiler was used. Two heating elements 2+3 sq. You can use one heating element at a time; it’s warm outside now, so one heating element can cope with the task quite well. Heats a greenhouse 11 by 5 meters, the height in the center is 3 m, double film, the greenhouse is one meter deep into the ground. The control unit monitors five points and controls three circuits. Two - warm bed, room temperature. In the device menu, you can set your own temperature and hysteresis for each circuit. Day and night temperatures are set separately for each circuit.

The thermostat also provides control of the coolant temperature for emergency shutdown of the boiler in case of overheating, as well as the ability to connect a temperature sensor to monitor an additional parameter (for example, outside air temperature). The transition time from day to night mode and vice versa is set in the menu and is common to all circuits. The operation of the pump is controlled by an automation unit. If the temperature reaches the set parameters and the boiler turns off, the pump will continue to work for the set time and turn off. One common pump is used for warm beds and indoors. Warm beds and air temperature are controlled by 12 volt electric valves. Schematic diagram of the thermostat:

This is what a photo of the soldered board looks like from the track side:

1.Instructions for operation of the automation

The thermostat microcontroller works with 5 DS18B20 sensors. The sensors are connected to one bus. It may be necessary to reduce R1. MK distinguishes sensors by their serial number. During manufacturing, the first time you will have to determine at random which sensor is responsible for what and install them accordingly.

Data is displayed in integer format, tenths are discarded, and leading zeros are suppressed. Temperature range from -9 to +99 degrees. When the temperature goes outside the limits or when there is a sensor error, the display shows instead of the readings of the corresponding sensor.

When connecting for the first time, if all 5 sensors are successfully initialized, their serial numbers will be written to the EEPROM. This will allow it to work correctly in the future if some sensors are removed or faulty. If you replace sensors, you must erase the EEPROM and turn on the device. It is currently only possible to erase EEPROM in the programmer. Then maybe I’ll figure out how to do it through the menu. The MK will work without 8 MHz crystal. FUSE must be set accordingly. Indicator based on HD44780 processor.

2.Working with a thermostat

1.The “MENU” button scrolls through the menu pages in a circle.

2.In the settings menu (Setup), the option available for setting flashes.

3.Installation using the PLUS/MINUS buttons as usual.

4. Clock on DS1307. The time is displayed in the format hh:mm:ss. 24-hour display format. Access to the clock through the menu. Time settings are available on the page - in turn: seconds (PLUS/MINUS buttons reset the seconds value), minutes, hours. The time for turning on the day mode is set - day and the night mode - night. For modes, the output format is hh:mm. Clock settings are stored in the DS1307's memory.

5.Move from one parameter to another using the UP/DOWN buttons. The buttons operate with a single press, regardless of the duration.

6.After 10 seconds from the last press, the settings will be written to memory. The display will go to main mode.

7.When you press any button, as well as when power is applied, the backlight turns on. The backlight will turn off 30 seconds after the last button press.

3. Boiler control algorithm

1.When power is supplied to the device, the controller polls the sensors and reads information from the real-time clock. The controller compares the current time with those set for day and night modes and selects the appropriate settings for the operation of the thermostats.

2.After about 5 seconds, the device is activated and begins to control the boiler.

3. If the temperature from the Pol-1, Pol-2 or Office sensors becomes below the set value, then the pump and heater are switched on and voltage is applied to the corresponding actuator for supplying coolant to this circuit. When the temperature rises above the set value by the hysteresis value, the heater turns off, the pump remains in operation for 30 seconds to ensure cooling of the heating element to a safe temperature. To ensure water flow through the boiler circuit, the coolant supply remains open to this circuit while the pump is operating. If the operation of the boiler is necessary for another circuit, then the coolant is switched off to the already unnecessary circuit immediately.

4. Emergency mode

1.If the coolant temperature has exceeded the one set for the Boiler parameter, regardless of the state of the sensors, the pump is turned on, the heater is turned off, and the Office circuit is opened to ensure water flow through the boiler.

2. If the sensor of any circuit malfunctions, this circuit is considered to be turned off; if the heater was working through it, then after 30 seconds the pump and circuit will turn off.

3. In the event of a malfunction of the coolant temperature sensor while the boiler is running, the device will switch the boiler to the mode as indicated in clause 4.1.

Vitaly

Greenhouse controller using Arduino

This year I built a greenhouse with an area of ​​30 square meters. m. for tomatoes. Initially, I planned to cover it with polycarbonate, however, after weighing the pros and cons, I decided to use a copolymer ethylene vinyl acetate film. Well, now that the season is ending, I can already say that I made the right choice and the greenhouse pleased me with a quite decent harvest (approximately, about one and a half centners). The dimensions of the greenhouse are 3.8 * 8, i.e., approximately 30 square meters. m of total area, of which approximately 24 sq. m. useful. Ventilation was carried out naturally through open doors and vents located at the ends of the greenhouse. The maximum temperature in the greenhouse with the doors and windows open did not exceed the outside temperature at the peak by more than 5 degrees, although there are no windows at all on the side surfaces of the greenhouse. If I had used SPK (cellular polycarbonate) to cover the greenhouse, the temperature in the absence of vents in the roof would have risen to over forty. In addition, the transparency of the film used, like that of a monolithic PC, is high - 92%, which ensured that the tomatoes bore fruit very well and were clearly in a generative mode due to the abundance of light. With SPK, although the transparency of each layer is approximately the same, the percentage of light passing into the greenhouse is significantly less - 92% * 92% = 84%, plus some is lost on the partitions, which ultimately gives transparency no higher than 82%. As a result, plants receive significantly less light and enter a more vegetative mode, producing more leaf mass and less tomatoes. And in addition, you have to constantly deal with the formation of leaf mass, which is in excess due to plant competition due to lack of light.
In my greenhouse, due to the abundance of light, I didn’t have to worry about tearing off leaves at all, I just broke off the stepsons; there were few leaves on the plants, but a lot of fruits. However, another problem arose - light burn of leaves and fruits. On the leaves this was manifested in the yellowness of young leaves, which formed shortly before the onset of heat, and on the fruits - in the appearance of white sides on the fruits on the side facing sunlight. This factor had a very negative impact on the harvest, which could have been much larger, and also led to the fact that by the fall the bushes did not retain their full appearance, and even late blight tried. Then I still knew nothing about late blight - how it arises, what contributes to its spread. Then I learned that it’s not so much the cold that’s terrible for tomatoes, but the “bath” - when plants spend a long time during the day, like in a steam room, which occurs if the sun is already in the sky and the greenhouse is completely closed. All summer I did not close the greenhouse at all; neither day nor night, regardless of any weather changes, the doors and windows were constantly open. However, closer to autumn, when, due to cold nights, the greenhouse must be closed at night, when fungal diseases begin to rage, and temperature changes between night and day, and therefore condensation, increase sharply, the windows not opened in time can help you at a time finish the season. This is exactly what happened to me - the tomatoes were almost “wet” all day at a temperature of 20-30 degrees. and everyone fell ill with late blight due to the fact that at the moment I did not have any ventilation automation, and I could not come to the greenhouse every day. As a result, I had to throw away 7 buckets of tomatoes, mostly almost red and pink ripe.
What’s interesting is that, despite the total disease of late blight, as soon as I eliminated the causes of the disease and began to monitor the opening and closing of the windows in a timely manner, the bushes began to continue to grow and produce more or less healthy fruits, so in September I practically removed almost all harvest. During October, we managed to harvest about 8 additional buckets of fruit, and now there are still about a hundred ripening there.
In the future, I will continue to describe how I came to the conclusion about the need to use an automatic temperature and humidity control system and why it is better to make the control system based on a controller. Then I’m already thinking about moving directly to the project. In general, this topic is not about what has already been done, but about what I am just about to do - the topic is about further improving the greenhouse, and I firmly decided to develop and implement the system. If you want to participate in the discussion of this topic, you are welcome; you do not have to wait for me to finish presenting this prelude, especially since it is, in general, not obligatory.

Registration: 06/23/13 Messages: 5,837 Thanks: 6,261

Vitaly

Registration: 06/23/13 Messages: 5,837 Thanks: 6,261 Address: Bryansk

I returned home and continue. Below you can see several photos of the construction of the greenhouse and the ripening of the crop. This year I didn’t have any seedlings - there were only enough tall varieties for the outer beds, and even then not completely, the rest was planted with low-growing ones. Moreover, half of the tall ones and all the short ones were frozen on the window and they were delayed in development for almost 2 months. We planted the seedlings in a permanent place late - on June 1 and 2, and I covered the greenhouse only on July 21, and only because the weather outside at that time had completely deteriorated, it was cold, it was raining continuously, so I had to cover it in a strong wind and as soon as they threw the film on, it started to rain. And literally on the second day after sheltering, the weather changed sharply and it became hot. The tomatoes did not endure such a sudden transition very easily, considering that in the evening, when I covered the greenhouse, I did not have time to make windows and doors, and the greenhouse stood the next day until 12 o’clock, completely covered, while I came to finish it.
Literally after 2-3 days I realized that I couldn’t cope with temperatures over 30 in the heat, if only because it was sometimes up to 33 outside. I thought for a long time about how to solve the problem, I really didn’t want to cover the greenhouse from the sun, because a decrease in illumination by 1% is equivalent to a decrease in yield by 1%, and in the spring it is even more - the harvest is lost by 1.5%. One of the options was to install sprayers on the roof of the greenhouse, which would be triggered when the temperature in the greenhouse rose above 30 degrees, the other was to make 3 doors on each side, the possibility of which was included at the design development stage. Moreover, the doors were supposed to be made as openings into which frames covered with anti-mosquito netting or frames covered with film could be inserted if it’s cold, but I decided not to do this at the manufacturing stage.
It took me a while to learn that there is a very effective way to quickly lower the temperature in a greenhouse using foggers, which at the same time allows you to adjust the humidity in the greenhouse. Now I have decided to include foggers - foggers - in the climate control system, and return to shading if for some reason this measure turns out to be insufficient to keep the temperature at 25-30 degrees. and the exception is the formation of white barrels on tomatoes due to a combination of strong lighting and high temperature, although I think everything will be fine.
Next I will tell you about my conclusions about what temperature conditions tomatoes need to be provided during the day for their normal growth and development, how this can be ensured and why ventilators based on hydraulic cylinders are completely unsuitable for these purposes.
And here are some photos:

Attachments:

Last edited: 10/20/15

Registration: 06/23/13 Messages: 5,837 Thanks: 6,261

Vitaly

Registration: 06/23/13 Messages: 5,837 Thanks: 6,261 Address: Bryansk

Temperature

Based on the initial experience of operating a greenhouse gained this year, I concluded for myself that there is no more important task in the process of growing plants in it than the task of temperature regulation. This is equally important for a greenhouse with any covering, be it film, SPK, or profiled polycarbonate. Of course, there are coatings in which this issue is practically not relevant - these are not transparent coatings, but white coatings and mesh greenhouses, but we will not consider these options here. Moreover, in this topic I decided to limit myself to considering the regulation of the parameters of a greenhouse made exclusively for tomatoes.
The fact is that each plant has its own favorite range of temperatures, humidity and other parameters. In order not to lose my thoughts on where I got these specific temperature levels required by tomatoes, which I will give below, I leave it to you, if the need arises, to check them and clarify them. I won’t even mention it again, but will simply copy what I said recently in this thread:

What, exactly, is required to create even the most primitive climate control in a greenhouse? For tomatoes, for example?
All you need to do is monitor the temperature outside and open the windows as early as possible in the morning, when the temperature outside rises above about 12 degrees, in order to dry the leaves and fruits from condensation, you need to open the windows and doors when the temperature in the greenhouse rises above 25 degrees. and turn on the foggers when the temperature rises above 30, and turn on the heating of the greenhouse when the temperature in it drops below 12.
That's probably all. If you add some other automation, I’m afraid it will not be better, but worse. For amateur greenhouses at this level, this minimum is perhaps optimal, allowing them to obtain a decent harvest of healthy products, and not the crumbs that the majority now have.

And another fragment:
The question is how much is this in demand?
Not by any means, unfortunately. In order for something to be in demand, there must at least be awareness of the need for it. And at what level many people argue here can be judged by a fairly typical statement: My cucumbers grow in the same greenhouse with tomatoes and bear fruit beautifully. Well, what can you explain to a person who is not familiar with the basics of agricultural technology? And since he has zero understanding of the need to maintain some kind of climate in the greenhouse, he naturally has no demand for systems that support it. he will read this and say something emphemistic, like: “The tomatoes will be golden,” or maybe he will express himself more clearly and rudely, like: “The cat has nothing to do... well, etc.
Many people prefer to simply build entire sarcophagi for plants with complex underground heat storage systems and pay 200 thousand or more for them (no offense to them, they are not doing this for mercantile reasons), instead of installing at least the simplest thermoregulation system, and they also claim that there is no other way (but this is an insult).
Now let's look at it from the other side. There are people who are well versed in electronics and programming, and they can easily make a very inexpensive control system, but I don’t see even one of them saying: For a tomato, you need to provide this, that, and that. And then their development could become very valuable for many, at least for those whose consciousness is not blinded by the need to build sarcophagi - the same dinosaurs from the point of view of automatic regulation, like an ordinary film tunnel, even if it was called pretentiously, say, "Ivanov's solar vegetarian"
Yes, about the need for a special thermostat. If you use a separate device to regulate each individual parameter, it will not work out either simply or reliably. I'm afraid that to implement the minimum I specified, it is no longer possible to do without a controller.

Yes, you say, we’ll make the device in a minimalist form, and then it turns out that there’s still a bunch of things that need to be taken care of, alterations will begin, and the cost will rise. Fortunately, automation based on software devices differs from hard automation schemes in that changing control parameters and introducing new functions is not difficult, and costs increase mainly only for additional sensors and actuators, and only the program changes in the system itself . Therefore, it is quite reasonable, in the first stages, to limit as much as possible the number of functions performed by regulating only temperature and humidity, so as not to waste extra effort and money.
Humidity in a greenhouse is as important a parameter as temperature, but these parameters are strongly related, therefore, by adjusting the temperature, we will at the same time change the humidity, and it is not the absolute humidity that is important, but the relative humidity. For the sake of simplicity, it’s not worth worrying too much about it for now, it’s better to focus only on temperature regulation, but more on that next time, where I’ll try to list all the necessary equipment to create a minimal control system and roughly estimate how much it will cost.

Registration: 06/23/13 Messages: 5,837 Thanks: 6,261

Vitaly

Registration: 06/23/13 Messages: 5,837 Thanks: 6,261 Address: Bryansk

More about temperature

I was thinking, I probably need to describe in a little more detail the reasons why the temperature in the greenhouse should be regulated exactly within the limits that I described above.
The fact is that the growth of southern plants at temperatures below 12 degrees. it stops altogether, and if it’s even lower, they begin to wither and contract various diseases, so you can’t open the greenhouse when the outside temperature is below 12. On the other hand, in the morning, abundant condensation collects on the leaves and fruits in the greenhouse. If you allow a “bath” when the bushes are wet and the temperature rises to 20 and above - this is paradise for late blight - it’s better not to. This way you can ruin the entire crop very quickly. Therefore, you need to open the windows as early as possible. In the summer in the middle zone, the easiest way is to simply not close the windows and doors at all, but somewhere in August, depending on the weather, you need to switch everything to automatic.
The optimal temperature for tomatoes is 25 degrees. If it rises higher, you just need to open the ventilation vents. If the temperature rises above 30, this is fraught with damage to the leaves from overheating, sterilization of pollen, sunburn and other troubles, so when it reaches 30 degrees. foggers - foggers that effectively lower the temperature by several degrees - should work.
If the temperature in the greenhouse drops below 12 degrees, then, I think, this is already clear - I described it above - any type of heater should turn on. In the fall, when you just need to ensure the growing of the set fruits, I think you can lower this threshold to 6-10 degrees in order to save energy. By the way, heating up to 40 degrees during the day is not so dangerous, since the tomatoes are already at the growing stage and sterilization of the inflorescences is not dangerous. If your tomatoes are already infected, then such high-temperature heating will kill late blight, therefore, for the purpose of disinfection, you can intentionally leave the greenhouse completely closed for several hours on a sunny day, just so that the temperature in the greenhouse rises above 30 degrees. After this, the greenhouse must be thoroughly ventilated. Actually, that’s exactly what I did and maybe that’s why the tomatoes in my greenhouse are still alive.
Well, that’s probably all. Even if this is only implemented, the plants will be in much more comfortable conditions and will produce a much larger harvest than in a greenhouse, in which the temperature jumps from 35 degrees. during the day up to 5 degrees. at night. In any case, such an algorithm is quite suitable as a reliable basis, and then the question of further optimization will become clearer during practical operation.

And now - about the minimum set of equipment that will be needed for the control system.

Set of equipment for the controller

1. Controller - 1
2. Display unit (screen) for the controller - 1
3. Power supply 12 V for the controller - 1
4. Outside temperature sensor - 1
5. Internal temperature sensor - 1
6. Heat gun - 1
7. Electric door drives (actuators) - 2
8. Electric drives for transoms (actuators) - at least 2, for greenhouses made of SPC - more
9. Foggers (foggers) - for a greenhouse 8 m long approximately 8
10. Cabinet for placing equipment - 1
11. Residual current device - 1
Well, to ensure autonomy, in the event of a power outage, a solar panel - and a battery - 1. And, along the way, there are various other little things, such as pipes for electrical wiring, the wires themselves, etc.
I’m not giving the cost of each piece of equipment now - I’m just kind of lazy and have a little time, anyway, this will be gradually clarified, the best options, suppliers, models will be selected, so I hope interested participants will help decide on this issue.

Last edited: 10/21/15

Vitaly, it is not clear to whom your such a very detailed speech is addressed. Judging by the fact that you are going over the basics in detail, most likely it is for beginners, because everyone else seems to be familiar with the above. The topic of greenhouse automation that you raised is undoubtedly necessary and important, but the path you have chosen raises some skepticism.
I don’t claim to be the ultimate truth, but as I see it, the project usually starts a little differently. First, goals and objectives are discussed and set, technical specifications are drawn up, and appropriate solutions are selected. Sometimes even one small point of the technical specification crosses out the use of any solution methods, narrowing the areas of available tools. Something like this in a nutshell. You have already immediately chosen the Arduino platform. Then explain why exactly her, and not, for example, raspberry PI or something else. Arduino Very elementary platform. When choosing it, you have to assign a very limited set of tasks to it, greatly narrowing your desires. Until now, very basic crafts have been made on it. There were regrets from enthusiasts working on it that it “does not cope” with many tasks. Also, it seems, the set of sensors for it is very limited. I am not against automation and discussion, but, for me personally, building a system on Arduino is not of practical interest. So I’ll be curious, maybe I’ll come in and read it and that’s it.
Don't limit the topic to just one platform, and don't dismiss the possibilities for enthusiasts of other platforms. Then the topic may become more crowded and useful solutions will appear more often.

P.S. If this topic was created only to describe your experiments with Arduino, then I apologize in advance for getting into the wrong place with advice. I’m already talking about what I want to have in the greenhouse, so to speak, the minimum technical specification visible to me.

  • Registration: 06/23/13 Messages: 5,837 Thanks: 6,261

    Vitaly

    Registration: 06/23/13 Messages: 5,837 Thanks: 6,261 Address: Bryansk

    Vitaly, it is not clear to whom your such a very detailed speech is addressed.
    ...as I see it, the project usually starts a little differently. ...You have already immediately chosen the Arduino platform. Then explain why exactly her, and not, for example, raspberry PI or something else. Arduino Very elementary platform. When choosing it, you have to assign a very limited set of tasks to it... Until now, very basic crafts have been done on it. There were regrets from enthusiasts working on it that it “does not cope” with many tasks. Also, it seems, the set of sensors for it is very limited. ...for me personally, building a system on Arduino is of no practical interest. ...Don't limit the topic to just one platform, and don't throw away the possibilities for enthusiasts of other platforms. Then the topic may become more crowded and useful solutions will appear more often.
    ...I’m already talking about what I want to have in the greenhouse, so to speak, the minimum technical specifications...

    In general, for every active forum participant who writes comments, judging by statistics, there are 200-300 simply reading. So who do we refer them to? Are they newbies? Or are there many advanced people among them who simply do not want to enter into a discussion that seems small to them, or do they simply not have enough time to participate in discussions? On the other hand, if there is a group that doesn’t need to learn the basics, then we don’t see them developing in this area. Such discussions have arisen on this forum more than once, but the result is not noticeable. I know of only 3 examples of perhaps successful greenhouse automation. The first example - I gave the link above, the second here: I don’t remember, however, whether it really has an implementation on a microcontroller, and even SergeiL’s greenhouse operates under the control of a Samsung-based controller.

    Naturally, I chose the Arduino platform for myself, and if in the process of implementing the system on it I encounter difficulties, I, as they say, will be responsible for it. But I immediately stipulated that I do not intend to somehow limit the freedom of discussion in this topic and am ready to discuss any aspects, except, of course, simply blurting out the question. So please discuss any platform if you find a correspondent. I have already decided where to stop, because if among those discussing there is not a single one who has decided, then, accordingly, there will ultimately be no result.

    And regarding the fact that Arduino is a very elementary platform, I would like to clarify what you mean by this? Enthusiasts' opinion? Let's look specifically at who these enthusiasts are and what they tried to do on Arduino before they came to this conclusion? Arduino is simply a circuit-oriented language, which makes it understandable to people who understand electronics. This is an open platform, so it has a lot of ready-made solutions, it is designed so that even non-specialists can start doing something for themselves using software technology, which is what led to the emergence of many such enthusiasts. Yes, it allows, but it does not exclude the need for serious education, and this is precisely what enthusiasts often lack, so they begin to move from a sore head to a healthy one. And therefore, before giving up on Arduino technology, I would like to know what fundamental limitation of the capabilities of this language you can cite? Does he weigh a lot? Does the command system lack functionality? Is the performance low? Extremely inconvenient in programming? What exactly?
    I'll tell you a little secret. The thing is that you won’t have to do anything special in developing circuitry or programming to automate a greenhouse. This has already been done before us and greenhouses have been in operation for a long time, and not just one person. You can just stupidly repeat everything, without inventing anything, if that’s enough for you and you don’t want to add anything of your own. Get acquainted with the material, perhaps you will change your opinion about Arduino.

  • Registration: 11/03/13 Messages: 651 Thanks: 766

    I understand, I will not interfere in the discussion. I want a little more automation, which is why Arduino did not suit me, although, I repeat, my knowledge about it is superficial, learned from reading forums on this platform, and may be insufficient.
  • Registration: 06/23/13 Messages: 5,837 Thanks: 6,261

    Vitaly

    Registration: 06/23/13 Messages: 5,837 Thanks: 6,261 Address: Bryansk

    Arduino Very elementary platform. When choosing it, you have to assign a very limited set of tasks to it, greatly narrowing your desires. Until now, very basic crafts have been made on it. There were regrets from enthusiasts working on it that it “does not cope” with many tasks.

    This topic will help you to define your attitude towards Arduino. As far as I, not a programmer, understood from the dispute between two programmers, the complaints against Arduino do not lie in the weakness of the platform. The claims were related, as far as I understood, to its insufficiently high level, according to the opponent. However, a low level, you see, increases the power and speed of the language - any system programmer will tell you this. And the fact that a low level complicates writing a program, as he claims, depends on who. After all, Arduino is a language tailored for electronics engineers, so for them it will be, as a specialized language, much more convenient than a universal one. It’s a different matter for programmers who have little knowledge of electronics, but in high-level languages ​​they ate the dog - their opinion can therefore be understood.

    Last edited: 10/21/15

  • Registration: 10/20/11 Messages: 1,177 Thanks: 570

    In my opinion, before arguing about what to build automation on, you need to decide on the technical specifications, otherwise you will now stuff an industrial CNC into a greenhouse in order to open a couple of vents according to the temperature. Although, again, if someone is comfortable working with a particular controller and has the opportunity to use it, then why not, even if it is redundant. In any case, you need to start with technical specifications and build a control algorithm. So far, from what has been written above, it follows that: below 12, turn on the heating, above 25, open the window, above 30, turn on the foggers. While the circuit is very simple, you can even do without a controller.
  • Registration: 06/23/13 Messages: 5,837 Thanks: 6,261

    Vitaly

    Registration: 06/23/13 Messages: 5,837 Thanks: 6,261 Address: Bryansk

    ...In any case, we need to start with the technical specifications and build a control algorithm. So far, from what has been written above, it follows that: below 12, turn on the heating, above 25, open the window, above 30, turn on the foggers. While the circuit is very simple, you can even do without a controller.

    Well, try it. I’m not sure that you will be able to do without a controller even with such a simple algorithm. But you have already simplified the algorithm I proposed, because I wrote that there are 2 sensors: one in the greenhouse, the other on the street, I just suggested the same threshold in both cases - 12 g.

    Do you think that it will be easy to implement even such a very simple algorithm in such an inertial object as a greenhouse? We can already assume that many obstacles will arise on the way to its implementation. For example, foggers instantly reduce the temperature at the top of the greenhouse, but overheating remains below, which means intensive air mixing and additional sensors will be required, which, of course, will complicate the control program. Humidity also cannot be increased uncontrollably - this will begin to harm the crop, and an effective reduction in temperature will become impossible. Consequently, it is assumed that in the future the algorithm and the entire system will become more complicated, it will be necessary to introduce fans for air mixing and for exhaust ventilation in order to reduce humidity.
    It’s just that at this stage much cannot be foreseen, especially since I, for example, have never done anything like this before. That’s why I proposed a minimally complex option, which still cannot be done by simpler means, for example, using a thermostat. The point of this approach is that complicating the device in the future is not difficult. Therefore, now I would like to do the circuitry part - try to draw a circuit diagram of the device core. Editor for drawing email. I saw the diagrams in the topic that I already cited above. I have already downloaded it for myself, but I still have no idea how to work in it. It’s difficult and takes a long time to move alone, especially when you don’t know much, so then everything will go very slowly. Today I spent the whole day choosing devices on the Internet - everything that needs to be bought, I looked at many options and, perhaps, made far from the best choice, but the process gradually began.
    The editor can be found here: sPlan- Maybe someone is familiar with it or can recommend the best one, but for now I’ll try to use this.

  • Greenhouses are designed to provide an optimal microclimate for the growth and development of plants. These can be large industrial buildings or a small place on the windowsill for growing your favorite flower. But even the tiniest greenhouse on the windowsill needs care: watering, maintaining the desired temperature, light level, etc.

    Many are happy to take up such farming, but they just don’t have the energy or time for it. And only a dream suggests: if only there was a design that would be so smart that it would do everything itself. Such a greenhouse will be in demand by those who do not want to spend a lot of time caring for plants, and may also not have the opportunity to do this in the event of a long absence - business trips, vacations, etc.
    We will begin to create such a greenhouse, let's call it smart. And it will help us create smart greenhouse controller Arduino. What functions will a smart greenhouse perform?
    Firstly, it is necessary to quickly obtain all the necessary information about the climatic parameters of our greenhouse: air temperature and humidity, soil temperature and moisture, greenhouse illumination. Those. monitor the climatic parameters of the greenhouse.

    What client problem will the monitoring function solve? First of all, it will eliminate concerns about whether everything is okay with the plants during his absence: is there water in the system, has the electricity been turned off, can the ventilation system provide the desired temperature if the room becomes too hot, etc.

    You can display monitoring data on the display, or use LEDs to notify about critical values ​​of climate parameters, or receive data via the Internet or on a tablet.
    Next, it is necessary to implement the ability to control the greenhouse - watering, heating, ventilating plants, and adjusting the lighting of plants. Control can be done automatically, or remotely (via the Internet or via phone (tablet)).

    The next stage is the autonomy function of the greenhouse. When the soil moisture level drops below a certain value, it is necessary to turn on watering; when the temperature in the greenhouse drops, it is necessary to turn on the heating; the illumination of the greenhouse must be carried out according to a certain cycle.

    Figure 1. Schematic representation of a smart greenhouse

    In our lessons we will look at the practical implementation of a smart greenhouse project. Let's create a smart greenhouse project -
    "Home Flower" And let's start with the implementation of the function of monitoring greenhouse parameters. To monitor, we need to obtain the following data about the environment of our flower:

    1. air temperature;
    2. air humidity;
    3. soil moisture;
    4. flower illumination.

    To implement the monitoring function we need the following details:

    1. Arduino Uno;
    2. USB cable;
    3. Prototyping board;
    4. Male-male wires – 15 pcs;
    5. Photoresistor – 1 piece;
    6. 10 kOhm resistor – 1 piece;
    7. Temperature sensor TMP36 – 1 piece;
    8. Air temperature and humidity module DHT11 – 1 pc.
    9. Soil moisture module – 1 pc.

    Positions 1-6 are available in the “Dare” series kits (“Basic”, “ ” and “Smart Home”), the TMP36 temperature sensor is available in the “Basic” and “Learning Arduino” kits. Links to positions 8 and 9 will be given at the end of the article.
    First, let's get acquainted with the sensors that we will use for the monitoring function of the parameters of our project.
    Using a photoresistor (Figure 2), illumination is measured. The fact is that in the dark the resistance of the photoresistor is very high, but when light hits it, this resistance drops in proportion to the illumination.

    Figure 2. Photoresistor

    The TMP36 analog temperature sensor (Figure 2) allows you to easily convert the output voltage level into a temperature reading in degrees Celsius. Every 10 mV corresponds to 1 0C. You can write a formula to convert the output voltage to temperature.

    0C = [ (Vout in mV) - 500] / 10

    Offset -500 for working with temperatures below 0 0C.

    Figure 3. TMP36 analog temperature sensor

    The DHT11 sensor consists of a capacitive humidity sensor and a thermistor. In addition, the sensor contains a simple ADC for converting analog values ​​of humidity and temperature. We will use the sensor in the module version for Arduino (Figure 4).

    Figure 4. DHT11 module

    The soil moisture module (Figure 5) is designed to determine the moisture content of the soil in which it is immersed. It lets you know if your home or garden plants are under- or over-watered. The module consists of two parts: a YL-28 contact probe and a YL-38 sensor, the YL-28 probe is connected to the YL-38 sensor via two wires. A small voltage is created between the two electrodes of the YL-28 probe. If the soil is dry, the resistance is high and the current will be less. If the ground is wet, the resistance is less, the current is a little more. Based on the final analog signal, you can judge the degree of humidity.

    Figure 5. Soil moisture module

    Now let’s assemble the circuit shown in Figure 6 on a breadboard.

    Figure 6. Connection diagram for monitoring parameters for “Home Flower”.

    Let's start writing the sketch. The photoresistor, TMP36 temperature sensor and soil moisture module are common analog sensors. For the TMP36 sensor, we can convert analog values ​​to temperature readings in degrees Celsius. To work with the DHT11 module we will use the Arduino DHT library (Download). We will measure the data at intervals of 5 seconds and output the values ​​to the Arduino serial port.
    Let's create a new sketch in the Arduino IDE, add the code from Listing 1 into it and upload the sketch to the Arduino board. We remind you that in the Arduino IDE settings you need to select the board type (Arduino UNO) and the board connection port.

    Listing 1.

    // connecting the DHT library #include "DHT.h" // DHT sensor type #define DHTTYPE DHT11 // contact for connecting the data input of the DHT11 module int pinDHT11=9; // contact for connecting the analog output of the soil moisture module int pinSoilMoisture=A0; // contact for connecting the analog output of the TMP36 temperature sensor int pinTMP36=A1; // contact for connecting the analog output of the photoresistor int pinPhotoresistor=A2; // instantiating a DHT object DHT dht(pinDHT11, DHTTYPE); void setup() ( // start the serial port Serial.begin(9600); dht.begin(); ) void loop() ( // receive data from DHT11 float h = dht.readHumidity(); if (isnan(h) ) ( Serial.println("Failed to read from DHT"); ) else ( Serial.print("HumidityDHT11= "); Serial.print(h);Serial.println(" %"); ) // getting the value from analog output of the soil moisture module int val0=analogRead(pinSoilMoisture); Serial.print("SoilMoisture= "); Serial.println(val0); // getting the value from the analog output of the TMP36 temperature sensor int val1=analogRead(pinTMP36); // conversion to mV int mV=val1*1000/1024; // conversion to degrees Celsius int t=(mV-500)/10; Serial.print("TempTMP36= "); Serial.print(h);Serial.println( " C"); // getting the value from the analog output of the photoresistor int val2=analogRead(pinPhotoresistor); Serial.print("Light= "); Serial.println(val2); // pause 5 seconds Serial.println(); delay (5000); )

    After loading the sketch onto the board, open the serial port monitor and observe the output of values ​​​​with the readings of our sensors (Figure 7).

    Figure 7. Outputting values ​​with the readings of our sensors into the Arduino serial port monitor.

    And here is our grown flower (Figure 8).

    Figure 8. Project “Home Flower”

    Viewing sensor readings via a serial port is not entirely convenient; in the next lesson we will look at more

    The article describes the hardware implementation of a microclimate control system in a greenhouse. This system is part of a real household plot. With its help, the process of growing plants has become partially automated, not requiring constant human presence.

    A specific instance of this system is being tested on a frame-glass greenhouse, 6 meters long, 3 meters wide, 2 meters high. The greenhouse has one door and 2 windows, electricity and running water. Water is heated in a 70 liter container. The pressure in the container is about two atmospheres. About 35 plants are grown in the greenhouse.

    The system looks like this:

    Figure 1. Diagram of the microclimate control system in the greenhouse

    The central place in the system is occupied by the Arduino Mega board (in Fig. 1-1):

    Figure 2. Arduino Mega

    Arduino is a completely open platform consisting of a board and a development environment that implements a redesigned version of the Processing/Wiring language.

    The hardware platform used is based on the ATmega1280 microcontroller.

    This system uses 8 digital inputs/outputs (there are 54 in total on the platform) and 10 analogue ones (there are 16 in total). The board receives power from an external power supply.

    The board has the following characteristics:

    • operating voltage: 5V;
    • Recommended input voltage: 7-12 V;
    • limit input voltage: 6-20 V;
    • 54 digital I/O ports;
    • 16 analog inputs;
    • current consumption on one output: up to 40 mA;
    • 3.3V output current consumption: 50 mA;
    • Flash Memory: 128 KB, of which 4KB is used by the bootloader;
    • RAM: 8 KB;
    • non-volatile memory: 4 KB;
    • clock frequency: 16 MHz;
    • size: 75x54x15 mm;
    • weight: 45 g;

    The necessary sensors and modules are connected to Arduino Mega.

    Turning irrigation on/off depends on a number of parameters:

    • soil moisture;
    • water temperature;
    • Times of Day.

    This system uses 4 soil moisture sensors (Fig. 1 - 2).

    To measure soil moisture, a homemade sensor is used, which consists of two nails and a resistor. The principle of operation is based on the dependence of the electrical resistance of the soil on its moisture content.

    Nails inserted into the soil at a certain distance from each other act as probes between which the resistance is checked. Based on the final analog signal, you can judge the degree of humidity.

    The sensor diagram is shown in the figure:

    To measure water temperature, an LM335Z analog temperature sensor is used (thermozener diode, in Figure 1 - 3):

    Figure 4. LM335Z Analog Thermal Sensor

    The sensor used has the following characteristics:

    • range: -40…+100;
    • accuracy: 1°C;
    • dependence: 10mV/оС.

    To connect the sensor to the board, a resistor with a resistance of 2.2 kOhm is required. By setting the current through the sensor in the range from 0.45 mA to 5 mA (with resistor R1), we obtain the voltage across the sensor, which in tens of mV represents the absolute temperature in Kelvin.

    The connection diagram is as follows:

    To ensure that watering is turned on only in the dark, 2 Light Sensor-BH1750 light sensors are used (in Fig. 1 - 4):

    This sensor is used to measure illumination in the range from 1 to 65535 lux.

    It has the following characteristics:

    Supply voltage: 3-5V;

    Resolution: 16 bit;

    Dimensions: 19x14x3 mm;

    Accuracy: ± 20%.

    The sensor is connected as follows:

    Figure 7. Connecting the Light Sensor-BH1750

    When the readings received from the sensors satisfy certain conditions (they differ for each type of plant), watering is turned on. An electromagnetic valve is used to regulate watering. It is connected to the board using a relay (in Fig. 1 - 5). Namely, the relay module for Arduino projects Relay Module 2 DFR0017 is used. It uses high quality Omron G5LA relay. The relay output status is indicated by an LED. This module is controlled using a digital I/O port. The contact switching time is 10 ms. Like sensors for measuring temperature and soil moisture, the relay module is connected to the control electronics via three wires:

    Figure 9. DHT11 Temperature Humidity Sensor

    In addition to watering, this system also controls the air temperature in the greenhouse.

    To simultaneously measure temperature and air humidity, the DHT11 Temperature Humidity Sensor is used (Fig. 1 - 6).

    It is connected to the control electronics via three wires: power (Vcc), ground GND) and signal.

    In addition to the sensor, the board contains a microcontroller, the memory of which contains calibration corrections for the sensors. The signal from the device is transmitted digitally over the bus. This allows data to be transmitted over a distance of up to 20 m.

    This sensor has the following characteristics:

    • supply voltage: 5 V;
    • temperature range: 0-50°C, error ±2°C;
    • Humidity: 20-90%, error ±5%.

    To regulate the air temperature in the greenhouse, two modes are used: passive and active ventilation. Passive ventilation is the opening/closing of the vents, and active ventilation is the turning on/off of the fan.

    The windows are opened using two (one per window) Futaba T306 MG995 servos (in Figure 1 - 7):

    Figure 10. Futaba T306 MG995 servo drive

    The servo drive used has the following characteristics:

    • operating speed: 0.17 s / 60 degrees (4.8 V no load);
    • torque: 13 kg-cm at 4.8 V;
    • torque: 15 kg-cm at 6 V;
    • operating voltage: 4.8 - 7.2 V;
    • wire length: 300 mm;
    • dimensions: 40mm x 19mm x 43 mm;
    • weight: 55 g.

    The data received from the sensors is recorded on an SD memory card (in Figure 1 - 8). Subsequently, they are processed, analyzed, and based on them, graphs of various readings are constructed. To do this, use the DFRobot SD card module:

    Figure 11. SD card module

    The fan is connected in the same way as the valve is connected (via a relay module).