Soil Fertility Monitoring System

Introduction

This experiment demonstrates how to monitor the fertility of soil using sensors for pH, moisture, and temperature.

Soil Fertility Sensor

Components Needed

Circuit Setup

  1. Connect the soil sensors to the Arduino to measure soil fertility parameters.
Soil Monitoring Circuit Setup

Code for Soil Fertility Monitoring

Upload the following code to your Arduino to monitor soil conditions:


#include 

#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

int pHValue;
int moistureValue;

void setup() {
  Serial.begin(9600);
  dht.begin();
}

void loop() {
  pHValue = analogRead(A0);  // Soil pH sensor
  moistureValue = analogRead(A1);  // Soil moisture sensor

  float temp = dht.readTemperature();
  float humidity = dht.readHumidity();

  Serial.print("pH Level: ");
  Serial.println(pHValue);
  Serial.print("Soil Moisture: ");
  Serial.println(moistureValue);
  Serial.print("Temperature: ");
  Serial.println(temp);
  Serial.print("Humidity: ");
  Serial.println(humidity);

  delay(2000);
}
            

Explanation

The system reads the soil pH, moisture, and temperature to assess soil fertility. Data is sent to the Serial Monitor for analysis.

Troubleshooting