IOT Soil Moisture

by Laukik Ragji in Living > Gardening

3996 Views, 22 Favorites, 0 Comments

IOT Soil Moisture

Freeboard.PNG

Soil Moisture is the amount of moisture in the soil or to simply put the amount of wetness or dampness in the soil.

This is an important parameter when you want garden automation as this parameter lets your system know how dry is the soil and does the plant need watering.

Wikipedia link: https://en.wikipedia.org/wiki/Soil_moisture_sensor

As described in the link soil moisture can be quantified by 3 methods:

  • Resistive Method:
  • Galvanic Cell(aka Battery Method)
  • FDR (aka Capacitive method)
  • TDR(aka Charge & Discharge of dielectric)

We will be focusing on Resistive Method as its the best and easy method with reliable and repeatable results...

Since we are going to make this a little more fun we will be posting the results on Internet so that we can keep track of our soil moisture 24 *7 IOT-ed the project :)

You can look at my dashboard at https://freeboard.io/board/uqKnOe

*Soil Moisture is a function of Soil temperature as well this Instructable doesn't include soil temperature

List of Materials:

ESP8266.JPG
Screw.jpg
PowerBankjpeg.jpeg

Again this is not a expensive circuit the total cost was approx 7$ to 9$ excluding power bank cost

  • 1pc -ESP8266 12F module This had a better ADC reliability as shown in the picture below from Ebay
  • 2pcs -Screw 60mm long M3 size again from EBay
  • 1pcs -1K resistor 1/4watt
  • 2pcs -Connecting wires

Assembly

IMG_1991.JPG
IMG_1989.JPG
Circuit.PNG

The concept here is to push the screw into the soil at a distance which is lesser than length of the screw, mine were 20 to 30 mm apart and then we can simply measure the resistance between them. when my measurements were taken they varied from 16K to 26 K dry and wet conditions thus giving us a relative approximation of moisture in the soil.

To simply measure resistance i used ESP8266 to read a simple voltage divider circuit from ADC pin Caution it can only handle maximum 1V

This was fairly easy for me as my module already had a LDR connected to the ADC pin all i had to do was simply de-solder the LDR and solder the soil moisture posts.this is shown in the given circuit. from the voltage divider circuit we can easily see that the voltage never exceeds 1v with the given divider. Thus making it easy to read resistance between the probes.

Just power the ESP using the power bank and now its portable ;)

Note: We are not compensating soil temperature in this Instructable

Code:

void setup() {
// put your setup code here, to run once:

pinMode(A0, INPUT);
Serial.begin(115200)

}

void loop() { // put your main code here, to run repeatedly:

Serial.println(analogRead(A0));

delay(1000);

}

This should give you ADC counts which shall map to Soil Moisture content(My research says:Small number is dry soil and Bigger number means wet soil)

Spicing Up With IOT :)

Since now we are able to read the moisture content of the soil and display it on the computer through serial port this doesn't help my IOT Garden water pump to know when to water the plants and when to stop for this part we need to publish this information somewhere so that the pump can read from it.

This is where Dweet.io comes into picture the concept is simple the pump reads data from this Soil Moisture Thing and takes decision when to start stop.

But doing so means posting data on internet which means its too much power hungry for this device to run on battery for the same we sleep the device for 1 min and take reading and post on internet.

Following code helps ESP to do the same. we will also be using Freeboard.io to publish visual results.

You can look at my board here:https://freeboard.io/board/uqKnO