Recently I was playing with a moisture sensor for one of my projects so I thought to share it with you. I got that 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 deficits, 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. More water makes the soil conduct electricity more easily (less resistance), while dry soil conducts electricity poorly (more resistance. You can know whether a plant needs water or not by observing the results that the sensor outputs. Now by the end of this blog you will be able to make your own moisture sensor that can track the water need of plants of you garden.
This is how a soil moisture sensor looks
Moisture sensor module (Arduino Compatible)
Intel Galileo Board
• Power supply: 3.3v or 5v
• Pin definition:
o Analog output(Yellow wire)
o GND(Black wire)
o Power(Red wire)
o DO: Digital output interface
The code is written in C++ with Visual Studio which is going to deploy on Intel Galileo running on windows.
Here I am using Gen1 board but you can definitely use any.
According to the code sensor data is received by 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 gets dry or you can do something else with your Advanced Gardening System to alert you that Plant needs water. Also I have noticed that different sensors give you different values. So might be your values of Dry, Moist and Wet soil will be different than mine but you can always play with the values and tabulate them. After few samples you can finally conclude the values for each different condition of moisture with your sensor.
Values when sensor is placed in water-
Values when sensor is in air(dry) -