Create a Smart Sprinkler System to Water Your Garden When the Soil Dries Up
Spring has sprung, which means it's time to plant all those delicious vegetables and lucrative cash crops. If you are like me, every year you meticulously plan every aspect of your garden before dutifully neglecting it all summer. I decided enough was enough and built this simple automatic watering system.
Using my old pal the Arduino, I will show you how to make a moisture sensing circuit that uses a standard hobby servo as a valve. When the Arduino notices the soil is dry, it commands the servo to let the water flow and bring forth sustenance onto the parched earth.
- 10k resistor
- Latex tubing
- Bucket or rain barrel
- Weatherproof case
- Zip ties
- Hot glue
Step 1 Drill
Drill two holes in your weatherproof enclosure large enough to feed your tube through. The tube will be going in one side and out the other, so try to keep the two holes in line with each other.
I snagged this box at my local Salvation Army for 99 cents!
Step 2 Install Servo
Position your servo inside the enclosure so that the servo horn is directly under the tube. The servo will be twisting the tube to pinch it closed and control the flow of water. Once in place, hot glue the servo to the inside of your enclosure.
All you need is a couple of zip ties to keep the tube mounted on the servo horn. Be sure to keep the zip ties loose to allow the flow of water!
Step 3 Linking Up the Circuit
Our circuit uses an Arduino, a servo, and an analog sensor made from two wires. Breadboard the circuit as shown in the diagram below.
The green wires represent the soil probes. The resistor in the diagram has a value of 10k ohms.
You might remember from our first electrolysis article that metal tends to corrode when it is submerged in water with a current. Just like we did then, we can use the carbon in pencils as rustproof electrode probes. I have also successfully used nails as probes, but they do eventually corrode.
Step 4 The Program
Download the sketch (Arduino program) here. The program is very simple. We have taken two bits of wire and used them to sense the conductivity in the space between the two wires. When there is more water, there is a higher conductivity. The Arduino reads this conductivity and, at moisture level set by you, turns the servo to release or constrict the flow of water.
The yellow arrow is pointing to the number 600. This is the number you need to adjust for your desired moisture level.
The number you get depends on your soil, the kinds of probes you use, and how far apart you place the probes. If you don't know what number to put here, you can run your program while plugged into the computer and click the serial monitor button on the top of the Arduino program. It will show you a printout of the values, second by second. Put your probes in a cup of soil of the desired moisture and use that reading to set your watering system.
Step 5 Add Water
You can hook up your tubing to any water source apart from a hose. You can use a rain barrel, a bucket, or even a hanging bag as a water source. I used an old lemonade bottle for demonstration purposes.
These brass fittings are great and only a few bucks at your local hardware store. I did an inexpert job using hot glue and an O-ring, but even a hollow-bottomed bucket with a funnel glued underneath would work perfectly fine. Just make sure your water is not leaking out!
Step 6 Put It All Together
With the circuit securely taped down inside the box, close it up and run the tube through your garden.
If you want to water multiple spots, you need only poke some holes in the tubing and close off the end.
Place your probes on either side of where the water will exit the tube. A zip tie can help secure the tube connection.
Position your water source higher than the control box to create more water pressure. Connect up the power and double check all connections. Finally, fill your bucket with water and watch as the control box shuts off the flow right as the soil is damp enough.
Grow your own very verdant vegetables with your own automatic watering system! I want too see your glorious gardens processing away on the community corkboard! What else can you add to your garden? Temperature control? Humidity control? Post up your ideas in the forum. As always, questions can be asked in the forum, by messaging me directly, or by commenting below.
If you are interested in larger applications using a hose as a water source, check out this pre-Mad Science project I did.
Main sprinkler photo by mccun934