fbpx
Arduino Lesson 17: Soil Moisture Sensor
Arduino Lesson 17

Soil Moisture Sensor

Measure soil moisture

Components Required

Magicbit
Buy

Introduction

Soil moisture sensors typically refer to sensors that estimate volumetric water content. Another class of sensors measures another property of moisture in soils called water potential; these sensors are usually referred to as soil water potential sensors and include tensiometers and gypsum blocks.

Learning outcomes:

  • Using Soil moisture sensors and implement its applications
  • Working principle of soil moisture sensor

Theory

Soil Moisture Sensor. Soil moisture is basically the content of water present in the soil. This can be measured using a soil-moisture sensor, which consists of two conducting probes that act as a probe. It can measure the moisture content in the soil based on the change in resistance between the two conducting plates.

Methodology

Connect the soil-moisture sensor to the Magicbit. As usually in here also, we connect the sensor module to the upper left (D32) connector on the Magicbit. After connecting the sensor module, put it into a wet soil mixture forget results. Then connect the Magicbit to your pc and upload the code below.

Code

 

int SENSOR = 32;
int output_value ;

void setup() {
   pinMode(32,INPUT);
   Serial.begin(9600);
   Serial.println("Reading From the Sensor ...");
   delay(2000);

}

void loop() {

   output_value= analogRead(SENSOR);
   output_value = map(output_value,550,0,0,100);
   Serial.print("Mositure : ");
   Serial.print(output_value);
   Serial.println("%");
   delay(1000);
}

Explanation

‘Output_value = map(output_value, 550,0, 0,100)’ — output_value is a user-defined variable. To display a moisture percentage we should map the analog output value of the sensor given according to the sample (the wet soil mixture). From the serial monitor, we can get our outputs.

Related Posts
Leave a Reply