Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based Soil Moisture Monitoring System

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Soil Moisture Monitoring System

Soil Moisture Sensing Circuit Documentation

Summary

This document describes a simple soil moisture sensing circuit that utilizes an Arduino UNO microcontroller and a Capacitive Soil Moisture Sensor V1.2. The purpose of this circuit is to measure the moisture level of the soil, which can be useful for gardening or agricultural applications. The sensor outputs an analog signal that is read by the Arduino, which then processes the signal and outputs the moisture level to the serial monitor.

Component List

Arduino UNO

Capacitive Soil Moisture Sensor V1.2

Wiring Details

Arduino UNO

Capacitive Soil Moisture Sensor V1.2

Documented Code

Arduino UNO Code (sketch.ino)

#include <CapacitiveSensor.h>

const int AirValue = 520;   //you need to replace this value with Value_1
const int WaterValue = 260;  //you need to replace this value with Value_2
int intervals = (AirValue - WaterValue)/3;
int soilMoistureValue = 0;

void setup() {
  Serial.begin(9600); // open serial port, set the baud rate to 9600 bps
}

void loop() {
  soilMoistureValue = analogRead(A0);  //put Sensor insert into soil
  if(soilMoistureValue > WaterValue && soilMoistureValue < (WaterValue + intervals)) {
    Serial.println("Very Wet");
    Serial.println(soilMoistureValue);
  }
  else if(soilMoistureValue > (WaterValue + intervals) && soilMoistureValue < (AirValue - intervals)) {
    Serial.println("Wet");
    Serial.println(soilMoistureValue);
  }
  else if(soilMoistureValue < AirValue && soilMoistureValue > (AirValue - intervals)) {
    Serial.println("Dry");
    Serial.println(soilMoistureValue);
  }
  delay(100);
}

Additional Notes