Friends, today is Friday! It's time to think about household chores ... And then the ITshnik's inquiring mind will also find fertile ground for optimization. Actually we will talk about the soil and our green brothers.
Recently, an unusual but very useful device appeared in our office - an auto shaker for plants. A real smart system in a single flower pot. The first experimental was the ficus. And, judging by his fatness, he was pleased. ;)
Details are in the story of the “instigator” of this “ugliness” of Mikhail Pichugin, the lead engineer-designer of computer complexes.')
The result was a real team project. The expert group worked together: some brought new modules for the device, others helped with testing and threw up interesting ideas. The chief architect of the project (your humble servant) wrote the firmware for the microcontroller, which formed the basis of the device, and put everything together.
Here it is - a small step for humanity, but huge - for the ficus.Software and hardware complex in section
There is a whole family of Arduino microcontrollers (curious, I advise you to go to
www.arduino.cc ). Arduino has its own development environment, which uses a programming language based on C / C ++. However, we used their eastern counterpart, nano-model. The chip operates at 16 MHz, has 2 kilobytes of RAM and approximately 30 kilobytes of flash memory for firmware. The system is aimed at non-professional users. In fact, this is “Lego” from the world of microelectronics, allowing to automate a variety of processes. Microcontrollers have a fairly simple architecture and a standard set of ports. Coupled with all sorts of modules, relays, sensors, etc. They form devices for solving a huge number of tasks - from heating control systems to radars and robots.
In addition to the controller, we used a humidity sensor, two relays for supplying electricity to the irrigation mechanism, an LCD display for displaying information and an electronic clock with a battery. In the role of "polivalki" - a motor for watering glasses and a tank for water from the VAZ-2108 :). The clock sends a pulse to the microcontroller, which uses a sensor to check the soil moisture. If it is sufficient, nothing happens; if not, automatic watering is turned on. Irrigation parameters are based on the quality of the soil (its salinity).
Failure and disaster recovery in one bottle
After all, few people would argue with the fact that a sudden “great flood” in the event of equipment failure or software failure is a real disaster (especially at night)? To avoid this plot, we have provided several levels of protection. First, two relays were installed in series: if one “sticks”, the spare will interrupt the electrical circuit and stop the flow of water. The second protective layer is software. He turned out to be one of the most interesting ideas of the project. After working with the firmware, we taught the system to memorize the moment of watering the plant. If at the next soil check it turns out that the humidity in the pot has not increased, then something has happened: water runs out, the sensor has broken, etc. Then an error message appears on the display and the automatic watering stops.

Recently added a new feature - watering only at a certain time. Now you can set the working hours of the device, suppose, from 9 am to 8 pm, and not be afraid of the night flood. If desired, the functionality can always be expanded with the help of new modules. For example, by connecting a GSM module, we will receive notifications about failures, soil conditions, etc. to twitter or email.
Device layout
Introduction to Productive
We made the basic firmware in three evenings, and one more evening was required to assemble the device. The next stage was commissioning: I had to “dig deeper” here. For example, when they could not understand why the relay does not work. It turned out that we simply didn’t have enough power supply to cope with the furious motor of the eight. Even with the polarity reversal of the circuit, spinning in the opposite direction, he still somehow managed to water it, and even when we included it in the normal sequence - it was generally pouring with terrible force.
Issue price
If you do not mess up, it will come out pretty budget, just have to order from China and wait. A simple controller will cost 250 p., A real-time clock module is 100, a relay is 150, a screen is 300, another 250 for the case (I cut it out of the shelf) and 100 for the humidity sensor. New washer motor with tank can be bought for 300 p. or ask a neighbor in the garage.
Application value of the development
The scope of the idea itself is from the system of monitoring the drop in voltage to the automatic moonshine. The limit is only your imagination. For me personally, this is the third solution based on the microcontroller. First there was the cooling system of the device, which had its own cooling system failed. Depending on the temperature, it turned on or off the fan and displayed climate data on the display. Then - on-board computer, which I did for my "Honda" 90th year of release. Here I was grasped by just an epic file: when I completed everything and decided to test, it turned out that the car does not have a diagnostic connector to which my device needs to be connected, but I could not check it in advance because I had to remove the floor covering. In any case, it was the most interesting and brainwashing project - some data transfer protocols were worth something.
Upd: Friends, we see that the post has aroused your interest. In more detail about the technical details used in the decision we will report in a separate post, which we will definitely inform in this article.
Upd1: Friends,
in a new post we hasten to share with you the technical details used in the solution.