{"id":302,"date":"2026-11-01T09:37:00","date_gmt":"2026-11-01T09:37:00","guid":{"rendered":"https:\/\/www.soumyanath.in\/wp\/?p=302"},"modified":"2026-10-21T18:31:01","modified_gmt":"2026-10-21T18:31:01","slug":"watering-plants-from-cloud","status":"publish","type":"post","link":"https:\/\/www.soumyanath.in\/wp\/2026\/11\/01\/watering-plants-from-cloud\/","title":{"rendered":"Watering Plants from Cloud"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Gardening is one of my many hobbies. I have a balcony garden with about thirty plants, and I love travelling. Watering the plants during such trips, which are typically 10-15 days long, is a challenge. I tried simple solutions like wick irrigation or drip irrigation from a bottle. Such techniques keep the soil moist all the time. I found that many of my plants got root rot due to prolonged exposure to high soil moisture.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/bottle-1024x1024.jpg\" alt=\"\" class=\"wp-image-303\" style=\"width:281px;height:auto\" srcset=\"https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/bottle-1024x1024.jpg 1024w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/bottle-300x300.jpg 300w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/bottle-150x150.jpg 150w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/bottle-768x768.jpg 768w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/bottle.jpg 1500w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">I needed a solution that would water my plants intermittently, based on the weather conditions. The interval may range from once a day to once every three days. I have set up my garden for drip irrigation. There are automatic timer-operated valves for drip irrigation systems that could have somehow worked. These systems could not be controlled from outside. If I detect from my weather station that it has rained, I have no means to defer the watering. A cloud-based IoT smart switch is good for such a job.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/timervalve-2-1024x1024.jpg\" alt=\"\" class=\"wp-image-306\" style=\"width:335px;height:auto\" srcset=\"https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/timervalve-2-1024x1024.jpg 1024w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/timervalve-2-300x300.jpg 300w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/timervalve-2-150x150.jpg 150w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/timervalve-2-768x768.jpg 768w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/timervalve-2.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Timer Operated Valve<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">I have an additional challenge as well. I do not have a running water connection on my balcony. I water it with a small submersible pump. If the water level falls below the pump intake, then the pump may get damaged.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In summary, my watering device has to do the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Take commands from my personal website on when to water and for what duration<\/li>\n\n\n\n<li>Check the water level and stop the pump if the water level falls below the intake level<\/li>\n\n\n\n<li>Send acknowledgement of execution to the server<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"932\" height=\"775\" src=\"https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/website.png\" alt=\"\" class=\"wp-image-307\" srcset=\"https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/website.png 932w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/website-300x249.png 300w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/website-768x639.png 768w\" sizes=\"auto, (max-width: 932px) 100vw, 932px\" \/><figcaption class=\"wp-element-caption\">Server Dashboard<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The server is coded to handle multiple automation devices. It has two forms to change the job intervals as well as the schedule of individual jobs. The interval and individual job schedule are displayed as a list. All this data is stored in a SQLite database. As this information stays on my personal website, it can be modified from anywhere with internet access. It also displays the last few jobs executed and my anxiety level: low. Unlike my weather station dashboard, the page for automation is a restricted access page. One has to log in with proper authentication to access the dashboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the client side, I use an ESP8266 NodeMCU controller. This device has built-in WiFi and one analog port. The analog port is required to check the water level.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"874\" src=\"https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/BattCap_bb-1024x874.jpg\" alt=\"\" class=\"wp-image-309\" style=\"aspect-ratio:1.1716487239739877;width:457px;height:auto\" srcset=\"https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/BattCap_bb-1024x874.jpg 1024w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/BattCap_bb-300x256.jpg 300w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/BattCap_bb-768x656.jpg 768w, https:\/\/www.soumyanath.in\/wp\/wp-content\/uploads\/2026\/10\/BattCap_bb.jpg 1374w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">This is an application that runs only for a brief period after a long gap. I wanted to keep the device&#8217;s power consumption low. My initial plan for the client device was to check the server every 15 minutes and go to sleep. After a few days of running, I noticed that the device started to hang frequently. A search on the internet confirmed the presence of a bug in a few batches of the NodeMCU that causes it to hang after several deep sleep cycles. I decided to play it safe rather than risk seeing dry plants after a vacation and changed from deep sleep to long pause. During the pause, the WiFi radio is switched off.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There is nothing much on the board apart from the NodeMCU controller. To check the water level, a 1 M\u03a9 resistor and two open copper wires form a voltage divider. The analog A0 port measures the voltage during pumping water. To reduce corrosion of the copper wire, the voltage divider circuit is powered only during pumping from one of the digital pins. As long as the copper wires are submerged in water, the resistance across them is a few kilo ohms. When the wires are no in contact of the wire the resistance becomes very high. A0 pin detects this change and stops the pump. The pump is driven by a 5V relay using a generic NPN transistor. The board is powered by a miniature 5V supply. NodeMCU operates at 3.3V, but the board has an inbuilt voltage regulator, so no additional component is required.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The communication between the NodeMCU client and the server is through a JSON-encoded message. The JSON string includes a security key to prevent unauthorized access to the server or the device. When the client pings the server, it checks the job code and event schedule. If the event schedule has passed, the server sends a message string indicating the duration the pump has to run.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After keeping the pump on for the specified duration, the client sends an acknowledgement confirming full execution or premature termination due to low water. On the server side, the job-log table is updated with the information, and a new event schedule for the next run is calculated and stored in the database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Currently, I use the graph from my weather station to guess rainfall, temperature, etc. Perhaps in the future I will add a few cameras to keep an eye on my plants. If you have any better ideas, feel free to suggest them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gardening is one of my many hobbies. I have a balcony garden with about thirty plants, and I love travelling. Watering the plants during such trips, which are typically 10-15 days long, is a challenge. I tried simple solutions like &hellip; <a href=\"https:\/\/www.soumyanath.in\/wp\/2026\/11\/01\/watering-plants-from-cloud\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":307,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,14,19,21],"tags":[],"class_list":["post-302","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-automation","category-electronics","category-hobby","category-web-technology"],"_links":{"self":[{"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/posts\/302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/comments?post=302"}],"version-history":[{"count":4,"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/posts\/302\/revisions"}],"predecessor-version":[{"id":312,"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/posts\/302\/revisions\/312"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/media\/307"}],"wp:attachment":[{"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/media?parent=302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/categories?post=302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.soumyanath.in\/wp\/wp-json\/wp\/v2\/tags?post=302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}