Docsity

Automatic irrigation system, Assignments of Control Systems

Toggle sidebar
bg1
Automatic Irrigation System Using Soil Moisture and Ultrasonic Sensor
Objective
To design and implement an automated irrigation system that waters plants when the soil is dry and monitors
water tank level using an ultrasonic sensor.
Components Used
1. Arduino Uno - Microcontroller
2. Soil Moisture Sensor - Detect soil wetness
3. Ultrasonic Sensor (HC-SR04) - Measure water tank level
4. Relay Module - Control water pump
5. Water Pump - Irrigation
6. Jumper Wires, Breadboard, Power Supply
Microcontroller
Arduino Uno (ATmega328P) is used because it is easy to program, has analog and digital pins, and is perfect
for sensor-based projects.
Sensor Working Principles
Soil Moisture Sensor: Measures voltage across soil. Wet soil conducts more, giving high analog value. Dry
soil has high resistance, low value.
Ultrasonic Sensor: Sends ultrasonic pulse. Measures time to receive echo. Distance = (time × 0.0343) / 2.
Code (Explanation Below)
int soilPin = A0;
int pumpRelay = 7;
int trigPin = 9;
int echoPin = 8;
int dryThreshold = 500;
int waterLevelLimit = 10;
pf3

Partial preview of the text

Download Automatic irrigation system and more Assignments Control Systems in PDF only on Docsity!

Objective

To design and implement an automated irrigation system that waters plants when the soil is dry and monitors water tank level using an ultrasonic sensor.

Components Used

  1. Arduino Uno - Microcontroller
  2. Soil Moisture Sensor - Detect soil wetness
  3. Ultrasonic Sensor (HC-SR04) - Measure water tank level
  4. Relay Module - Control water pump
  5. Water Pump - Irrigation
  6. Jumper Wires, Breadboard, Power Supply

Microcontroller

Arduino Uno (ATmega328P) is used because it is easy to program, has analog and digital pins, and is perfect for sensor-based projects.

Sensor Working Principles

Soil Moisture Sensor: Measures voltage across soil. Wet soil conducts more, giving high analog value. Dry soil has high resistance, low value.

Ultrasonic Sensor: Sends ultrasonic pulse. Measures time to receive echo. Distance = (time × 0.0343) / 2.

Code (Explanation Below)

int soilPin = A0; int pumpRelay = 7; int trigPin = 9; int echoPin = 8; int dryThreshold = 500; int waterLevelLimit = 10;

void setup() { Serial.begin(9600); pinMode(pumpRelay, OUTPUT); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); digitalWrite(pumpRelay, LOW); }

void loop() { int soilValue = analogRead(soilPin); long duration; int distance;

digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH); distance = duration * 0.034 / 2;

if (soilValue > dryThreshold && distance > waterLevelLimit) { digitalWrite(pumpRelay, HIGH); } else { digitalWrite(pumpRelay, LOW); } delay(2000); }

Explanation

The soil sensor reads analog value to detect dryness. The ultrasonic sensor checks if tank has enough water.