Introduction: Make Your Garden Forgettable
I built a simple device to give plants a marginally better chance of surviving my neglect, ignorance and apathy for all things green. It's essentially little more than a leaky Tupperware which is routinely refilled by an Arduino-controlled submersible pump. The leaking is metered out by modified syringes feeding flexible plastic tubes.
Some plants are watered daily and others every three days.
Now admittedly, there are some great solutions already available on Instructables that will show you how to water a single plant automatically but that just seemed excessive to me. Coding an Arduino to interact with a water pump and moisture sensor for just one plant seems more trouble than any one plant is worth. Hence the forgettable garden.
In this example we will be watering four plant beds directly and another four indirectly. There are two watering cycles, some plants get watered daily where the water drains back into the fish tank and others get watered every three days where the water is lost to the system.
Because it's not a closed system, the water level in the tank will slowly drop and seeing as I will soon forget about the garden entirely - I've included a simple top-up tank to replenish the water.
I'm not going to go into the details on the gardening or woodworking aspects in this project because its quite specific to my situation and I'm sure your final system will look different to mine. Coupled with that, I'm also terrible at woodworking, know nothing about gardening and I have no business offering advice on either. To learn how to build the stands - I would recommend the great Instructable: High Volume Balcony Raised Bed by ScubbX.
Step 1: Overview of the System.
Above shows all the components that go into the system and the terminology we will be using.
Step 2: Overview of Water Flow.
Black flow: Water pumped from the fish tank into the reservoir using a pump controlled by a relay and Arduino
Yellow stream - Daily cycle, waters plants in the reservoir and the lower container before draining back into the fish tank. Volume controlled by a syringe.
Red stream: From the reservoir to a tub outside and then onto other peripheral plants. Volume controlled by a syringe.
Blue stream: From the reservoir to a tub outside and then onto other peripheral plants. Volume controlled by a syringe.
Green stream: From the reservoir to a tub inside and then onto other peripheral plants. Volume controlled by a syringe.
Purple: Gravity fed water replenishment the fish tank from a water dispenser when the level of the fish tank drops below a set point. Flow rate is determined by the size of the PVC pipe and tap diameter.
Step 3: Get Stuff
- Arduino Uno
- HL-52S Relay Module
- 3 x Breadboard Jumper Wires (1 pin 10CM Male to Female)
- Submersible water pump 4w+ (Preferably with an adjustable flow rate)
- 2m PVC Piping (20mm Diameter)
- 4 x 20mm PVC Bends (90 degree)
- 10 x 20mm PVC attachments (Male and female)
- Insulation tape (4 colours)
- Small plastic container to house Arduino and relay
- 2 x Large plastic containers.(10Litre +)
- 1 x small plastic (100mm x 80mm x 50 mm)
- 4m of 6mm diameter clear plastic tubing
- 30cm of 4mm diameter clear plastic tubing
- 1.2m of 10mm clear plastic tubing (to fit submersible pump)
- 2 x screws 2mm length
- 4 x 10ml syringe
- 10+ Liter glass water dispenser (optional)
- Pair of scissors
- Drill with 20mm and 6mm drill bit
- Screw driver
- Coarse sandpaper
Step 4: Arduino, Relay and Submersible Pump
Arduinos only work with low voltages so it isn't possible to control the submersible pump directly. To overcome this we will be using a HL-52S Relay Module to allow the Arduino to control the pump. The relay reacts to low voltage signals sent from the Arduino to close the AC Circuit.
Because we will be using AC current, there is a degree of risk you need to be aware of. Never work on any of the devices while they are plugged in. Never let the Ac power cable near the arduino - only the relay board. Make sure all cables and components are insulated and protected from water splashing or leaking onto them. This is more than just possible for this project - it's actually quite likely. If you feel unsafe or unsure - reach out to someone who knows about electronics and ask them for help / guidance.
For a better and more detailed description on how to use a relay linked up to an Arduino - I would encourage you to read the instructable by Ostin Jos: Controlling AC Light Using Arduino With Relay Module.
Start by using the three breadboard Jumper wires to connect the following:
- Relay In1 --> Arduino Digital pin 7
- Relay VCC --> Arduino 5V
- Relay GND --> Arduino GND
Next, strip a small section of insulation (about 2 cm) from the pump cable, This will be close to the Arduino mounting so measure out roughly where to do it in relation to where your pump and power outlet are. Then select the blue wire, cut it, and remove the internal insulation to expose the copper. Ideally only 5mm of copper should be exposed. It should something like the top right image in the picture above.
There should be 6 connection points with screws to tighten the wires into place. 3 per relay (your board has 2 relays) so select K1 because we've set the Arduino up to control the first relay. Next the middle connector will always be used so you can place one piece of the blue wire and secure it with a screwdriver. The second wire needs to go into the one of the other connections. If you see one labelled "NO", that's the one you want. Some will show a solid line from one connection to the center connection and a broken line to the other. You want the broken line. One is normally open (NO) the other is normally closed(NC.) We want it to be normally open (i.e. device is off unless a signal tells it otherwise) If you select the wrong one, your system will run in reverse. The pump will turn on when it should be off and visa versa. If you see that happen, just choose the other option.
Now all that's left to do is to take a small plastic container, place the Arduino and relay inside, mark out where the holes will be required and drill out those sections. Next place the Arduino inside, and using the small holes in the board to secure the arduino into the plastic container with screws (and onto the table, desk or fish tank stand where you want the device to remain. I used double sided tape to secure the relay to the top of the plastic container. I found it helpful to write down which jumpers go where with permanent marker because you will probably want to reprogram the coding a few times while you tweak the system and to do that, you will have to unplug the Arduino to take it to your PC / Mac (If you don't have a laptop)
Step 5: Uploading and Tweaking the Code
If this is your first time using an Arduino, go to the Arduino website and download the software for the Uno device. Once that's installed, click and open the Gush.ino file above. Next, check the coding is valid by pressing the tick button on the top left. If you get a "done compiling" comment, plug your Arduino into your PC using the cable provided. Do not plug in the cable to your pump yet. Next press the right arrow button (next to the tick button) in the Arduino software. You should see a few lights flash on the Arduino and then the relay board should display a red light for thirty seconds before turning off with an audible click. You should get a "Done uploading" comment. If that's the case - The coding has been successfully uploaded to the Arduino.
The coding is really simple, there's only two functions for the whole program:
- "DigitalWrite", which turns on and off the relay
- "Delay" which measure the amount of time (in miliseconds) before advancing to the next line.
I've left the calculations in the coding itself so you can alter the delays to better suit your needs. So the first delay after the pump has run for thirty seconds reads:
Which is simply 24 hrs x 60 minutes x 60 seconds x 1000 miliseconds to get the number of miliseconds in a day, less the time spent while the Pump was running. So if you wanted the pumps to cycle after twelve hours instead of 24 it would read as follows:
If you want to change the code, open the file in Arduino on your PC, update the numbers you want to change, run a verify and if its good, plug your Arduino in and press upload button. Its really that simple.
Step 6: Prepare the Syringes
The whole project hinges around the syringes and while they don't need to look pretty to work, the more consistent you can make the four - the better the system will work.
Essentially we want to remove a strip of plastic (The red section in the diagram above) from the syringe which will allow water in the reservoir to flow into the body of the syringe and into the irrigation tubes. I removed the plastic by hand drilling several holes along the shaft and then used a hobby knife to remove the plastic between the holes. Once the plastic has been removed, use a course sandpaper to remove the burr around the edges. Both inside and out need to have smooth edges. I cannot stress this enough. The size and uniformity of the removed section isn't critical but if the burr isn't removed the rubber pusher will not be able to slide within the body of the syringe nor will the syringe be able to slide inside the PVC tube.
You will notice in the picture that the yellow syringe has had it top section removed. This is because the yellow syringe feeds directly into the PVC pipe (It's the feeder for the daily cycle) while the other three will be attached to the flexible 6mm tubing.
Next cut 3 pieces of the 4mm flexible tubing (about 5mm length) and slip it onto the tip of syringe. In the photograph above, the top two have them fitted while the third one does not. This is just to accommodate for the gap between the outer diameter of the syringe tip and the inner diameter of the flexible tubing. If you don't have 4mm tubing or your flexible tubing is bigger - I suggest insulation tape.
Step 7: Preparing the Reservoir
Drill a 20mm hole in each corner of the plastic container which will be your reservoir. Again remove the burr so the holes are clean of debris using sandpaper. Next, do the same thing with the lid of the container making sure the holes are directly in line with the container as they will be connected to one another.
Cut 3 lengths of PVC pipe of 300mm each and drill an 8mm hole in the center. Cut a fourth pipe at 360mm, do not drill a center hole in this piece but instead mark it with yellow insulation tape. While you have the handsaw out, cut three pieces of tubing of 10 mm each.
Next cut three lengths of flexible tubing which will suit the layout of your plants.
The photograph above shows you how to assemble the PVC Pipes, and connectors. The red insulation tape represent where the lid of the lower container would be (thread through the hole you just cut) and the yellow represents the bottom of the reservoir). Thread the flexible tubing through the PVC center hole and push it until it sticks out the top.
Push the 10mm PVC pieces into the male connectors at the top of each assembly - they should fit snugly and will house the syringes.
The yellow PVC pipe should be assembled the same as the others but for the top end. In this case the PVC pipe will just extend through the reservoir without any fittings. You will need to seal this pipe to the reservoir to prevent leakage using glue or Insulation tape.Trim the pvc pipe so the tip is just above the base of the reservoir
I drilled a few holes on the lid of the lower container to accommodate any leakage (water will simply drain into the lower container.)
The inlet pipe should follow a similar vein. I used a 15mm irrigation bend connection and fitted the outlet pipe from my submersible pump. Then I drilled a hole the same size and fitted the pipe to that. Its probably easiest just to run the tube into the container through the hole you cut and secure with wire. Try not to make anything too permanent as you will probably have to remove the inlet pipe from time to time.
Now tighten all the male to female connectors and push the PVC pipes into their sockets tightly.
Step 8: Adding the Syringes to the Reservoir
Now all you have to do is attach the syringes to the flexible plastic tubing. This can be a bit tricky but i found it was easiest to pull up a section of the tubing, force the 6mm tubing onto the 4mm tubing and then slowly push the syringe down while gently pulling the tubing at the center hole. If you just pull the tubing it will separate from the syringe and all is lost. Crying and lamentations to follow.
When you try the system and see leaks - you might want to use a bit of insulation tape to get tighter seals between the syringe and PVC pipes.
See the above image to understand the cross section view. (Not even close to being to scale.)
Step 9: Prepare the Lower Container
The lower container is dead easy to prepare.
1. Drill small (4mm) holes 40mm from the top of the plastic container for ventilation at 40mm intervals.
2. Drill one hole of 6mm diameter to accommodate a flexible plastic tubes as close to the bottom of the lower container which will feed back into the fish tank. We will add the high mark later.
Step 10: Cycles Times Influence on Streams.
The above illustration shows how the assembly allows some streams to be watered during the short cycles and not others. The yellow stream begins to flow the moment any water is entered into the reservoir becuase of its low intake while the green, blue and red streams will only start dispensing water when the level rises above the height of the male connectors.
Step 11: Testing and Tweaking
Place the completed reservoir onto the lower container and check everything is aligned. You should now have three flexible tubes each controlled by a syringe. Place each end of the flexible tubes into an empty water jug or vase and then close all the syringes except for the yellow. Next, attach the outlet pipe from your water pump to your reservoir inlet.You are now ready for testing the system.
I need to mention here that water at low pressure and in smell volumes can behave somewhat counter-intuitively. The forces of adhesion vs cohesion come into play, along with inertia and viscosity. You may very well see things which appear to defy the laws of physics. Water, when presented with a gap to a lower state sometimes just refuses to budge. It can be frustrating but with a millimeter more volume the water will start running.
Plug in the water pump and then the Arduino. Please note, a 9v battery which comes standard with most Arduinos is not going to cut it for our requirements. To activate the relay you will need to plug the Arduino into the mains using a USB adapter. A few seconds after the Arduino powers up it should start your pumping cycle.
Have a permanent marker handy. If everything goes according to plan, after a while you should start to see water accumulate in the reservoir and then begin to drain through the yellow syringe, down the yellow PVC pipe into into the lower container. Then the lower container should begin to accumulate some water and begin draining back into your fish tank.
If water doesn't accumulate in the reservoir, try to throttle the output rate by pushing the plunger down (yellow syringe) until the outflow in the reservoir is less than the input.
Let the water drain out entirely and press the red button next to the power switch on the arduino and the cycle will start again. While this is happening, look for any signs of leaks anywhere in the system and mark the problem areas with the permanent marker.
Keep playing around until you are happy with the 30 second cycle, bearing in mind this will be repeated once a day. Place any plants / containers you intent to use in the lower container or reservoir as their bulk will influence how quickly the containers fill up.
My pump had a adjustable flow rate and i found that very useful to make quick easy changes to the volume of water I wanted. If you don't have an adjustable pump or the flow isn't enough you can start playing around with the coding to increase the amount of time the pump runs for. Look for this line in the code and modify the 30 for whatever time you think will better suit:
delay(30*1000); // run for 30 seconds
Once you're happy that the reservoir is collecting sufficient water and your plants in the lower container will be getting enough daily water, use your permanent marker to mark the highest point you want water to flow to in the lower container. Remember when we switch to the three day cycle the pump is going to run for 2 minutes. At this point, without the high point drain - your lower container will be four times as high as it gets in the 30 second cycle.
Unplug the pump and Arduino. Now check the vases / jugs that the flexible tubes were draining into. If all your syringes were closed - there should be no water in any of them. If there is - you need to check the syringe is still attached to the tubes (See previous step)
Also if you saw any water leaking around the PVC tubes, you might want to loosen the connections and check the seals are good. If anything is loose - you might want to use some insulation tape in the male ends of the fittings to provide a better seal. This applies to the syringes too.
Next - Drill the high water mark drain and insert a small piece of flexible tubing into the hole. This should ensure that the lower container is never flooded.
Now repeat the process for the 2 min cycle. Obviously the Arduino is now set up to run 30 second cycles at present - so I've included a test code you can install the same way we did previously. Once installed, every time the Arduino starts or is reset, it will run the pump for 2 minutes and then switch off again.
If avoidable - try to avoid touching the yellow syringe at this point as this is set to give you a good thirty second daily cycle. Run the 2 minutes cycle and see what happens. The first thing you want to make sure is that each syringe and tube is working. If they aren't - you need to open them up and check to see whats wrong. The syringes are very sensitive to blockages so make sure there are no bits of plastic clogging up the works.
I was considering using plasters (band-aids) over the gaps of the syringes to filter out debris and detritus if it became a problem but I found that after washing everything it wasn't too much of a problem so i left it.
Once you're sure all the pieces are sound you can start playing and adjusting the three syringes until you're happy with the volumes in each container. You might also want to change the two minutes in the arduino to a bigger number. I also placed a plastic tub in the reservoir to reduce the volume of water required before the second tier syringes came into effect.
Step 12: Irrigation Tubes.
With larger tubs it wasn't enough to just pump all the water to one point so I used modified plastic tubing, wooden skewers and fabric adhesive plasters to distribute the water. I settled on two types of irrigation tubes.The plaster was used just to prevent soil from getting into the pipes and clogging things up.
To make type1 - Fold and pinch the tubing tightly then snip of an edge with a pair of scissors. Then apply the plaster around the hole like a booboo on a finger. Do that every 100 mm or so along the tubing and place lying flat in the bed to be irrigated. It helps to cut smaller holes closer to the water source and larger as you move towards the end.
Type 2 is simply the tubing taped to a wooden skewer which is jammed into the soil close to the roots of a plant.This is just to prevent the tube from moving.
Step 13: Peripheral Watering
To add secondary plants to the watering system is relatively easy. Using techniques similar to how we attached the PVC pipes to the reservoir, you can add additional plants and beds as you see fit. You will need to adjust the amount of water you are feeding the stream to cater for the additional plants and bare in mind that if the ground dries out, the secondary plants will receive less moisture. When setting up secondary systems, try to place the primary beds at an angle so as to drain the water towards the outlet pipes.
Step 14: Top-up Tank
This is a quick and easy solution to keep your fish tank topped up. Just know that if you get this setup wrong - you will be mopping up for hours while muttering unkind things about me.
Don't buy a plastic unit like the one pictured above. This was something I had lying around and I was too lazy to go shopping.
How it works is when the top-up tank tap is opened the water should drain into the fish tank freely while the PVC extension end is above water. However, once the PVC opening is submerged, no air will be able to enter the top up tank and replace the lost volume of water. At this point a slight vacuum should build up within the top-up tank preventing any further water from draining out. With my plastic top-up tank, the vacuum deforms the shape of the container a little before the water stops flowing. With a glass container, the water should stop flowing sooner and with more uniformity. Obviously to get this right and not flood your room, both the seal from the tap to the PVC and the top opening seal need to be airtight.
The ideal water level should be above your water pump - so it never runs dry and low enough so so the water only fills up during the height of your two minute pump cycle. Beware if its too high, the water in the reservoir, coupled with the water added from the top up tank might flood your tank if not careful. My advice would be to watch a couple of 2 minute cycles and determine a safe level below which additional water can be added.
Second Prize in the
Automation Contest 2017
Participated in the
Lazy Life Challenge
Participated in the
Make It Move Contest 2017