0% found this document useful (0 votes)
3 views

Practical 13 (1)

Students will design and simulate an automated irrigation system using a soil moisture sensor to detect soil dryness and activate a water pump. The exercise involves setting up the simulation environment, designing the system with components like Arduino and relays, programming the Arduino, and testing the system's functionality. It emphasizes real-time control, threshold calibration, and potential extensions for improved water conservation in agricultural practices.

Uploaded by

clinton
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Practical 13 (1)

Students will design and simulate an automated irrigation system using a soil moisture sensor to detect soil dryness and activate a water pump. The exercise involves setting up the simulation environment, designing the system with components like Arduino and relays, programming the Arduino, and testing the system's functionality. It emphasizes real-time control, threshold calibration, and potential extensions for improved water conservation in agricultural practices.

Uploaded by

clinton
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Simulating an Automated Irrigation System

Objective:
Students will design and simulate an automated irrigation system that uses a soil moisture sensor to
detect the moisture level of the soil. When the soil becomes dry, the system will activate a water pump
(simulated with an LED or relay) to water the plants. This exercise introduces students to environmental
sensors and automation in agricultural applications.

Requirements:

 Laptop with internet access

 Free account on Tinkercad or Wokwi

 Basic knowledge of Arduino programming

 Basic understanding of soil moisture sensors and relays

Step-by-Step Instructions:

1. Setup the Simulation Environment (5 minutes):

 Log in to Tinkercad or Wokwi.

 Create a new Arduino project.

2. Design the Automated Irrigation System (10 minutes):

 Drag and drop the following components into the simulation workspace:

o Arduino Uno

o Soil Moisture Sensor

o Relay (to simulate the water pump)

o LED (to simulate the water pump turning on)

o Resistor (for the LED)

o Breadboard (optional, depending on the simulator)

 Wire the components:

o Connect the Soil Moisture Sensor to an analog input pin (e.g., pin A0) and the other side
to ground (with a pull-down resistor as needed).

o Connect the Relay to a digital output pin (e.g., pin 9) to simulate controlling the water
pump.

o Connect the LED to another digital pin (e.g., pin 10) to simulate the pump turning on,
with a resistor (220Ω) to limit current.

3. Program the Arduino (20 minutes):


 Open the code editor in the simulator and use the following code for the automated irrigation
system:

cpp

CopyEdit

#define MOISTURE_SENSOR_PIN A0 // Pin connected to the soil moisture sensor

#define RELAY_PIN 9 // Pin connected to the relay (water pump)

#define LED_PIN 10 // Pin connected to the LED (simulating water pump)

int moistureValue = 0; // Variable to store soil moisture sensor value

int threshold = 600; // Moisture threshold for triggering irrigation (adjustable)

void setup() {

pinMode(RELAY_PIN, OUTPUT); // Set the relay pin as output

pinMode(LED_PIN, OUTPUT); // Set the LED pin as output

Serial.begin(9600); // Start serial communication for debugging

void loop() {

// Read the soil moisture value (the lower the value, the drier the soil)

moistureValue = analogRead(MOISTURE_SENSOR_PIN);

// Print the moisture value to the serial monitor for debugging

Serial.print("Soil Moisture: ");

Serial.println(moistureValue);

// Check if the soil is too dry and activate the irrigation system

if (moistureValue < threshold) {

digitalWrite(RELAY_PIN, HIGH); // Activate the relay (turn on the water pump)

digitalWrite(LED_PIN, HIGH); // Turn on the LED (simulating pump operation)


Serial.println("Soil is dry! Irrigation ON.");

} else {

digitalWrite(RELAY_PIN, LOW); // Deactivate the relay (turn off the water pump)

digitalWrite(LED_PIN, LOW); // Turn off the LED

Serial.println("Soil is wet. Irrigation OFF.");

delay(2000); // Delay for 2 seconds before checking again

Explanation of the Code:

 The Soil Moisture Sensor provides a value representing the soil's moisture level. The value
decreases as the soil becomes drier.

 The code compares the moisture value with a predefined threshold (e.g., 600). If the soil is dry
(moisture value is below the threshold), the relay is activated (simulating the water pump
turning on), and an LED is lit up to show the system is working.

 The Serial Monitor prints the current soil moisture value and the system's state (irrigation on or
off) for debugging.

4. Run and Test (15 minutes):

 Start the simulation.

 Observe the soil moisture readings being printed to the serial monitor.

 Simulate dry soil by adjusting the moisture sensor reading (below the threshold).

 Verify that the relay (simulating the water pump) is activated, and the LED (simulating the pump)
turns on when the soil is dry.

 Observe the system deactivating the pump when the soil is wet (moisture value exceeds the
threshold).

5. Discussion and Reflection (10 minutes):

 Real-Time Control:
Discuss how the system uses the real-time sensor reading to automate the irrigation process.
Reflect on how this is similar to real-world irrigation systems that monitor soil conditions and
water crops only when necessary.

 Threshold Calibration:
Discuss how the threshold value might need to be calibrated based on the specific type of soil
and plant. For example, sandy soil may dry out faster than clay soil and may require a different
threshold value for the moisture sensor.

 Water Conservation:
Reflect on the environmental benefits of automated irrigation systems. These systems can help
conserve water by only watering the plants when the soil is dry, thus preventing over-watering
and reducing water waste.

 Extensions:
Suggest possible extensions to the system:

o Use a real-time clock (RTC) to schedule irrigation times, turning on the pump at specific
times during the day or night.

o Integrate a solar panel to simulate solar-powered irrigation, turning the system on only
when there's sufficient sunlight.

o Implement a water level sensor in the tank or reservoir to ensure the system doesn't
run dry and cause damage.

o Add a smartphone interface or IoT integration, allowing users to monitor and control
the irrigation system remotely.

This exercise provides students with practical experience in creating an automated environmental
control system. It is highly applicable to agricultural systems where water conservation and efficient
irrigation are key concerns. The principles learned can be extended to smart farming systems and IoT-
enabled agricultural solutions.

You might also like