Soil Nutrient Detection

Objective

This experiment demonstrates the use of sensors to detect nutrient levels in soil.

Components Required

Working Principle

The soil nutrient sensor detects the levels of nutrients like nitrogen, phosphorus, and potassium in the soil by measuring electrical conductivity.

Circuit Diagram

Soil Nutrient Circuit Diagram

Code

/*
 * Soil Nutrient Detection
 * This code reads soil nutrient levels from the soil sensor.
 */

const int sensorPin = A0;  // Soil sensor connected to analog pin A0
int sensorValue = 0;

void setup() {
  Serial.begin(9600);  // Initialize serial communication
}

void loop() {
  sensorValue = analogRead(sensorPin);  // Read the sensor value
  Serial.print("Soil Nutrient Level: ");
  Serial.println(sensorValue);
  delay(1000);  // Wait for 1 second before the next reading
}
            

Results

The serial monitor will display the nutrient level readings.

Applications