sensor-experiments

Introduction

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

Components Needed

No Ads Available.

Circuit Setup

  1. 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

Contact Us

If you have any questions or inquiries, feel free to reach out to us at Microautomation.no@icloud.com .

Follow our Socials for the newest updates!