Automated Watering Plant Using Arduino

by | Dec 31, 2022 | Arduino, Coding

Introduction

An automated watering system for plants using an Arduino microcontroller is a project that involves creating a device that can sense when a plant needs water and automatically provide the necessary amount. This can be useful for people who cannot water their plants regularly or for plants that are sensitive to over- or under-watering. So let us start working on this Automated Watering Plant Using Arduino.

In this Arduino project, using a sensor, water will be automatically supplied to the plants by checking the humidity and temperature of the soil using a motor and sensor.

 

Supplies

To make an Automated Watering Plant Using Arduino, we will require the following components:

Components

Circuit Diagram

Steps To Make Automated Watering Plant Using Arduino

Step 1: We need to assemble all the required components.

Step 2: Then we will plug the Potentiometer, Sensor & Transistor into the Breadboard.

Potentiometer:

Step 3: Connect the 1st terminal of the Potentiometer to the Ground pin of the Arduino using a black-colored wire through a resistor.

Step 4: Connect the wiper terminal of the Potentiometer to the contrast pin of the LCD.

Step 5: Connect the third terminal of the Potentiometer to the 5V power supply pin of the Arduino Uno.

Transistor:

Step 6: Connect the Collector terminal of it to the 5V pin of the Arduino.

Step 7: Connect the Base Terminal of the transistor to the 13-number pin of the Arduino through a resistor, as shown in the figure.

Step 8: Connect the transistor’s Emitter terminal to the DC Motor’s second terminal, as shown in the figure.

DC Motor:

Step 9: Connect the first terminal of it to the GND pin of the Arduino.

LEDs:

Step 10: Connect the negative terminal of the LED to the GND pin of the Arduino thru a resistor.

Step 11: Connect the positive terminal of the LED to the 11 & 12 pin numbers of the Ardunio, respectively.

Sensor:

Step 12: Connect the Vs terminal of the sensor to the 5V pin of the Arduino.

Step 13: Connect the Vout Terminal of the sensor to the A0 number pin of the Arduino.

Step 14: Connect the sensor’s GND terminal to the Arduino’s GND pin.

LCD:

Step 15: Connect the Ground terminal of it to the GND pin of the Arduino.

Step 16: Connect the Power terminal of it to the 5V pin of the Arduino.

Step 17: Connect the Register Select Terminal of it to the 2-number pin of the Arduino.

Step 18: Connect the Read/Write terminal of it to the GND pin of the Arduino.

Step 19: Connect the Enable Terminal of it to the 3-number pin of the Arduino.

Step 20: Connect the DB4, DB5, DB6, & DB7 Terminal of it to the 4, 5, 6, and 7 number pins of the Arduino, respectively.

Step 21: Connect the LCD Cathode terminal to the GND pin of the Arduino through a resistor.

Step 22: Connect the LCD Anode terminal to the 5V pin of the Arduino.

Source Code

#include <LiquidCrystal.h>
const int sensor = A0;
const int motor = 13;
const int ledRed = 12;
const int ledGreen = 11;
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print(" Automated");
lcd.setCursor(0,1);
lcd.print("Watering Plant!");
pinMode(motor, OUTPUT);
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
delay(1500);
lcd.clear();
lcd.print("Temp = ");
lcd.setCursor(0,1);
lcd.print("WaterPump = ");
}
void loop()
{
int value = analogRead(sensor);
float temperature = value * 500.0 / 1023.0;
lcd.setCursor(6,0);
lcd.print(temperature);
lcd.setCursor(11,1);
if(temperature > 40)
{
digitalWrite(motor, HIGH);
digitalWrite(ledRed, HIGH);
digitalWrite(ledGreen, LOW);
lcd.print("ON ");
}
else
{
digitalWrite(motor, LOW);
digitalWrite(ledRed, LOW);
digitalWrite(ledGreen, HIGH);
lcd.print("OFF");
}


delay(1000);
}

Explanation of the Code

1. We initially used a liquid crystal library for LCD operations.

2. Next, we initialized some variables wrt the pin numbers of the Arduino to which the components are connected.

3. In the setup function, we are beginning the serial connection with 9600 bits per second speed and printing some text in the LCD using the setcursor() function.

4. Then, we configured the pin mode for output purposes.

5. In the loop function, we read the sensor’s value and store it in a variable named value.

6. After it, we calculate and print the temperature in degrees centigrade.

7. Finally, we are using an if else statement, which will glow the respective LED and provide HIGH or LOW power to the motor as per the specified temperature.

Output

On giving power to the Arduino, the sensor will check the temperature, and accordingly, it will turn on or off the motor, which will automatically supply the water.

Automated Watering Plant Using Arduino

We hope this helps get you started on your automated watering system project! If you have any questions or need further assistance, don’t hesitate to ask.

 

 

You May Also Like To Create…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *