Introduction: INTERFACING SOIL MOISTURE SENSOR USING BHARAT PI

In this instructable, we are going to interface a Capactive Soil moisture sensor v2.0 with Bharat-PI. This sensor measures the volumetric content of water inside the soil and gives us the moisture level as output. The sensor is equipped with digital output, so it can be used in digital mode. In this article, we are going to interface the sensor in digital modes. So let’s begin our tutorial on interfacing Bharat-pi and Soil moisture sensor.

Step 1: Working of Soil Sensor

The soil moisture sensor consists of two probes which are used to measure the volumetric content of water. The two probes allow the current to pass through the soil and then it gets the resistance value to measure the moisture value. When there is more water, the soil will conduct more electricity which means that there will be less resistance. Therefore, the moisture level will be higher. Dry soil conducts electricity poorly, so when there will be less water, then the soil will conduct less electricity which means that there will be more resistance. Therefore, the moisture level will be lower. This sensor can be connected in digital mode. 

The specifications of the soil moisture sensor v2.0 are as follows

  1. Operating Voltage: 3.3 ~ 5.5 VDC.
  2. Operating Current: 5mA.
  3. Interface: PH2.54-3P.
  4. Dimensions mm(LxWxH): 98 x 23 x 4.
  5. Supports 3-Pin Gravity Sensor interface
  6. Analog output.
  7. Weight (gm): 15.


Step 2: Soil Moisture Capacitive Pinout

  1. Gnd : Power GND(0V)
  2. Vcc :Power VCC(3.3~5,5V)
  3. A OUT:Analog Siganl Output(0~2.3V)

Step 3: Requirements

1.Bharat pi

2.Jumper wires for connection

3.Soil for testing

4.Soil Moisture Sensor`

5.Arduino IDE

Step 4: Interfacing With Bharat Pi

Connections:

  1. Vcc pin : 5v
  2. gnd pin : ground
  3. A out pin to : pin 4

Step 5: UPLOAD CODE FOR AURDINO - IDE

const int sensor_pin = 4; /* Soil moisture sensor O/P pin */

void setup() {

 Serial.begin(9600); /* Define baud rate for serial communication */

}

void loop() {

 float moisture_percentage;

 int sensor_analog;

 sensor_analog = analogRead(sensor_pin);

 moisture_percentage = ( 100 + ( (sensor_analog/1023.00) * 10 ) );

 Serial.print("Moisture Percentage = ");

 Serial.print(moisture_percentage);

 Serial.print("%\n\n");

delay(1000);

}

Code avilable at git hub:https://github.com/Madhankarthick/interfacing-soil-sensor-wit-bharat-pi/blob/07944eed6fa17038532f2122e3af5816b98d81bf/soil%20sens.txt

Step 6: CHECK THE OUTPUT AT SERIAL MONITOR

Step 7: Apllications

  1. Agriculture: to optimize irrigation, increase crop yields, save water, energy, and fertilizer costs, and protect water resources from runoff.
  2. Landscape irrigation: to maintain healthy plants and lawns, and conserve water.
  3. Research: to study soil properties, climate change, environmental science, biofuel, and drought forecasting.
  4. Simple sensors for gardeners: to monitor the soil moisture of plants and flowers, and water them accordingly.
  5. Archeology: to detect buried artifacts and structures based on soil moisture variations.


Step 8: Video