The Automatic Crop Shelter project is designed to protect crops from adverse weather conditions, particularly rain. It operates automatically, using an Arduino UNO as the control unit, a raindrop sensor to detect rainfall, and BO motors controlled by an L298N motor driver. When the raindrop sensor detects rain, it sends a signal to the Arduino, which then activates the BO motors. These motors drive a pulley system to extend a protective cover over the crops, shielding them from rain or harsh weather. Once the rain stops, the sensor signals the Arduino to retract the shelter, allowing normal exposure to sunlight. The system is powered by a battery, making it efficient and usable in remote farming areas without a direct power source. The automated nature of the project reduces the need for manual intervention, ensuring timely protection and saving crops from damage. Components List: 1. Arduino UNO – The main control board. 2. Raindrop Sensor – Detects rain. 3. BO Motors – Drives the pulley system to move the shelter. 4. L298N Motor Driver – Controls motor operation. 5. Pulley System – Mechanism to move the shelter. 6. Battery – Power supply for the system. 7. Jumper Wires – For connections. Applications: – Ideal for farmers to protect crops from rain damage. – Can be used in nurseries or greenhouses to safeguard delicate plants. – Suitable for outdoor gardens requiring automatic protection. |
#include <Servo.h>
Servo servo;
int trigPin = 5;
int echoPin = 6;
int servoPin = 9;
long duration, dist;
void setup() {
Serial.begin(9600);
servo.attach(servoPin);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
servo.write(0); //close cap on power on
}
void measure() {
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(15);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
dist = (duration / 2) / 29.1; //obtain distance
}
void loop() {
measure();
if (dist < 20) {
servo.write(90);} // rotate servo motor to 90 degree
else{
servo.write(0);
}
Serial.println(dist);
}