Jumping head first into the deep end.

I have a couple small projects using the NodeMCU 8266 platform. With the current growing season coming about, I am getting back into my project for setting up an OpenGarden system. I may be asking for too much, but I have broken it down into a couple stages that would help things along.

I have 2 separate raised beds with 2 rain barrels in between them. One rain barrel per raised bed. I have a pond filter and pump to push the water to a drip irrigation system for each raised bed. I want to mount an outdoor enclosure to control things for both gardens. I will have power at the location so no need for battery or solar, this time.

I am originally looking at an ESP32 Thing, but this of course can change to any flavor of Arduino or Pi.

1 x Controller

First Stage would be a basic set of relays to turn the pond pump on in each barrel with a timed delay.

2 x Relays http://www.gearbest.com/power/pp_348958.html?currency=USD&vip=760153&gclid=CjwKEAjwsLTJBRCvibaW9bGLtUESJAC4wKw1AR-NtVqR4GLoMOGCz2kTUEu32YQ_rhQuGIqIdsPkxxoCXebw_wcB

Second stage would be the addition of 3 x moisture sensors for each garden, so a total of 6 x soil moisture sensors. Watering would now be from the moisture sensors and not timed. At this point I would also like to try to integrate it with my Homeseer software directly or through MQTT.

6 x soil moisture sensors http://www.ebay.com/itm/like/231250853349?lpid=82&chn=ps&ul_noapp=true

http://www.ebay.com/itm/Latest-For-arduino-Soil-Hygrometer-Humidity-Detection-Module-Moisture-Sensor/222164422186?_trksid=p2352135.c100338.m3726&_trkparms=aid%3D222007%26algo%3DSIC.MBE%26ao%3D1%26asc%3D20150313114020%26meid%3D0f057e6b920d49eeb5d8fd1dc34d0bdb%26pid%3D100338%26rk%3D3%26rkt%3D16%26sd%3D231250853349

Will a 20ft cable work on one of these I wonder? Can I use the LM393 comparator that these come with to compensate for the wire length? Think maybe silicone will work to protect the moisture circuit?

Third Stage would be to add an ultrasonic sensor for each barrel to detect capacity levels. 2 x UltraSonic Sensor These are the standard ones... https://www.amazon.com/HC-SR04-Ultrasonic-Distance-MEGA2560-ElecRight/dp/B01MA4O5G5/ref=sr_1_1?ie=UTF8&qid=1496176555&sr=8-1-spons&keywords=hc-sr04&psc=1 Seeing I will need to attach it to the top of the barrel, these looked promising... http://www.robotshop.com/en/weatherproof-ultrasonic-sensor-separate-probe.html?gclid=CjwKEAjwsLTJBRCvibaW9bGLtUESJAC4wKw1Vb7eyjIwMdicxnVJRXTGUpTKU-89OTZehpgjJQ7KnxoCci_w_wcB

Also add a flow meter just to monitor the amount of water that has been moved. 1 x Water flow sensor http://wiki.seeedstudio.com/wiki/G1/2_Water_Flow_sensor

Stage four and the last bit of overkill I would like to do it put the box in a windowed wall mount PVC enclosure. Cheaper the better. And add a large LCD in the window of the enclosure to display information about the entire setup. Capacity, last run time, total capaticy used per day/week/month/year.

I may need an RTC. I would like to add sensors like... 1 x Temperature 1 x Humidity 1 x Barometor ...Even though I plan to make a dedicated weather station. Maybe this could be used to aggregate data.

I was thinking of using Grove stuff until I found that UltraSonic sensor and ran into this Grove item... https://www.seeedstudio.com/Grove-Heelight-Sensor-p-2867.html

Would be neat to be able to talk to the box since it will be chest level and right beside the gardens..

As you see I am asking to cram a lot in here, I need to do an input count to see what I am looking at. But any suggestions on which controller to use and other suggestions on hardware, or just a plain and simple "Too Much, Man!"

Thanks!

Stage 1: those relay modules are advertised for use with 5V Arduino. Esp8266 is 3.3V. It might work, but if it doesn't, you have no comeback. Look for relay modules that say they work with 3.3V. What voltage are your pond pumps? If they are 12/24VAC, a couple of MOSFETs would be an alternative to relays.

You won't need an rtc. You can get the esp to keep excellent time, by synchronising with an ntp time server.

Most important tip: check with us before you spend money.

Also please post links properly in future. Use the link icon.

Stage 2: i think those soil moisture sensors are useless. The probes will soon rot and stop working. The circuit board that they come with serves little purpose if you want to measure the soil moisture as an analog value. If you just want a digital water/don't water signal then they are useful for that, and you can adjust each one's sensitivity individually.

What I use is two lengths of galvanised thick steel wire, clamped in a pair of large screw terminal blocks. Use that in conjunction with a 10K resistor to form a voltage divider to feed an analog input. Only apply the supply voltage to the probe for an instant when you read the voltage. This minimises the corrosion of the probe over time due to the flow of current, and prevents the buildup of charge in the soil which would give a false reading.

Here is a prototype I am working on. You can see the soil probe at the top of the picture.

Here's a screen shot of the web page showing the above soil sensor reading over time:

PaulRB: Stage 1: those relay modules are advertised for use with 5V Arduino. Esp8266 is 3.3V. It might work, but if it doesn't, you have no comeback. Look for relay modules that say they work with 3.3V. What voltage are your pond pumps? If they are 12/24VAC, a couple of MOSFETs would be an alternative to relays.

So something like this would be correct?... http://www.ebay.com/itm/4PCS-3V-Relay-High-Level-Driver-Module-optocouple-Relay-Module-for-Arduino-/361991591286?hash=item5448615576:g:p~EAAOSwaEhZH1X-

What about the ones that claim they work with both 3v and 5v, but are labeled 5v? Is that BS? http://www.ebay.com/itm/4-Channel-3-3V-5V-10A-Relay-Module-for-Arduino-RPi-ESP8266-Optocoupler-/272607159304?hash=item3f78a72408:g:xQ4AAOSwB-1Y2P6K

The Pond pumps are 120v. They plug straight into the wall and don't have a power adapter. I don't know if there is one built in, they are small..

If you have wifi where the controller is going to be, consider using one of the wifi enabled Pis either in addition to or instead of the LCD. You can keep and serve up as much data on your operations as you feel like. Of course, if desired, the Pi could be the controller and then you could both monitor it and control it remotely via a web page.

Simple soil mosture sensors are near useless.

1/ any metal in contact with moist soil will generate a potential of its own -you must energise with ac to remove this unpredictable dc component and reduce corrosion. A metal with low electropositivity is better for these applications - eg lead, or ( better) gold. Stainless steel (316) is often used because of it's mechanical strength.

2/the conductivity of soil varies not only with moisture but with soil type and ionic species present - a tiny amount of fertiliser makes an enormous difference to conductivity.

Professional meters energise at 100MHz, where the dielectric constant of water is far more significant than it's conductivity, and so they ignore small ionic concentrations - but results still, of course vary with soil types and must be calibrated for accurate results..

Allan

allanhurst:
Simple soil mosture sensors are near useless.

1/ any metal in contact with moist soil will generate a potential of its own -you must energise with ac to remove this unpredictable dc component and reduce corrosion. A metal with low electropositivity is better for these applications - eg lead, or ( better) gold. Stainless steel (316) is often used because of it’s mechanical strength.

2/the conductivity of soil varies not only with moisture but with soil type and ionic species present - a tiny amount of fertiliser makes an enormous difference to conductivity.

Would you say this one falls in line with the same as the others as being useless and junk?
http://www.vegetronix.com/Products/VH400/

I’m not looking for deep data when it comes to the moisture of the soil, just whether to water or not. Sounds like PaulRB’s homemade method may be the best option. Do you think stainless would be a better material to use than galvanized steel?

