Agriculture consumes between 80 – 90% of all freshwater in the United States. An easy way to conserve water in the agricultural sector is to install a soil moisture sensor. Soil moisture sensors measure the amount of water in the soil to maintain consistent and ideal soil conditions for plants. In some cases, installing a soil moisture sensor reduces residential irrigation by as much as 50%.
Excluding the Pi, the system can be built for less than $25.
Here’s a tutorial on how to control an outdoor irrigation valve to automatically water your plants when the soil is dry.
Step 1: Materials
This tutorial is based on a fully set-up Raspberry Pi, including GPIO libraries + GPIO cable w/ breadboard connector. I also recommend setting it up for wireless + SSH.
Other microcontrollers, like an Arduino, also work.
— 1 MOhm resistor
This resistance was the best for my system, but a different resistor value might work better for your own setup. Experiment w/ different value resistors and see what happens!
— Co-Planar Capacitor
— Solid core or stranded 22-gauge wire
Recommended to get stranded wire b/c conducts better & is less likely to break.
— Breadboard, breadboard wires + GPIO breadboard converter
This is the bare minimum needed to build & test the system. If you want to install it outside after it has been tested and confirmed to work, coat everything in epoxy! …Although a better way might be to replace the breadboard w/ a PCB board. Molex connectors are also a nice addition.
Step 2: Tools
Soldering iron, solder & solder-sucker (or solder wick)
A soldering iron is (almost) essential for this project, especially for attaching wire leads to the co-planar capacitor. You can purchase a soldering iron, solder and solder wick (removes solder) for ~ $20-30, or find a local makerspace/hackerspace that will let you come in and use an on-site soldering iron.
— Wire Strippers
— Optional (but highly recommended): Multimeter (for testing and debugging!)
Step 3: Sensor & Circuit Design
An RC circuit provides a quick & simple way to measure changes in the sensor capacitance due to changes in soil water content.
Every RC circuit has an associated time constant, which is the time it takes the capacitor to reach ~ 63% of its maximum charge. The time constant equals the total circuit resistance times the circuit capacitance: τ = R * C
The time constant is used to measure changes in the sensor capacitance due to changes in soil water content. As the water content increases, the capacitance increases causing the associated circuit time constant to increase. The Raspberry Pi GPIO Pin 14 measures, or counts, the circuit time constant (how long it takes the capacitor to charge).
For more detail: Raspberry Pi Soil Moisture Sensor
Current Project / Post can also be found using:
- Raspberry pi mcp3008 l298n tutorial