Practical 13 (1)
Practical 13 (1)
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:
Step-by-Step Instructions:
Drag and drop the following components into the simulation workspace:
o Arduino Uno
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.
cpp
CopyEdit
void setup() {
void loop() {
// Read the soil moisture value (the lower the value, the drier the soil)
moistureValue = analogRead(MOISTURE_SENSOR_PIN);
Serial.println(moistureValue);
// Check if the soil is too dry and activate the irrigation system
} else {
digitalWrite(RELAY_PIN, LOW); // Deactivate the relay (turn off the water pump)
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.
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).
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.