It all makes sense when your just monitoring conductivity. I saw this little guy and was baffled on how they could produce information on both soil moisture and soil fertility…
https://www.amazon.com/Xiaomi-Plant-Flower-Smart-Monitor/dp/B06X9V2FKJ/ref=sr_1_35?ie=UTF8&qid=1496261000&sr=8-35&keywords=garden+soil+moisture+sensor

The first link you gave refuses to reveal the operating principle - so I can't say. I suspect insulated electrodes and a capacitance measuring approach which would be OK.

As for sensing electrodes - zinc is highly electropositive, so SS would be a better option. Or even carbon rods

but USE AC!

The second link cannot be a good capacitive sensor at low frequencies , so depending on the exitation frequency, it could neasure both (mostly) conductivity at a low frequency, and (mostly the dielectric constant at a much higher one.

The ratios and absolute values could give an indication of ionic content - ie fertiliser concentration.

Allan

allanhurst: The first link you gave refuses to reveal the operating principle - so I can't say. I suspect insulated electrodes and a capacitance measuring approach which would be OK.

As for sensing electrodes - zinc is highly electropositive, so SS would be a better option. Or even carbon rods

but USE AC!

The second link cannot be a good capacitive sensor at low frequencies , so depending on the exitation frequency, it could neasure both (mostly) conductivity at a low frequency, and (mostly the dielectric constant at a much higher one.

The ratios and absolute values could give an indication of ionic content - ie fertiliser concentration.

Allan

Thank you for this information. I need to understand more to wrap my head around using AC instead of DC. I found this post that seems to run in that same direction... http://forum.arduino.cc/index.php?topic=37975.0

I,of course, would still use low voltage correct?

So it sounds like the most cost effective solution would be to go with the homemade method and use a good material and AC current. If so, now I need to figure out how to go about that.

So a good material to use would be SS, like some 9" SS nails from the hardware store? And then Plaster of Paris and burlap type solution like in the post mentioned above, or not? And when you say carbon rods, you mean Carbon Steel? I found these..

https://www.grainger.com/product/GRAINGER-APPROVED-Rod-2HJF5?s_pp=false&picUrl=//static.grainger.com/rp/s/is/image/Grainger/2HJF4_AS01?$smthumb$

But looking up Alloy Type 1018, its a mild steel with low carbon. And from these page... https://www.onlinemetals.com/productguides/steelguide.cfm https://en.wikipedia.org/wiki/SAE_steel_grades#Carbon_and_alloy_steel ...it looks like galvanized and stainless are about the same in carbon content. Not even sure if C content is where you are headed with your suggestions.

I know I am headed down a rabbit hole here, but learning more about it all from other enthusiasts and over engineering something is just as enjoyable as putting the project together. I could simplify by buying a cheap sensor, but, no.

Essentially are we wanting something highly conductive but low corrosion? What about sterling silver wire wrapped around a plastic nail or screw?

Found a couple great writeups for a moisture sensor...

http://www.machinegurning.com/arduino/SylvaSense

http://www.machinegurning.com/arduino/SylvaSense-2/

http://zerocharactersleft.blogspot.ca/2011/11/pcb-as-capacitive-soil-moisture-sensor.html?m=1

https://www.tindie.com/products/Power_Modules/fdr-100mhz-plant-soil-sensor-mineral-transparency/

allanhurst: Professional meters energise at 100MHz, ...

Do you need such high frequency? If you use measuring of capacitance can you just use some Arduino available methods to measure it such as time to charge/discharge the probe? Or is there a trick with "capacitance" of water at 100MHz vs. "capacitance" of other parts of soil?

The high frequency is chosen so that the impedance of the capacitance of the water is much lower that of it's resistance - so that the ionic impurities aren't seen.

Allan

I still don’t understand. I thought capacitive sensing of humidity works similar to touch sensing - isolated electrode and measuring its capacitance - without contact with the soil, so resistance is not important. It is probably more complicated. Will keep it in mind, maybe some day I will get more insight.

Pure water hardly conducts electricity at. When I worked on big klystrons in TV transmitters, boiling pure water was used as a coolant, and had 25kV across it.

But add some ionic materials to the water - eg salt, ammonium nitrate fertiliser etc - and it's conductivity increases enormously. In soil the concentration of these materials is unknown, so a resistance measurement is only a very approximate measurement of water concentration.

However the dielectric constant of the water is hardly affected by small amounts of ionic stuff, so using a measurement of capacitance at a frequency high enough that the water's capacitative impedance is far lower than the likely resistance of the ionic solution gives a fairly accurate result.

Allan.

Sorry for my ignorance, I don’t understand this well. I just thought using two isolated probes and measuring capacitance between them may work as well without needing 100 MHz which is too fast for Arduino. Maybe only just one probe as touch sensor does - despite I am not sure where exactly the capacitance in touch sensor is hidden I tried it and it worked suprisingly well. Or is the 100 MHz capacitance measuring doing something different from charging “capacitor” made by two (or one?) probes and soil as dielectricts and then waiting how long it will discharge via large resistor?

The impedance of a capacitor varies as the inverse of the frequency -

Z = 1 / (2 x pi x F x C)

Where Z is in ohms, C in farads and F in Hz....

So the higher the frequency the lower the capacitative reactance.

In impure water you have a capacitative reactance depending on the dielectric constant of water, in parallel with a resistance depending on the concentration of the dissolved ionic matter, and both depending on the geometry of the electrodes. The measurement you make, by whatever means, has to deal with these 2 contributions to the seen impedance.

The resistance remains unchanged with frequency.

At low frequencies the capacitative reactance Z as calculated above will be large, and so the resistance of the water dominates. At high frequencies Z becomes small and the capacitance reactance dominates.

As previously mentioned the resistance gives a poor estimation of water concentration, as it depends so heavily on the dissolved ionic materials' concentration, which is unknown. Whereas water's dielectric constant is well known and fixed ( varies a little bit with temperature)

Hence the use of a very high frequency in professional soil ( or grain) moisture content meters.

Allan

This is OT a bit (but OP may be interested too?), I feel a bit guilty for hijacking the topic, but my curiosity don't let me stop.

I understand the problem with resistance measuring and impedance of capacitor (at least I think so). But if you isolate the electrodes there is "infinite" resistance so you are measuring capacitance only even at low frequencies. But maybe I am missing something fundamental here (reliability? repeatability?) because I don't understand complicated ways to detect touch (this is similar, isn't it?) when all that is needed is charge electrode and measure time it takes the current "bleeds" out of it.

Smajdalf: This is OT a bit (but OP may be interested too?), I feel a bit guilty for hijacking the topic, but my curiosity don't let me stop.

This type of thing is exactly why I am here.

allanhurst: Pure water hardly conducts electricity at. When I worked on big klystrons in TV transmitters, boiling pure water was used as a coolant, and had 25kV across it.

But add some ionic materials to the water - eg salt, ammonium nitrate fertiliser etc - and it's conductivity increases enormously. In soil the concentration of these materials is unknown, so a resistance measurement is only a very approximate measurement of water concentration.

However the dielectric constant of the water is hardly affected by small amounts of ionic stuff, so using a measurement of capacitance at a frequency high enough that the water's capacitative impedance is far lower than the likely resistance of the ionic solution gives a fairly accurate result.

Allan.

What would you say to making a senor like this one... http://www.machinegurning.com/arduino/SylvaSense-2/ Except putting 4 conductors in there, separating the pairs and using a high frequency for one to measure soil moisture and low frequency for the other measuring fertility? I found this example of using alternating current... https://hackaday.io/post/19994 I am assuming this is what you mean by AC? Or is there a way to use the sensor as is, and push the high over, take the measurement, and then push the low over?

Your link

https://hackaday.io/post/19994

does indeed provide ac excitation. But the frequency will be low, and so willmeasure mostly the resistive part of the impedance.

Not very accurate, but better than dc .

Allan