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

Components Needed
- Soil pH Sensor
- Soil Moisture Sensor
- Temperature Sensor
- Arduino
- Jumper Wires
Circuit Setup
- Connect the soil sensors to the Arduino to measure soil fertility parameters.

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
- If the readings are incorrect, check the wiring of the sensors and calibrate them properly.
- If the sensor values do not change, verify the sensors are properly embedded in the soil.