Learn how to install a smart plant watering system using Arduino Uno seamlessly. Our comprehensive guide ensures a hassle-free installation.

Smart Plant Watering System Using ARDUINO UNO

Plant Watering System Using Arduino Uno

As we all know, plants play an important role in our life, there are countless benefits we get from plants but the most important is fresh air and the pleasant atmosphere on the earth. Hence, It is not only our social duty as well as our responsibility that we should plant trees as much as we can and also take care of them. 

But the biggest challenge we face, is, taking care of them, sometimes due to the busy lifestyle and especially, when we go on vacation. Then we usually need to depend on someone else for taking care of our plants and I guess, it doesn’t work all the time. So to get rid of this problem, I came up with a “Smart Plant Watering System Using Arduino Uno”.

This system waters the plant only during the daytime whenever the soil is dry. In this system, I have used a soil moisture sensor to sense the moisture level of the soil, a light-dependent resistor to identify daylight, a water pump, and Arduino Uno. Usually, the ideal time to water the plants depends on the climate conditions and the regions where plants are available.

The best time to water the plant is early in the morning after sunrise. We should avoid watering the plants at night because at this time weather is usually moist and leaves will stay wet for a long time due to the lack of sunlight. Moist weather and wet leaves are perfect for the development of fungus which will destroy the growth of the plant very fast.

As a result, to avoid these harmful situations, I have used a light-dependent resistor to identify sunlight with the help of which this system waters the plant only in the daytime whenever the soil gets dry.

The main aim of this system is, as if the soil is dry then the soil moisture sensor senses a low moisture level in the soil, then according to the stored code in Arduino Uno, the water pump will get started automatically to provide water to the plant.

As the soil is wet the soil moisture sensor senses enough moisture level in the soil, and then the water pump will automatically stop. This process will happen again and again only in daylight. If the soil is dry at night then the water pump will not get started.

Required Components

Component Description

1. Arduino Uno

Arduino Uno is open source hardware and software, compatible board. Arduino Uno is a kind of small computer that has an eight-bit microcontroller, programmable hardware, USB programmable interface, input-output pins along with excellent processing capability to connect the computer to the physical world. 

Anyone can convert their idea to make anything smart by programming Arduino through the Arduino integrated development board (IDE). Arduino interacts through sensors with the environment and processes according to the program stored in it and performs output operations.

Arduino UNo

In this project, I used analog pin A0 as an input pin to read data from the Light-dependent resistor, pin 8 as an input pin to read data from the soil moisture sensor, and pin 13 as an output pin to operate the water pump. The program is written in such a manner that as light dependent resistor senses a value less than or equal to the threshold value then it means there is dark and whatever the value of the soil moisture sensor pump should be switched off.

If the soil is dry then the soil moisture sensor senses a high moisture level of soil and if the soil is wet then the soil moisture sensor senses a low moisture level of the soil. If the light-dependent resistor senses a value greater than the threshold value then the pump should be switched on only when the soil moisture sensor senses high moisture in the soil.

If the light-dependent resistor senses a value greater than the threshold value then the pump should be switched off only when the soil moisture sensor senses low moisture in the soil. As this project works very efficiently with the help of this concept.

2. Soil moisture sensorSoil moisture sensor

A soil moisture sensor is used to measure the water content of the material. Soil moisture sensor has two probes, which are responsible for the flow of current in the soil which as a result help to identify resistance value to measure the moisture level of the material.

If there is more water in the material then more electricity will be generated by the soil which means resistance is less, therefore moisture level in the material is high. If there is less water in the material then less electricity will be generated by the soil which indicates resistance is more, therefore moisture level in the soil is low. This sensor can able to perform its operation in digital and analog modes. In this project, I used this sensor in digital mode.

3. Light-dependent resistor

LDR

Light-dependent resistor (LDR) is also known as a photoresistor. LDR are light-sensitive devices that are used to identify the presence and absence of light intensity. LDR resistance value increases whenever it is exposed to less or low intensity of light (dark light).

Therefore, if it is exposed to dark light then its resistance value is high but when it identifies enough brightness in light then its resistance value decreases up to a few ohms. Light-dependent resistors are mostly used as light sensors. In this project the water pump works according to the LDR resistance value.

I used the threshold value 400, as the LDR value is less than or equal to the threshold value, which means it’s dark outside and the pump should be off. If the LDR value is greater than the threshold value means is not dark outside then the pump should work according to the soil moisture sensor value.

4. Relay module

Relay is preferred for controlling the switching activity of the devices.

 “Relay” is an electromechanically or electrically operated switch that is operated by a relatively small amount of electric current which can control the switching activity of the large electric current operating devices. Arduino Uno is not able to control high values of voltage and current.

In this project, I am using a 12-volt water pump and the working capacity of Arduino is less, so to make this pump compatible with Arduino Uno, I connected it through a relay module. A relay has three types of possible connections COM (common mode), NC (normally closed switch), and NO (normally open connection).

