Introducing Myself with my irrigation project
Background: I live in a high desert area and with my wife being a serious gardener requires serious irrigation. I currently have unreliable irrigation in that the water supply, although extremely plentiful when available, is not at all dependable. In other words when I need water at say 7:00 AM I want it to ALWAYS be there and it rarely is. My solution is to capture water when available and store it in two connected 275 gal IBC tanks.
There is also a situation where irrigation water will not be available for hours or several days and for this I will be filling the tanks with city water that is always available. But, city water is more scarce and so very much more expensive than irrigation water. My intention is to control the water in a way that city water is not used until the tanks fall to a level where it is obvious irrigation water is not available.
There is another very important variable, the irrigation water is supplied by my HOA and done so under significant pressure. Not enough pressure to run my lawn sprinklers but enough pressure to run drip lines to the garden beds (flower/shrub and veggie) and my wife's many potted plants. The lawn sprinklers are driven with a 1 hp pump that added to the HOA pressure develops tremendous pressure. Point here is, it is not just a matter of managing the water level in the tanks and always taking the water from the tanks but only depending on the tanks when irrigation water is not available.
The problem I am currently working on is how to accurately measure tank water levels. Measurments needed at a minimum would be start and stop fill levels for both the irrigation and city water supplies. These values, especially city water, will need adjusted until I figure out optimum values. It would also be really nice to be able to report how much water is in the tanks at any time. So far I've found four basic approaches: 1) A device in bottom of tank that measures water pressure; 2) An ultrasonic sensor like the hc-sr04 in the top of the tank that measures distance from top of tank top top of water; 3) An array of Non-contact Digital Water Level Sensor connected to the outside of the tank; and 4) devices that you drop into the tank that work something like #1 measuring water pressure.
Of the above options #4 looks real simple but cost prohibitive and #3 is not desirable since it would require a minimum of 4 devices that would need to be physically moved when adjusting for optimal levels, and then several more devices to report water levels.
Option #1 at first glance seemed to be the perfect solution. Simply install in bottom of tank and work with the values it returns. BUT, when my 1 hp pump is pulling water from the tanks I am afraid pressure readings will be significantly changed and so water level computations will not be dependable.
Option #2 ultrasonic sensor like the hc-sr04 seems to be a great approach. A significant issue is reasonably inexpensive units that are weather proof need to be almost 12” above top of tank to measure when the tank is full. The hc-sr04 has fantastic accuracy and minimum range and I am really thinking hard about how to weatherproof it. Any suggestions on weather proofing this hc-sr04 gem would be greatly appreciated.
For sure there are a lot of complexities in putting together the right electrical units and then the the programming. I am confident I will get through this but right now determining a rock solid reasonable priced way to accurately measure the amount of water in the tanks is critical. Thanks for any input, much appreciated!
Good to meet you, I'm pretty new here myself!
Ive spent 17 years in Landscaping and Irrigation, and I think I understand what you are going for...
What I would do in your situation is first if you have a fairly level property is try to elevate the IBC tanks until they are higher than the top of all the containers the plants are in, this will give you gravity feed to your drip lines, the higher you can put those tanks the higher the pressure will be at the end of the hose coming out of them, understandably if you are trying to fill these tanks from rain water they will need to be low enough to catch water from the gutters.
second, I would plumb in a normal electronic irrigation valve into the tanks these take just 2 wires to control and its a simple on or off. I would plumb in the irrigation water into that or plumb both city and irrigation into two different irrigation valves going into the tanks (I have a feeling that if you ran city water and irrigation water into a Tee and then into the valve you are probably always going to be feeding city water into the irrigation water lines)
next you are going to want a float switch inside to tell the valves that the tank is empty (or a desired level)
You could also build your own float switch by having a simple fishing bobber inside the tank tethered to a line so it travels up and down in a desired location and have a small permanent magnet attached to the bobber, using a hall sensor on the outside to read when the magnet comes near, sending a signal to an Arduino, that sends signal to the valves. You could easily have 2 or 3 hall sensors, one at the top of the tank to tell the Arduino the tank is full, one in the middle to turn on irrigation water, one near the bottom to say the tank is empty, turn on city water.
Now for your sprinklers, I would go to an irrigation supply shop and look into low flow sprinkler heads AND/OR remove sprinkler heads from each line you have and add them back in on a separate line, on a regular house hold sprinkler system running between 50-70 psi we never put more than 5 sprinkler heads on each line as any more than that and you wont usually have enough water pressure to run them all. then obviously you only run one line at a time. For water efficiency, You usually run each line for 5 min, then switch to the next line, and when you have run through all the lines and its been hot and dry like mid summer, run through all the lines again for another 5 min each. I personally have my irrigation set to come on every other night and it runs through each line 3 times for 5 min each, in the cooler months I just have it come on once every other night.
Im not sure how much pressure you are going to need to run each sprinkler line, But my thought would be to put a pump in the ICB's and run the sprinkler lines off the pump as it sounds like you are already doing
Just build a manifold to run out to each separate line coming off the pump, just as you would do with a regular irrigation system for your yard.
I hope this helps!
@dryden Thx for your quick response, much appreciated! I would like to continue this discussion by addressing each of your suggestions.
#1 tank height. Catching rain water not worth trying to do, pretty much desert here in western Colorado and so very little rain. Our irrigation water is basically unlimited but because of too much demand at prime times, our HOA system supports over 100 homes, the system cannot yield water when one wants it and there are always mechanical break downs in both our HOA system and the system that supplies our HOA. Height of tanks, per HOA rules we must keep everything below 6'. As to feeding drip lines, the HOA delivers water to our homes under pressure that is sufficient to support drip lines. I can easily get water to 4' heights without pump support. My lot is basically level, it might drop 4-5 inches over 100 feet.
#2 I have 2 1/2" motorized ball valves one for city and one irrigation water. These valves are closed until activated with about 5 volts and close by a spring when power is dropped. This way any interruption in power supply will close valves and prevent runaway overflow.
Float switch issue: First altering IBC tanks is difficult, there are many vertical and lateral braces that will make exact float valve placement in the sides difficult. Float valves from the top don't seem feasible to me. More important is how many water measurements I will need. Each water source will need both a high level turn off and a low level start point. Without this as water is consumed the water will turn on and then turn off immediately and again turn on and again off ... It could be a crazy on/off situation where valves do not have time to properly open and close. With this programming without serious unsolvable bugs could be impossible. I believe the term hysteresis is applied to this issue. In addition to the 4 measuring points to turn on and off the city and irrigation water it will be nice to have a measurement of how much water is in the tanks at any time. This will be necessary to fine tune when to turn on and off both the city and irrigation water supplies. Another problem with float valves will be fine tuning the on/off positions of each. So with all of this I am looking for a way to get a pretty accurate measurement of water height and then use that to programmatically, through Arduino, open and close valves. Right now I am wrestling with how to implement some type of measuring system, I believe I described 4 possibilities in my original approach. I am now digging into a 5th approach but need to dig a little deeper.
As to sprinklers, my system that has been in for probably 20 years runs on 8 zones and does just fine. The changes I am making now will allow it to run very dependably from either the irrigation water that never enters the storage tank or the water stored in the tank. My system will assure water is available. Currently with undependable water supply I am manually starting the system and if there is water available great, but as happens too many times I wait an hour or so and try to start the system again. This impossible to do when away for any reason for more than a day.
Once this tank filling system is established I will be looking into controlling and monitoring everything VIA WIFI which will allow for extended vacations. Hope the helps to better explain my situation and goals.
Again thanks so much for your input, it is making me think even deeper and that is a good thing. Looking forward to hearing more from you.
per HOA rules we must keep everything below 6'. As to feeding drip lines, the HOA delivers water to our homes under pressure that is sufficient to support drip lines. I can easily get water to 4' heights without pump support.
I was thinking you could run the drip lines entirely off gravity feed because it takes such little pressure to run it, all you need to do is make sure the water level in the tanks is higher than the point where you want the water to come out.
Float switch issue: First altering IBC tanks is difficult, there are many vertical and lateral braces that will make exact float valve placement in the sides difficult.
I was talking about an electronic float switch, not a float valve. I fully agree a float valve would be a pain.
what a float switch does is when the float drops it sends a signal to say it has dropped, then you have the arduino read that it has dropped, now it needs to turn on the electronic valve, until it gets the signal that the float is up again, or tell it to keep that valve open for a set period of time or have another switch at the top to tell the arduino when its full.
I like the idea with the bobber and the magnet better though as you could put a bunch of hall sensors on the outside of the tanks, all of them just looking for that magnet, if all the hall sensors are placed at measured intervals vertically along your tank, you would know how much water is in the tank by witch hall sensors are reading the magnet floating in the tank. I also suggested just have the water valves wired to your arduino and when the water level reaches a certain point the arduino turns on which ever valve you want it too and when the hall sensors reads the tank is full (bobber and magnet is at the top hall sensor) it turns the water back off. You could also get a wifi shield for your arduino and if your home wifi reaches it, you could control it from all over the world.
@dryden Again thx for your reply and figuratively speaking thanks a whole bunch for "sticking to your guns". I did look at electronic float switches and wondered how many I would need to reasonably figure out water height along with 4 to control opening and closing valves. All I could vision is one interfering with another. BUT, for whatever reason I did not pay much attention to your suggestion about a magnet somehow floating in a tethered vertical line and then "hall sensors" as many as needed to determine water level. I might have blown through your suggestions because I've never heard of "hall sensors" and possibly using a fishing float just did not sound cool. Please accept my apology and for sure this might be the coolest solution yet and so THANK YOU for "sticking to your guns". I will now spend a bit of time looking into what are and how to use "hall sensors".
My intention was always to programmatically through Arduino, open and close valves but what I was looking for was an accurate method to measure water level, and you may have led me in the right direction. At least at a minimum a direction well worth considering.
I will let you know what I learn and so thx and do continue "sticking to your guns".
@dryden In my last response I missed a couple things, so:
On drip lines, most stuff is below the tanks but a few pots are higher. My intention is to use the pump when HOA supplied pressurized irrigation is not available.
I was considering a WIFI shield or one of the newer models of control boards that already have WIFI and Bluetooth on board. This stuff all needs designed yet, for now off to investigating "hall sensors", again thanks!
A couple of things to consider if you choose to use Hall effect sensors ...
1) if the power goes out, how to you reset the levels being monitored.The micro-controller will not be able to remember the previous level unless you save it somewhere invulnerable to power outages (hint: the Arduino's EEPROM)
2) unless the micro controller knows exactly when it's being filled and when it's being emptied, it may be difficult for it to determine on its own if the sensor, upon noticing that a magnet has approached, means that the float is travelling up or down.
will, thanks for the heads up and with that heads up I am now thinking more about abnormal situations. And, even considering meticulous storage of every action in EEPROM there become many situations where what is in EEPROM does not actually represent actual water levels in the tanks. For example something happens where the micro-controller stops but nothing is done to immediately stop filling and/or draining. When the system does restart there would be no way to determine water level unless by chance one of the "hall effect sensors" was lined up with the magnet. Even then how would you determine if it was a bit above or a bit below. So my original thinking was using some form of measuring that will always determine exact water level and on a restart after an abnormal end (ABEND in IBM speak) what to do could be determined. Again thanks will and another thanks to dryden for opening this issue up to the forum to be discussed. This is how we learn!
I have a couple of questions about your setup. Unlike @dryden, I have no experience with irrigation techniques. So, that said, they're probably going to seem very obtuse.
I'm asking because I really like the idea of an HC-SR04 pointing downwards to detect the distance to the water surface inside the drum and I'd like to think about a solution using one of them. Besides, I have one somewhere around here so I can actually test the hardware.
1) Do the tanks have a threaded screw-on cap and, if so, what is its diameter ?
2) Are the tank caps pierced, or is air vented into the tank via something other than the cap ?
3) What is the shape and orientation of the tanks.
Questions 1 and 2 relate to mounting the sensor inside the "lid" of the cap. It would be safe and relatively easy to have it always screwed back into the same place, thereby making it more reliable from an accuracy point of view.
Question 2 also relates to the safety of this location. If the cap is not pierced and the tank is vented elsewhere, then I think circuitry mounted there would be less likely to suffer from dew or water vapour. Also, if the tank is overfilled, it may not be safe to store the electronics or a battery inside.
Question 3 is to determine how to calculate water volume from the distance down from the top of the tank.
will again thanks for your interest. To help answer your questions I put together the following image:
On to your questions: Yes threaded screw caps of 6" diameter and about 1.5" deep on inside. I ordered and expect delivered Friday a cap that is flat on top and so can be modified, waiting to see.
Shape and orientation of tanks? Hopefully image fulfills this question, if not let me know.
Overflow. This is absolutely required when using city water. The overflow outlet must be larger than the input water diameter and lower than water input. This prevents, without any doubt, irrigation water being siphoned into the fresh water system. the only other approach requires certified backflow preventors that are subjected to periodic inspections, that one pays for!
Venting, as image shows there will be vents. And realizing how important it is to eliminate water vapor, dew, condensation I am considering installing a small fan to circulate air. If I do install the fan, and likely will, there will be another vent in opposite corner of the tank with the sensing apparatus. And, I am also considering redundant measuring systems, one in each tank. We'll see!
I will be receiving my "ELEGOO UNO R3 Project Most Complete Starter Kit w/Tutorial Compatible with Arduino IDE (63 Items) " on Saturday. This should be the start of figuring out what can and cannot be done. So you know I have zero experience putting together micro-controller systems but have never failed at anything I undertook. Lots of instructive stuff on the internet and I've spent the last 3-4 weeks consuming all of it. On the up side, I do have 30+ years programming experience - Cobol, C++, Java, Assembler (8088 & IBM BAL) and many more on all types of platforms. Also extensive database (hierarchical, relational, indexed, direct access, etc.) along with the architecture of large systems. I did retire 12 years ago so skills are rusty, but just reviewing the C++ code for these micro-controller systems is waking things up. Also I am a skilled carpenter, cabinet maker, great at home electronics and plumbing with an extensive 2 car garage workshop. There is not much I am not able to do.
Continuing the venting issue, another thought is to enclose the HC-SR04 just allowing the sensors to show through the enclosure and then come through the top of cap with a somewhat enclosed box that is protected from weather and somehow vented to release not only condensation, etc. but also release heat. I will know more about this once I receive all the parts and figure out how they all go together. To say the least this irrigation system is quite the adventure and I am going to enjoy the ride!
Great, thanks for all the info, it helps clear up the situation and also makes it easy to calculate volume (I was imagining cylindrical tanks with partial semi-spheres on the ends oriented horizontally :). The rectangular shape means that you won't even need to calculate volume, you can calculate fill levels purely as a percentage (after determining the water levels when empty and full).
Your coding experience will be very useful, mostly what you'll need for this project is just C code used inside a C++ environment.
You mentioned heat, which brings up an interesting point as desert environments usually have a large temperature swing between day and night. This will cause extra stress on the electronics.
Since the HC-SR04 must have an empty path to work, it will need to be exposed to the inside of the tank and may degrade over time due to the moisture content of the air, so allowance should be made to provide an easy way to replace it. Maybe a small hole drilled into the cap with a plug on the inside and the HC-SR04 mounted on the bottom of the cap can be plugged into that. Then a drowned, rusty sensor can easily be replaced.
I think you'll find it very easy (as an experienced programmer) to work with the Arduino and the SR04 is a very straightforward device to use as well, a perfect component to use as a starting project.
While I am waiting for my "ELEGOO UNO R3 Project Most Complete Starter Kit w/Tutorial Compatible with Arduino IDE (63 Items) " to start some prototyping I've been digging more into the overall tank deign. I've come up with some significant changes. But there are some questions?
Now, do I talk first or show pictures first? Going with pictures first:
So in this image you see added a 4" PVC stack with a funny box on top that is connected to the 2" line connecting the tanks. This 4" stack will maintain the exact same water level as the tanks.
At a minimum:
1) It allows distance sensing devices to be implemented well above the water level; and
2) It allows for water inputs and vents to go through the 6" caps. And with this I now have no need to drill any holes in the tanks. I do like this!
Yes I am concerned with the width of the beam for an ultrasonic measuring device like the HC-SR04 in a 4" tube. Don't know what will happen but I do have an alternative approach, more on that later. For sure once I get my testing tools I will be setting up a prototype. I am hoping that the smooth walls of the PVC will allow things to work. It will be fun finding out!
So if the HC-SR04 doesn't work out I am going to try some Laser devices since they shoot a narrow beam. Yep, beam won't bounce anything back off water but I have a float designed that might do the job. This next image shows just the 4" PVC stack in an x-ray mode.
This 4" measuring stack first came to mind when I was working through @dryden suggestion of "hall effect sensors" and a magnet. My thought then was instead of trying to control a perpendicular wire in the huge tanks for the magnet to run on it would be much simpler to run the magnet in the 4" pipe. And attaching the "hall effect sensors" to the ICB tanks would be tricky working around all the metal braces and figuring just how to attach them. So it would be FAR simpler to attach the sensors to the 4" PVC. So another thank you to dryden for being the seed for this idea!
Hopefully this message and diagrams give you a reasonable idea of this approach, if not fire away with any questions.
My questions to you and anyone else are:
1) Do you have any knowledge or experience with using the HC-SR04 in a 4" smooth sided tube? And do you know anyone with this knowledge or experience?
2) What do you think of the laser idea of bouncing off a float?
3) Do you know if a laser will work in a 4" tube? I am pretty sure it will, BUT until proven I will be wondering and prototyping.
4) Can you point me towards any dependable lasers that work with an Arduino? Not asking for you to do any searching, I will be doing that. But asking just in case there is something you are already aware of please let me know.
For anyone following or wandering into this thread where I continually refer to ICB Tanks/Totes, especially the difficulties in attaching various sensors to the sides, here is an image:
Other questions to ponder before its arrival ...
How to power the device ?
How to display the results (visible in daylight, darkness) ?
Does it control anything (valves, motors, etc)
Does it need to transmit data elsewhere (like your house)
One device for each tank, or for both (your diagram is kinda strange because it looks like you're connecting the measuring tube to BOTH tanks' output and overflow pipes. That would either fail horribly or suggest that each tank has a separate valve which would make the level indicator depending n knowing WHICH tank valve was open.)
My questions to you and anyone else are:
1) Do you have any knowledge or experience with using the HC-SR04 in a 4" smooth sided tube? And do you know anyone with this knowledge or experience?
I found my HC-SR04 and I have a 1.25 m (about 4' in your measure) chunk of 75 mm (about 3" in your measure) ABS pipe. I'm 3D printing off a cap for the pipe and I'll try mounting the sensor on the inside of the cap and try ranging measurements down the inside of the tube.
That should answer this question one way or the other. Probably afternoon sometime.
As for the other questions ...
2) seems reasonable, just a plastic lid on a block of wood ought to do. (Plastic so it won't rust)
3) certainly seems reasonable (in theory)
4) haven't used any TOF (Time of flight) lasers yet. Expect to append an extra zero to the price of an HC-SR04 though.