Skip to main content

How to control RGB LED using Arduino Uno

RGB LED is the abbreviation of ‘’Red Green Blue Light Emitting Diode’’. RGB LED is the most amazing type of LED which has the ability to create millions of different shades of light colors using red, green, and blue colors.

Smart 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 the 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 water to the plant only at 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, water pump, and Arduino Uno. Usually, the ideal time to water the plants depends on the climate condition 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 water the plant only at daytime whenever the soil will get dry.

The main aim of this system is, as if the soil is dry then soil moisture sensor senses 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 then soil moisture sensor senses enough moisture level in the soil, then the water pump will get automatically stopped. 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.


1. Arduino Uno..................................BUY

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 process according to the program stored in it and performs output operation.

Arduino uno is small but powerful multitasking board which is used to make a efficient intelligent prototype to make things easier than ever before.

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 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 value less than or equal to the threshold value than it means there is dark and whatever is the value of soil moisture sensor pump should be switched off. If the soil is dry than soil moisture sensor senses high moisture level of soil and if the soil is wet than soil moisture sensor senses low moisture level of the soil. If the light dependent resistor senses value greater than the threshold value than the pump should be switch on only when soil moisture sensor senses high moisture in the soil. If the light dependent resistor senses value greater than the threshold value than the pump should be switched off only when soil moisture sensor senses low moisture in the soil. As this project works very efficiently with the help of this concept.

2.       Soil moisture sensor............................BUY

soil moisture sensor is used to measure moisture level of the material.

Soil moisture sensor used to measures the water content of the material. Soil moisture sensor has two probes, are responsible for the flow of current in the soil which in result help to identify resistance value to measure the moisture level of the material. If there is more water in the material than 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 than 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 mode. In this project, I used this sensor in digital mode.

3.       Light-dependent resistor.................................BUY

LDR is used to detect the light intensity.

Light dependent resistor (LDR) is also known as the photoresistor. LDR are light sensitive devices which are used to identify the presence and absence of the light intensity. LDR resistance value increases whenever it exposed to the less or low intensity of light (dark light). Therefore, if it exposed to dark light than its resistance value is high but when it identifies enough brightness in light than its resistance value decreases up to a few ohms. Light-dependent resistors are mostly used as the light sensor. In this project the water pump work 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, it means its dark outside and pump should be off. If the LDR value is greater than the threshold value means is not dark outside than pump should work according to the soil moisture sensor value.

4.       Relay module.......................................BUY

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

"Relay" is electromechanically or electrically operated switch which 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 value 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 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 states indicated in code defines “off sate” and the LOW state indicated in code defines “on state”.

5.       Water pump................................BUY

Water pump used to left water up to 1.7 meter.

I used a 12-volt submersible pump for this project which has 18-watt motor that can lift water up 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 water pump will be operated without water than it will get damaged.

6.       Resistor.................................BUY

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

7.       Breadboard.............................BUY

Bread board is the most commonly preferred board for prototyping.

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

8.       Jumper wires..............................BUY

These wires used to make connections between to electronic components.

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

CODE: Click here


For full detail of the project please visit-


  1. 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 :D

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

  3. 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.

  4. 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.

  5. How to write how I constructed this. I made it. But I don't know how to write how I made it

  6. 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?

  7. i cant run your coding using c++ can you help me

  8. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing
    Best LED Grow Light

  9. 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.

  10. This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post.! Smart watering

  11. You wrote this post very carefully. The amount of information is stunning and also a gainful article for us. Keep sharing this kind of articles, Thank you.landscape lighting

  12. Thanks for sharing such great information!


  13. hyee mind if you share your coding? it really help me a lot

  14. Firetech fire monitors are robust products designed with advanced technology and have been tested to provide the high-quality water jet and fog patterns.
    high pressure spray nozzle

  15. Your quest is over if you're seeking for the best Submersible pump retailer. This team has excellent customer service and communication skills. Additionally, you may use our Paid/Free Add Boost Option to promote your company or website.


Post a Comment

Popular posts from this blog

Buzzer with Arduino

A buzzer or piezo speaker is an audio signaling device commonly used to produce sound. Piezo buzzer produces sound based on the reverse principle of the piezoelectric effect. The buzzer is a less costly and light-weighted electronic device that’s why it is used in computers, alarm devices, refrigerators, microwave oven, security devices and so on. 

How to use temperature sensor with Arduino Uno

The temperature sensor is the most popular measuring device which is capable to sense the intensity of heat generated by the object to which it is connected. These sensors are most frequently used by us through our household devices such as microwaves, refrigerators, air conditioners, and so on. In this tutorial, we will learn about LM35 (LM means linear monolithic) temperature sensor which is an integrated circuit analog temperature sensor.