In this project, I have used a normally open connection. In NO mode relay acts as a switch. In which there is no connection between COM and No, whenever the relay is operated. It connects to the COM by electromagnet situated inside the relay and powers up the water pump. This connection closes only when the low state is triggered. In this NO mode HIGH state indicated in the code means “off state” and the LOW state indicated in the code means “on state”.

5. Water pump

Water pump

I used a 12-volt submersible pump for this project which has an 18-watt motor that can lift the water to 1.7 meters. This pump should be operated only when it is submerged completely in the water for better results, for that we need to keep water in the bucket because if the water pump will be operated without water then it will get damaged.

6. Resistor

IMG 20181026 113600 How To Build a Smart Plant Watering System Using Arduino Uno

I used a 10 k resistor with the Light-dependent resistor for better results.

7. Breadboard

Bread Board

The breadboard is a connection board used for the prototyping of electronics projects.

8. Jumper wires

Male-to-male jumper wiresJumper wires

Jumper wires are used to make connections between all the hardware components.

Connection diagram

Smart Plant Watering System Using ARDUINO UNO(circuit diagram)

Code

/*
*Smart Plant Watering System main module
*SmartPlantWateringSystemUsingArduinouno.ino    create on: 28/10/2018
*Copyright (C) 2007 Free Software Foundation, Inc. <[email protected]>
*
*For more detail please visit:https://www.arduinounomagic.com/2018/10/smart-plant-watering-system-using.html
*
*for more projects please visit://www.arduinounomagic.com
*/

#define WATERPUMP 13 //pump connected to pin 13
#define SENSOR  8 //soil sensor digital pin connected to pin 8
#define LDR  A0//light dependent resistor is connected to A0
#define PORTNUMBER  9600 // opens serial port, sets data rate to 9600 bps

void setup()
{
   Serial.begin(PORTNUMBER); 
   pinMode(WATERPUMP,OUTPUT); //Set pin 13 as OUTPUT pin
   pinMode(SENSOR,INPUT); //Set pin 8 as input pin, to receive data from Soil moisture sensor.
   pinMode(LDR,INPUT);
   digitalWrite(WATERPUMP,LOW);//pump should be off initally

}

void loop() 
{ 
  
  int val = digitalRead(SENSOR); //stores the value received from Soil moisture sensor in variable val 
  int LDRValue=analogRead(LDR);//stores the value received from LDR in variable LDRValue 
  
   if(LDRValue <= 400)
  {
    // if its dark then doesn't matter whether moisture is low or high, pump should not be off
     Serial.print("its dark, so pump will off. LDR value is: ");
     Serial.println(LDRValue);//Print LDR value
     digitalWrite(WATERPUMP,HIGH);//pump will off
     return;   
  }

  if( val == HIGH)
  {
      
     Serial.print("its not dark and moisture is high so pump should turn on, LDR value is: ");
     Serial.println(LDRValue);//print LDR value
     Serial.print("\n moisture value is: ");
     Serial.println(val);//print soil moisture sensor value
     digitalWrite(WATERPUMP,LOW); //pump goes on
  }
  else
  {
      Serial.print("its not dark and moisture is low so pump will off, LDR value is: ");
      Serial.println(LDRValue);//print LDR value
      digitalWrite(WATERPUMP,HIGH);//and pump goes on 
  }
  delay(400); //Wait for few second and then continue the loop.

}

Output

Check out the video, it will help you to understand the working of the project in real time.

How To Build a Smart Plant Watering System Using Arduino Uno

Hope you like the video.

If you have any questions regarding the project feel free to ask. I will try to solve your issue.

10 Comments

  1. I found that using a capacitance moisture sensor is more dependable as the resistive sensor degrades rather quickly leading to over watering. I also use a pump in conjunction with a solenoid since the water flows due to siphoning.
    My code pulses the pump/solenoid for 1000 ms and then waits for 1 hour before measuring moisture level. I find this prevents over watering as it gives time for the water to reach the sensor and reading to stabilize.

  2. How can I add an LCD to display soil moisture please? Been trying for hours and struggling could you help me with code at all?

  3. Dear Neeti Thakur,
    I had read your article and save d it to my laptop. Will you please help to include the following in your above :-
    1.Humidity and temperature sensing
    2.pH sensing
    3.A digital as well as reflection of the parameters in a LCD and in the PC.
    Guide what are the parameters are to be incorporated in the programe for the above sensing. Though I am not well versed with programming I wish to have an ideal watering solution to my kitchen garden.
    Kindly allow me to thank you for the above article.

  4. I'm new to using these components but want to try this one as a challenge. What did you use to power this? I see 12V in the diagram. Did you use AA batteries? Thanks

    1. I used USB cable to operate arduino Uno directly through my laptop. You can use 5 volt DC charger to operate it after uploading the code.
      On the other side to operate water pump I used relay module.

  5. Thanks Alex…
    I had already provided the link of code above the connection diagram, please have a look.

  6. I liked your project very much as I am trying to make automatic watering myself. I am not able to see your code, maybe you are not sharing it for a reason but it would be nice if you do 😀

Leave a Reply

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