in , ,

Moisture Sensor Using Arduino

In this post, I will show you how you can use a moisture sensor with arduino to measure the moisture/water content of a place. This can be used to sense rainfall in smart weather sensors, water content of the soil for smart irrigation projects etc. Arduino can be easily programmed to work with this moisture sensor, can be easily programmed and put it in action in no time.

Components Needed

  • Arduino Uno
  • Moisture Sensor
  • Breadboard for connections
  • Connecting wires

Image result for utsource logo

Sponsor Link

This Project is Sponsored by UTSource. UTSource is a professional electronic components supplier.

About Moisture Sensor

The moisture sensor we are using here is a simple one which is compatible with arduino.

Arduino moisture sensor

A typical Soil Moisture Sensor consist of two components. A two-legged Lead, that goes into the
soil or anywhere else where water content has to be measured. This has two header pins which
connect to an Amplifier/ A-D circuit which is in turn connected to the Arduino.

The Amplifier has a Vin, Gnd, Analog and Digital Data Out Pins. This means that you can get the
values in both Analog and Digital forms.

How Does the Moisture Sensor Work

Most soil moisture sensors are designed to estimate soil volumetric water content based on the dielectric constant (soil bulk permittivity) of the soil. The dielectric constant can be thought of as the soil’s ability to transmit electricity. The dielectric constant of soil increases as the water content of  the soil increases. This response is due to the fact that the dielectric constant of water is much   larger than the other soil components, including air. Thus, measurement of the dielectric constant  gives a predictable estimation of water content.


β€’ Connect the two pins from the Sensor Probes to the two pins on the Amplifier circuit via hook up

β€’ Connect the Vcc from the Amplifier to the 3.3V pin on the Arduino and the Gnd pin to the Gnd pin on the Arduino.

β€’ Now connect the Analog Data Pin to the A0 pin on the Arduino (Since I’m interested in Analog Data).

Refer the Pictures and build the circuit.

Arduino moisture sensor
Arduino moisture sensor

The Code

For simply reading the values I’ll be using the AnalogRead sketch. You can modify the code as per your requirements.

void setup() {
Serial.begin(9600); // initialize serial communication at 9600 bits per second:
// the loop routine runs over and over again forever:

void loop() {

int sensorValue = analogRead(A0);// read the input on analog pin 0:

Serial.println(sensorValue);// print out the value you read:
delay(1); // delay in between reads for stability

After verifying the code, upload it to the board and open the serial monitor. You will see  the sensor data on the monitor being changed when you dip the sensor leads in water and when  dry.

Project By: Abubakar Yahaya Ibrahim

WhatsApp: +2348034736624

Rate the Project

Did you find this useful? Help us to improve by rating this page.

Moisture Sensor Using Arduino
4.4 rating based on 12,345 ratings
Overall rating: 4.4 out of 5 based on 253 reviews.

One Comment

Leave a Reply

Leave a Reply

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

usb to ttl serial converter

Program Arduino via USB to Serial RS232 Converter with and without DTR Pin

Arduino Simulator

Arduino IO Simulator Drag, Drop and Draw