After the mediocre performance of my vegetable garden last year (50% of the plants produced), winter is the perfect time to reflect on what went wrong.
First, I started the project with a simple idea and absolutely zero experimentation. Second, the methods I chose did not work as I had hoped they would and my fall back was too simple. Third, minor tech troubles exacerbated the issues caused in the previous two steps.
To address item one, I have started prepping my solution as of the end of November 2017 with an eye on March 2018. This is giving me time to test and refine as I go.
On item two, I had to look at what worked and what didn't.
The pump system worked well, but needs to be reconfigured to deliver water at the soil level; even a moderate drop of four inches resulted in erosion and root exposure over time.
The planters were acceptable, but the height differential was tough to deal with. New planters will be needed.
The right microcontroller was not available immediately. This combined with my use of a homemade resistive moisture sensor. An arduino uno and a working sensor would not have needed a network connection; watering would have been automatic. Unfortunately, the moisture sensor was unstable, regularly spiking and/or floating. Even using averaged values for the readings didn't mitigate the problem and watering was not being performed correctly. As such, I tried using an ESP8266 to drive watering via a Node-Red-triggered HTTP call. This worked, but without the time to configure a weather-driven rule set, it resulted in watering when the soil was already wet.
The final problem was the ESP8266 regularly entered an unresponsive state. It would be visible on the network, it could be pinged, but the simple web page it was set to serve didn't work and the URLs that would trigger watering events didn't resolve. Only a restart would clear the issue and, when away from home or at work, this is not practical.
So, with these issues in mind, especially the latter issues, I looked at new options.
I knew I wanted to use an arduino uno. They are reliable and generally just work once coded correctly. I also wanted to locate the unit away from the house. Along with the uno not having wifi without a shield, the physical location reduced the likelihood of wifi signal being available. So, it would need a sensor in order to water correctly.
The search was on. In my looking I stumbled on a Stackoverflow question about capacitive moisture sensors, with a link to an article. The article included an Eagle file for a capacitive moisture sensor. For those that don't know, an Eagle file is a file used to fabricate Printed Circuit Boards (PCBs). So, with a design in hand, I went to the fantastic folks at OSH Park and ordered the minimum number of boards.
A couple weeks later I was the proud holder of three moisture sensors, all for less than $10.

Unlike resistive moisture sensors, these sensors will not corrode as they do not rely on electrolysis for measurement. Instead, the more moisture in the soil, the greater the capacitance of the sensor (i.e. the more capacity it has to store electricity, like an incredibly tiny battery).
Then I incorporated a 555 timer chip into the design. The 555 timer chip uses a capacitor, along with two resistors, to define the frequency and duration of output voltage. The larger the capacitor, the lower the frequency. Thus, as the soil moisture increases, capacitance increases, so the frequency reduces.
Combining a 555 timer chip with the sensor and an uno allows me to measure the high and low time of the 555 timer output, indirectly assessing the moisture level of the soil.
Once I knew this worked, I designed my own PCB for the 555 timer in this setup. I used Fritzing as it has a simple PCB design interface. Note: Fritzing produces Gerber files, not Eagle files, so be sure to read the submission portion of the OSH Park (or other fabricator) website to ensure you meet their requirements. I had to do very little to meet their submission rules.
My design cost less than $5 for three boards - I deliberately reduced its size to slip into the lowest pricing tier. This is a 555 astable multivibrator. The board cannot be used for monostable due to the trace between pin 2 and pin 6 of the chip.


Got down to some soldering and got the goodies in place. The resistors are 1MΩ due to the extremely low capacitance of the moisture sensor. After pictures were taken, I added some more cable for the power, ground, and contr out. Contr in is only needed if the power for the board is NOT supplied by the controller - the controller needs a ground connection to the board, which it has if it supplies the power.
Side note, Santa needs to bring me better snips to trim the through-hole legs.


Using pulseIn to read high and low on the uno, contr out was connected to an uno pin and pulseIn read the high and low signal once a second. The readings were consistent for dry in air, in water, in dry soil, and in wet soil.
Next steps are to define the watering logic and set up a test system. For now, having consistent moisture readings is a massive improvement over my first attempts, so I'm well on my way to an aggressive start to spring.
Gratuitous group shot!

