Saturday, January 18, 2025

Automatic Plant Watering System

    
plants

    For the Renewable Energy Systems class I took last semester, I created an automatic watering system as part of a group project. The first step in the assignment was to research our motivation for the project: Agriculture uses 70% of the world's fresh water. Watering by schedule can be wasteful and cause overwatering. Advanced smart watering systems use sensors, logic, weather data, and a series of pipes, pumps, and valves to optimize the plant watering. This can make farming more water-efficient and less labor-intensive. Our goal was to create a functional prototype demonstrating automated irrigation technology.

closeup of sensor and moss

    The next step of our project was to select a soil moisture sensor. Conductive sensors measure the electrical resistance of the soil. Over time, conductive sensors corrode because the electrodes are in direct contact with the soil. Capacitive sensors use the change in capacitance of the soil due to its water content, and have coated circuit boards. They avoid direct copper contact with the soil and don't use DC currents. We chose a capacitive sensor because it seems more durable for extended use.
sensor


    Another choice we made was the type of irrigation. Drip irrigation applies water directly to the root zone of the plants instead of spraying into the air. Combined with a pump, drip irrigation is good for the precise water delivery needed for our small-scale experiment. A gravity-fed valve system was also considered but was not practical due to space limitations.
    One team member created a simulation with a Tinkercad starter circuit design for a soil moisture sensor connected to an Arduino Uno R3. Unfortunately, the “water pump” in the simulation doesn’t actually change the soil moisture level. The sensor readings had to be controlled manually with a slider. Tinkercad isn’t the best tool for this because it doesn’t include soil-specific parameters.
Simulation (from group report)

    For our watering system build, I started with a kit that included a pump, relay, sensor, and tubing. The kit can be found at https://amzn.to/4ekJHHS (Amazon Affiliate link). I connected it to an Arduino UNO R3 clone and wrote some initial code to read the sensor value. The higher the sensor output value was, the drier the soil. In the code, I called this value "unmoistness." I had the pump turn on for a specified time when the soil reached a certain dryness. The system would then wait for one minute and measure again, watering if necessary.  The pump was not powered continuously, allowing time for water to soak into the soil.  
pump


    I placed the pump in a plastic container with holes drilled for the tube and power cable, and then sealed the holes with hot glue to utilize the full reservoir capacity. The sensor was placed inside and hose was clipped onto the edge of a large pot with several plants including peppermint, Cuban oregano, chives, bunching onions, chrysanthemums, and local moss. The dryness threshold, pumping time, and wait time were adjusted for optimal plant health.


    I coded a watchdog counter to prevent the pump from running too much in case of a sensor error, an obstructed pump, or an empty water tank. This type of oversight could be helpful in a large-scale system by preventing expensive pumps from being damaged due to running dry or overheating. The watchdog counts the number of consecutive attempts and prevents the pump from running if there have been too many attempts. The watchdog is reset if the moisture reading is within the target range.
Control board with watchdog tripped


    An LED indicates the current moisture relative to the target. It blinks n+1 times after each measurement, where n is the number of steps moister than the target value. This blinking system eliminates the need for a complex LCD requiring constant power, unlike similar experiments which have both a 9 Volt battery for the pump and USB power for the Arduino, display, and sensor. Our total system power is approximately a quarter of a watt when the pump is off, and about two watts when the pump is running. 
Flow chart (from group presentation)

    The system was mostly functional, however, I had to do some troubleshooting. The pump occasionally got stuck on because the Arduino got locked up due to the interference from the pump. I added redundant lines of code to turn off the pump, but this revealed that the original code was not the issue. Next, I replaced the relay with a MOSFET, which helped slightly. Then I installed a capacitor across the 5 Volt rail, eliminating the issue of the pump getting stuck on.
Block Diagram (from group presentation)

 
    Unfortunately, after moving the system home, there were many issues caused by loose wires. There was also water damage to the original Arduino clone so it was replaced. The wiring issues were corrected and the system was back up and running with only the need for adjustment of target. In order to allow the system to be used at night on solar power, I added a light dependent resistor to turn the light off at night and adjusted the blink time so it would be visible during the day.
System set up at home with new Arduino
     
    I tested the system for a few weeks before I moved it to make sure it was reliable. The results were better than manually watering a similar set of potted plants I kept in the same location, and there were no percolation losses. I was able to dissolve fertilizer in the water tank to water and fertilize at the same time. The system can also be expanded to have more plants because Arduino Uno can support up to five zones, each with its own sensor, moisture level settings, pump, and light.      

 
References
Our report was:  Sensor-Based Automatic Watering System by G. Colello, J. George, A. Smith

[1] S. Gould. “A Guide to Soil Moisture.” ConnectedCrops. https://connectedcrops.ca/the-ultimate-guide-to-soil-moisture/

[2] H. Ritchie and M. Roser, “Water use and stress,” Our World in Data, 2024. https://ourworldindata.org/water-use-stress

[3] M. Price, “Irrigation Fundamentals – Water Well Journal,” Water Well Journal, Nov. 18, 2019. https://waterwelljournal.com/irrigation-fundamentals-9/

[4] R. Leighton. “The 3 Main Types of Irrigation for Agriculture: the basics.” GrowerExperts. https://www.growerexperts.com/the-3-main-types-of-irrigation-for-agriculture/

[5] “HIRALIY Indoor Drip Irrigation System.” Amazon. https://www.amazon.com/dp/B0D7VYV9JN/

‌[6] V. Sonwane et al., "Automated Plant Watering System with Soil Moisture Tracker," in 2024 5th International Conference on Image Processing and Capsule Networks (ICIPCN), Dhulikhel, Nepal, 2024, pp. 735-739, doi: 10.1109/ICIPCN63822.2024.00127.

No comments:

Post a Comment