The Cropsavvy project introduces a smart solution for farming by controlling soil moisture levels efficiently. It employs a soil moisture sensor to constantly check the soil’s moisture content. If the moisture level goes beyond a set limit, a servo motor is triggered to open a drain lid. This action prevents excessive watering, maintaining the ideal soil conditions necessary for healthy crop growth. This innovative approach not only conserves water but also promotes sustainable farming practices, making it an educational and eco-friendly project for students interested in agriculture and technology.
Components:
- Soil Moisture Sensor: Detects the moisture content in the soil.
- Servo Motor: Opens the drain lid when soil moisture is too high.
- Arduino Uno: Central microcontroller for data processing and control.
- Drain Lid: Mechanism controlled by the servo motor to manage excess water.
- Power Supply: Provides power to the Arduino and connected components.
Setup and Installation:
- Connect the soil moisture sensor to the Arduino’s analog pin A3.
- Connect the servo motor to the Arduino’s digital pin 2.
- Ensure the drain lid mechanism is securely attached to the servo motor.
- Power the Arduino via a USB cable or external power source.
Operation/Circuit:
- The soil moisture sensor continuously monitors the soil’s moisture content.
- The Arduino processes the sensor data and compares it to the predefined threshold.
- If the soil moisture level exceeds the threshold, the Arduino activates the servo motor to open the drain lid.
- Once the excess water is drained, the servo motor closes the lid to maintain optimal soil conditions.
CODE
#include <Servo.h>
const int soilMoisturePin = A3; // Analog pin for soil moisture sensor
const int threshold = 500; // Threshold value for soil moisture
const int servoPin = 2; // Digital pin for servo motor
Servo myServo;
void setup() {
Serial.begin(9600);
myServo.attach(servoPin);
myServo.write(0); // Initially, keep the drain lid closed
}
void loop() {
int soilMoistureValue = analogRead(soilMoisturePin);
Serial.print("Soil Moisture Value: ");
Serial.println(soilMoistureValue);
if (soilMoistureValue > threshold) {
Serial.println("Soil moisture is high, opening drain lid.");
myServo.write(90); // Open the drain lid
} else {
Serial.println("Soil moisture is within acceptable range, closing drain lid.");
myServo.write(0); // Close the drain lid
}
delay(2000); // Wait for 2 seconds before the next reading
}
Testing and Calibration:
- Conduct thorough testing to ensure the system accurately detects and responds to soil moisture levels.
- Calibrate the soil moisture sensor for precise measurements.
- Test the servo motor and drain lid mechanism to confirm they operate smoothly and effectively.
Benefits:
- Provides real-time monitoring of soil moisture levels.
- Prevents overwatering and waterlogging in agricultural fields.
- Enhances crop growth by maintaining optimal soil conditions.
- Automates water management, reducing the need for manual intervention.
- Supports sustainable farming practices by efficiently managing water resources.