Arduino Lesson 17: Soil Moisture Sensor
Arduino Lesson 17

Soil Moisture Sensor

Measure soil moisture

Components Required



Soil moisture sensors typically refer to sensors that estimate volumetric water content. Another class of sensors measure 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 sensor and implement its applications
  • Working principal of soil moisture sensor


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.


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



int SENSOR = 32;
int output_value ;

void setup() {
   Serial.println("Reading From the Sensor ...");


void loop() {

   output_value= analogRead(SENSOR);
   output_value = map(output_value,550,0,0,100);
   Serial.print("Mositure : ");


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

Related Posts
Leave a Reply

Your email address will not be published.Required fields are marked *