Raspberry Pi Soil Moisture Sensor

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%.

The following is a simple capacitive soil moisture sensor using a Raspberry Pi and a co-planar capacitor from the Zero Characters Left blog.

Raspberry Pi Soil Moisture Sensor

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

Raspberry Pi
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

Save the two EAGLE files (schematic and board file), then send to OSHPark. It costs ~ $10.00 for three.

β€” 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

β€” Epoxy

β€” Optional (but highly recommended): Multimeter (for testing and debugging!)

Raspberry Pi Soil Moisture Sensor

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


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top