0% found this document useful (0 votes)
16 views7 pages

Activity9 - Automated Plant Watering System

The document outlines the development of an Automated Plant Watering System using Arduino, soil moisture sensors, and an LCD display for real-time monitoring. It includes a detailed list of materials, code snippets, and a procedure for connecting components and programming the Arduino. The project aims to automate plant watering based on soil moisture levels, providing alerts through LEDs and a buzzer.

Uploaded by

ltorres6129ant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

Activity9 - Automated Plant Watering System

The document outlines the development of an Automated Plant Watering System using Arduino, soil moisture sensors, and an LCD display for real-time monitoring. It includes a detailed list of materials, code snippets, and a procedure for connecting components and programming the Arduino. The project aims to automate plant watering based on soil moisture levels, providing alerts through LEDs and a buzzer.

Uploaded by

ltorres6129ant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Arduino Activity Submission Template 4.

Circuit Diagram:
1. Activity Title:
Activity 9: Automated Plant Watering System

2. Objective:
Develop an automated plant watering system using soil moisture sensors to
determine when to water the plants. The system will provide real-time status
updates using an LCD display and LED indicators without any data logging or
internet connectivity.

3. Materials Used:
• Arduino Uno

• Soil Moisture Sensors (Analog type)

• Water Pump or Solenoid Valve

• Relay Module (to control the water pump)

• 16x2 LCD Display (I2C or Parallel)

• LED (for low moisture warning)

• Buzzer

• Breadboard and Jumper Wires


5. Code: void setup()

/* Application Purpose: Automated Plant Watering System * {

* Author: Demilson Moreira Bose Junior, Leonardo Pereira Barros de Camargo, pinMode(WaterPump, OUTPUT); // Set the water pump pin as output
Pedro Didoné de Vasconcelos *
pinMode(LedRed, OUTPUT); // Set the red LED pin as output
* 23S Internet of Things - Arduino - 207 COMP1045-23S-31962 *
pinMode(LedGreen, OUTPUT); // Set the green LED pin as output
* Date: 11/07/2023 *
pinMode(BuzzerPin, OUTPUT); // Set the piezo buzzer pin as output
* Time: 4:00 pm */

Serial.begin(9600); // Initialize serial communication at 9600 bps


#include <LiquidCrystal.h>

// Include the LiquidCrystal library, which provides functions to control the LCD
lcd.begin(16, 2); // Initialize the LCD with 16 columns and 2 rows
display.
pinMode(BuzzerPin, OUTPUT); // Set the piezo pin as output

// Declaring variables
lcd.clear(); // Clear the LCD display
const int BuzzerPin = 10; // Pin connected to the piezo buzzer
lcd.setCursor(0, 0); // Set the cursor to the first column and first row
const int LedRed = 12; // Pin connected to the red LED

const int LedGreen = 11; // Pin connected to the green LED


String message1 = "Automated Plant";
const int SoilMoistureSensor = A0; // Pin connected to the soil moisture sensor
String message2 = "Watering System";
const int WaterPump = 13; // Pin connected to the water pump relay

// Display "Automated Plant" on the first row of the LCD with a delay of 100ms
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); // Create an instance of the LiquidCrystal class
between characters
to control the LCD
for (int i = 0; i < message1.length(); i++) {
lcd.print(message1.charAt(i)); void loop()

delay(100); {

} int Sensor = analogRead(SoilMoistureSensor); // Read the value from the soil


moisture sensor

int mappedValue = map(Sensor, 0, 876, 0, 99); // Map the sensor value to a


lcd.setCursor(0, 1); // Set the cursor to the first column and second row range from 0 to 99

// Display "Watering System" on the second row of the LCD with a delay of lcd.setCursor(11, 0); // Set the cursor to the 12th column and first row
100ms between characters
lcd.print(mappedValue); // Display the mapped value (moisture
for (int i = 0; i < message2.length(); i++) { percentage) on the first row
lcd.print(message2.charAt(i)); lcd.setCursor(14, 0); // Set the cursor to the 15th column and first row
delay(100); lcd.print("%"); // Display the percentage symbol on the first row
} lcd.setCursor(13, 1); // Set the cursor to the 14th column and second
row

delay(2500); // Delay for 2.5 seconds to display the messages

lcd.clear(); // Clear the LCD display again // Control the water pump and LEDs based on the moisture percentage

lcd.setCursor(0, 0); // Set the cursor to the first column and first row if (mappedValue < 50) {

lcd.print("Moisture ="); // Display "Moisture =" on the first row digitalWrite(WaterPump, HIGH); // Turn on the water pump

lcd.setCursor(0, 1); // Set the cursor to the first column and second row digitalWrite(LedGreen, HIGH); // Turn on the green LED

lcd.print("Water Pump ="); // Display "Water Pump =" on the second row digitalWrite(LedRed, LOW); // Turn off the red LED

} lcd.print("ON "); // Display "ON" on the second row

playSound(); // Play a sound using the piezo buzzer


} LCD Display for Real-Time Monitoring:

else { Connect a 16x2 LCD display to show current moisture levels and system status.

digitalWrite(WaterPump, LOW); // Turn off the water pump If using an I2C LCD, connect:

digitalWrite(LedGreen, LOW); // Turn off the green LED SDA -> A4

digitalWrite(LedRed, HIGH); // Turn on the red LED SCL -> A5

lcd.print("OFF"); // Display "OFF" on the second row LED and Buzzer for Alerts:

} Connect an LED to a digital pin (e.g., D9) to indicate low moisture.

} Optionally, add a buzzer for audible alerts when moisture is low.

Programming the Arduino:

void playSound() { Read moisture levels from the sensors.

tone(BuzzerPin, 87, 100); // Play a tone of 87 Hz for 100 milliseconds on the Activate the water pump when moisture falls below a set threshold.
piezo buzzer
Display real-time data on the LCD.
delay(1000); // Delay for 1 second
} Trigger the LED (and buzzer) if the moisture is critically low.
6. Procedure: How It Works:
Connect the Soil Moisture Sensors:
Reading Moisture Levels:
Connect the analog output of each soil moisture sensor to the analog input pins
on the Arduino (e.g., A0, A1). The soil moisture sensor provides an analog value corresponding to the soil’s
moisture level.
If monitoring multiple plants or different soil areas, use multiple sensors.
This value is displayed on the LCD in real-time.
Interface the Water Pump or Solenoid Valve:
Water Pump Activation:
Connect the relay module’s input to a digital pin on the Arduino (e.g., D8).
When the soil moisture level falls below the set threshold, the relay module
The relay output will control the water pump. activates the water pump.

Make sure to use a flyback diode to protect the Arduino from voltage spikes. The pump automatically stops when the moisture level is above the threshold.
Visual and Audible Alerts:

An LED lights up to indicate low moisture levels.

A buzzer provides an audible alert when watering is triggered.

Real-Time Monitoring:

The LCD display shows both the moisture level and system status (e.g.,
“Watering…” or “Soil OK”).

7. Testing and Results:


8. Reflection:
Throughout this unit, I / we gained hands-on experience in interfacing sensors
and actuators with Arduino. Learning to read analog and digital signals helped
me understand how sensors collect data and how actuators respond to
commands. Using PWM for motor control was particularly interesting, as it
showed how precise control can be achieved. Calibrating sensors and
troubleshooting errors improved my problem-solving skills. Documenting
sensor principles also reinforced my understanding of how they function.
Overall, this unit enhanced my practical knowledge of embedded systems and
their real-world applications.

10. References:
https://www.tinkercad.com/things/6ju2isA9JHD/editel

You might also like