Recently I was playing with a moisture sensor for one of my projects so I thought to share it with you. I got it from eBay for less than $4. Basically A soil moisture sensor measures the water content in soil. With it, you can easily tell when the soil needs more water or when it's over-watered. When the soil moisture is deficient the sensor output value will decrease. This sensor uses the two probes to pass current through the soil and then it reads that resistance to get the moisture level. Wet soil causes the soil to conduct electricity better (less resistance), whereas dry soil conducts electricity poorly (more resistance). You can determine whether or not a plant needs water by observing the results that the sensor outputs. Now by the end of this article you will be able to make your own moisture sensor that can track the water needs of the plants in you garden.
Step 1: This Is How a Soil Moisture Sensor Looks:
Moisture sensor module (Arduino Compatible)
Intel Galileo Board
Power supply: 3.3v or 5v
Analog output (Yellow wire)
GND (Black wire)
Power (Red wire)
DO: Digital output interface
Step 2: CODE
The code is written in C++ with Visual Studio that will deploy on Intel Galileo running on Windows.
Step 3: Here I Am Using a Gen1 Board But You Can Definitely Use Any.
Depending on the code, the sensor data is received by the A0 pin. However any analog I/O pin can do the task. My sensor was showing values above 300 when the soil is moist and above 500 when it is completely dry but when I place it in water the values drops to 100. Here I have attached an LED to alert us when the soil becomes dry or you can do something else with your Advanced Gardening System to alert you that the plant needs water. Also I have noticed that different sensors give different values. So perhaps the values for Dry, Moist and Wet soil will be different from mine but you can always play with the values and tabulate them. After a few samples you can finally determine the values for each condition of moisture with your sensor.
The following shows the values when the sensor is placed in water:
Step 4: DRY AIR
The following shows the values when the sensor is in air (dry)