First, I started the project with a simple idea and absolutely zero experimentation. Second, the methods I chose did not work as I had hoped they would and my fall back was too simple. Third, minor tech troubles exacerbated the issues caused in the previous two steps.
To address item one, I have started prepping my solution as of the end of November 2017 with an eye on March 2018. This is giving me time to test and refine as I go.
On item two, I had to look at what worked and what didn't.
The pump system worked well, but needs to be reconfigured to deliver water at the soil level; even a moderate drop of four inches resulted in erosion and root exposure over time.
The planters were acceptable, but the height differential was tough to deal with. New planters will be needed.
The right microcontroller was not available immediately. This combined with my use of a homemade resistive moisture sensor. An arduino uno and a working sensor would not have needed a network connection; watering would have been automatic. Unfortunately, the moisture sensor was unstable, regularly spiking and/or floating. Even using averaged values for the readings didn't mitigate the problem and watering was not being performed correctly. As such, I tried using an ESP8266 to drive watering via a Node-Red-triggered HTTP call. This worked, but without the time to configure a weather-driven rule set, it resulted in watering when the soil was already wet.
The final problem was the ESP8266 regularly entered an unresponsive state. It would be visible on the network, it could be pinged, but the simple web page it was set to serve didn't work and the URLs that would trigger watering events didn't resolve. Only a restart would clear the issue and, when away from home or at work, this is not practical.
So, with these issues in mind, especially the latter issues, I looked at new options.
I knew I wanted to use an arduino uno. They are reliable and generally just work once coded correctly. I also wanted to locate the unit away from the house. Along with the uno not having wifi without a shield, the physical location reduced the likelihood of wifi signal being available. So, it would need a sensor in order to water correctly.
The search was on. In my looking I stumbled on a Stackoverflow question about capacitive moisture sensors, with a link to an article. The article included an Eagle file for a capacitive moisture sensor. For those that don't know, an Eagle file is a file used to fabricate Printed Circuit Boards (PCBs). So, with a design in hand, I went to the fantastic folks at OSH Park and ordered the minimum number of boards.
A couple weeks later I was the proud holder of three moisture sensors, all for less than $10.

Unlike resistive moisture sensors, these sensors will not corrode as they do not rely on electrolysis for measurement. Instead, the more moisture in the soil, the greater the capacitance of the sensor (i.e. the more capacity it has to store electricity, like an incredibly tiny battery).
Then I incorporated a 555 timer chip into the design. The 555 timer chip uses a capacitor, along with two resistors, to define the frequency and duration of output voltage. The larger the capacitor, the lower the frequency. Thus, as the soil moisture increases, capacitance increases, so the frequency reduces.
Combining a 555 timer chip with the sensor and an uno allows me to measure the high and low time of the 555 timer output, indirectly assessing the moisture level of the soil.
Once I knew this worked, I designed my own PCB for the 555 timer in this setup. I used Fritzing as it has a simple PCB design interface. Note: Fritzing produces Gerber files, not Eagle files, so be sure to read the submission portion of the OSH Park (or other fabricator) website to ensure you meet their requirements. I had to do very little to meet their submission rules.
My design cost less than $5 for three boards - I deliberately reduced its size to slip into the lowest pricing tier. This is a 555 astable multivibrator. The board cannot be used for monostable due to the trace between pin 2 and pin 6 of the chip.


Got down to some soldering and got the goodies in place. The resistors are 1MΩ due to the extremely low capacitance of the moisture sensor. After pictures were taken, I added some more cable for the power, ground, and contr out. Contr in is only needed if the power for the board is NOT supplied by the controller - the controller needs a ground connection to the board, which it has if it supplies the power.
Side note, Santa needs to bring me better snips to trim the through-hole legs.


Using pulseIn to read high and low on the uno, contr out was connected to an uno pin and pulseIn read the high and low signal once a second. The readings were consistent for dry in air, in water, in dry soil, and in wet soil.
Next steps are to define the watering logic and set up a test system. For now, having consistent moisture readings is a massive improvement over my first attempts, so I'm well on my way to an aggressive start to spring.
Gratuitous group shot!

Comments
Post a Comment