Introduction: $10-15 Automatic Digital Soil Moisture Relay
The main ingredients for this are dirt cheap, no need for arduino or raspberry pi.
Step 1: About This Project
In another of my instructables I built a small solar hydroponic system. In it I had mentioned that I discovered the $8 digital timer I was using had a reset that could be set off by a relay. Well I looked on eBay and go figure, there was an adjustable soil moisture relay for a whopping $3 and change. Yup I ordered it and it just arrived today.
For the past two weeks I have just used the timer, pump on for 15 seconds, then 2 hours 40 minutes later it resets to the first timer and the process starts over again. In basic terms, my plants got watered 15 seconds every 2 hours and 40 minutes. That has worked great so far, but on another project I did I had a problem with the seedlings "damping off", a term used for basically saying the medium (rapid rooter pellets) were too wet and fungus killed the plants. I was worried about that on this project as well. The way I have it set now takes all the guesswork out of the process.
The timer is now set to water 15 seconds once every two days. The soil moisture relay trips the timer on if the rapid rooter gets too dry and the plant gets a drink, resetting the timer back to its 15 seconds pump on, 48 hours pump off. The timer is set to loop infinitely as long as there's power but by setting it for two days, it allows the moisture relay to kick on whenever the plants need it which is a better system considering there's always factors that change, low humidity, rainy days etc etc.
Step 2: Inventory List
1) Timer Module (link below)
2) Soil Moisture Relay (link below)
3) 12v Power Supply ( you can do this multiple ways, I chose a 12v 7ah SLA battery, a solar charge controller, and a small solar panel).
Misc Items and Tools:
1) Soldering Iron
2) Rosin Core Solder
3) Shrink Wrap
4) Extra Wire (speaker wire, or harvest some wire from an old 12v transformer like one from an old modem etc).
5) Small Phillips and Flat Head Screwdrivers.
Step 3: Extend the Sensor Wire
Ok the sensor wire was far too short to reach my electronics box so I cut the sensor wire in half then soldered in a longer piece, using shrink wrap over the connections. I also shrunk wrapped the connectors that attach to the sensor.
Step 4: Connect the Sensor to 12v
I used Blue as the (+) wire and Black as the ground (-). Solder and shrink wrap the power wires to the soil moisture relay board as shown. Connect to your chosen 12v source and you will be rewarded with a red and a green led both lit. Dunk the sensor in water and the green light goes out and you will hear a click as the relay trips. My 12v power supply comes from the load side of the solar charger module.
Step 5: Calibrate the Sensor
There is an adjustable potentiometer that you can trim with a small Phillips screwdriver. From the picture, I used a sponge, that didn't work so I ended up using another rapid rooter plug and jammed the sensor in it. Dunk it in water then squeeze the water out to the dryness you want the sensor to kick the relay on. Now turn the potentiometer till the green led turns off, then in turn the opposite a tiny bit, then wait if the green light doesn't turn on slowly in five to ten seconds, turn another tiny bit, then wait again. Repeat the process until the light comes on. It will slowly glow brighter till the relay trips. Dunk the sensor or pour water on your medium and the light goes out, wring out the medium and the light should slowly come back on. You can do this process with soil too, I would use a few cups of soil with varying dampness/dryness to fine tune it to your liking.
Step 6: Figuring Out the Relay Ports
The relay terminals have screw downs so you can easily connect wires. I screwed them all the way open then inserted my voltmeters leads. One of the settings on my voltmeter beeps when it detects a short. The three screw down terminals are labeled in Chinese, so that is no help. The middle is common, the ones on each side are NO (normally open) or NC (normally closed). The one we want is the normally open connection since we want the relay to short the timer to reset it. The normally open terminal you want will short out when the sensor drys out, in other words dunk the sensor and the connection is made. Connect a 6" or so of double wire (-) to the center i.e. COM or common terminal and (+) to the NO (normally open) terminal.
Tin the wires and trim them to length needed for the screw down terminal connections. Tinning wires is simply applying heat with the soldering iron, then applying just enough solder that it flows into the open spaces in the wire. You don't want a big glob of solder on the wire, if you get one simply apply heat and quickly tap the glob off the wire with the iron tip. Tinning and trimming the wires creates a much stronger, nicer looking connection to the terminal block.
Step 7: Connect to the Timer
There is a great instruction manual for the timer translated properly to English on thingiverse.com (link below).
You want to connect your wires from the relay to the (+) and the CH1 terminals of the timer. It doesn't matter which wires you wire to these two ports. Essentially the NO and COM ports from the soil relay are just creating a short circuit to the (+) and CH1 ports on the timer to reset it.
Program the timer to use function 6. Hint, when you get to the NX function settings, the first two digits are the multiplier for the first timer, the last two digits are the multiplier for the second timer. I set mine to 15 secs timer one and 48 hours on timer two. Timer one is pump on, timer two is pump off. When you get the timer, it's default NX setting is 0101. Mine is set to 0120, which translates to timer1, one second per timer setting i.e. 15 seconds. The second timer is set with a multiplier of 20. So here's the math.
Timer one setting 15 with NX value of 01 = 15 seconds so (15 x 1 = 15)
Timer two setting 8640 with NX value of 20 = 172800 seconds so (8640 x 20 = 172,800)
We know there are 60 seconds per minute so 60 x 60 = 3600 seconds per hour
I wanted 48 hours so 48 x 3600 = 172,800 seconds per 48 hours
If each tick on the timer is 20 seconds, then 172,800 / 20 = 8640 timer ticks of 20 seconds each to reach 48 hours.
Hope this is helpful, it should become clear as you play with the timer, that plus the instructions on thingiverse should get you where you need to be in the setup of the timer.
There are other ways to set the timer, this was just the way I picked...I like knowing my plants will still get some water every two days if the sensor fails for some reason.
Step 8: Place the Sensor
As I said I jammed mine in another rapid rooter plug and squeezed it gently next to the one with the plant in it, then covered in with lava rock.
Step 9: Final Notes
After thinking about this particular sensor relay, you could use it as a direct relay to control a pump for watering without the timer. This would cut the price down to less than $5.