How to operate soil moisture sensor with Arduino 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 The LED which has the ability to create millions of different shades of light-colors using red, green and blue colors.

How to operate soil moisture sensor with Arduino


The soil moisture sensor is the most amazing sensor used to measure the quantity of water present in the soil and defines the moisture level of the soil as the output. Because of its amazing operating principle this sensor used in application such as automatic irrigation system, agriculture research applications, landscape irrigation, indoor planting system, and lawns. I have also made an advance level project "Smart Plant Watering System" using a soil moisture sensor.
In this article, I will explain to you some basic fundamentals which will help you to understand the working of the soil moisture sensor. The soil moisture sensor can be operated in both analog and digital mode. Here I will explain to you how soil moisture sensor can be operated in both modes.  

Interfacing with Arduino:

Soil moisture sensor contains two parts one is sensor part and the other one is the control board. The sensor part is made up of two conductive probes which are used to measure the moisture content in the soil. Control board contains LM393 IC (voltage comparator), power LED, output LED and potentiometer such as important components which helps conductive probes to measure the moisture level of the soil.

1. Analog mode:

In this mode, I will show the real-time soil moisture sensor values on the serial monitor. In this project, you will learn how sensor value varies with the change in the moisture level of the soil.

Required components:

  • 1 x Arduino Uno board...............................BUY
  • Few jumper wires.......................................BUY
  • 1 x Soil moisture sensor..............................BUY
  • 1 x USB cable.............................................BUY
  • 1 x Breadboard............................................BUY

Connection diagram :




Circuit Description:

According to the connection diagram, the Vcc pin of the soil moisture sensor is connected with the 5V power supply pin of the Arduino board. GND pin of the soil moisture sensor is connected with one of the GND pins of the Arduino board. A0 analog pin of the soil moisture sensor is connected with the analog pin A2 of the Arduino board.

Code: Click here

In analog mode, I have used the analog pin of the sensor instead of the digital pin. In this mode, the sensor provides values from 0 to 1023 and these values will be shown on the serial monitor. As soil is dry then we will get higher values. When we add some water to it due to which soil will get wet then we will achieve lower values on the serial monitor.

Output video:



We can also measure the moisture level of the soil in percentage using map function with the same connection circuit. In this case, I have mapped the values of the soil moisture sensor between 0 to 100 to calculate the moisture level is the percentage. While using analog mode experiment I got 840 value on the serial monitor for dry soil and 120 value for wet soil. I used these values in map function to calculate the moisture level in percentage. These values may vary according to the soil. You can change them according to your need. 

Code to calculate sensor values in percentage (click here)

2. Digital mode:

In digital mode, the soil moisture sensor will provide only two sensor output value HIGH or LOW (1 or 0). In this mode, I will operate buzzer with the help of sensor values.

Required components:

  • 1 x Arduino Uno board:...............................BUY
  • Few jumper wires........................................BUY
  • 1 x Soil moisture sensor...............................BUY
  • 1 x USB cable...............................................BUY
  • 1 x Buzzer.....................................................BUY

Connection diagram :


Circuit Description:

According to the circuit diagram, VCC and GND pin of the soil moisture sensor are connected with 5V power supply and GND pins of the Arduino Uno board respectively. Digital pin D0 of the soil moisture sensor is connected with digital pin 8 of the Arduino Uno board. The buzzer is a two terminal device one is longer and another one is shorter. The longer pin is connected with the output pin 8 and the shorter pin is connected with the GND pin of the Arduino board. 

CodeClick here

According to the code I have used the soil moisture sensor as an input device and the buzzer as the output device. Sensor values are compared with the specified threshold value (HIGH). If the sensor value is equal to the threshold value than buzzer will be generated beep sound otherwise buzzer will be off.

This concept can be used in interior home based plant watering system. As if the soil is dry than buzzer will generate beep sound and remind us to water the plant. As we provide water to the plant than the sensor will observe low value and stops the buzzer automatically. I have made an advance level project using a soil moisture sensor working in digital mode.



Comments

  1. Great research and development on how to operate soil moisture sensor. You can also see the best SSoil monitoring Temperature and humidity Probe by UbiBot. Thanks.

    ReplyDelete
  2. It is a great website.. The Design looks very good.. Keep working like that!. Sindh irrigated Agriculture

    ReplyDelete
  3. I have gone through this article and its code with interest; I want to incorporate a pH (atlas Scientific pH sensor)and Temperature and humidity Sensor probe DHT 22 with LCD readout so that the parameters can be displayed. How to incorporate in the above programme ? Can some one help me with codes so that I can try to automate my kitchen garden (presently watered by manually by me). I have with me the soil moisture sensor, DHT22,16x2 LCD module( bought for distance sensor) with the Arduino R3 board ; only I have to go in for the atlas scientific pH sensor.
    Please kindly help me (I am a retired electronic teacher ans service personal ).
    V.Ramakrishnan
    pawanivr@yahoo.com
    +91 8105843368

    ReplyDelete
  4. I had already provided a separate article to understand the basics of LCD module (https://www.arduinounomagic.com/2019/01/how-to-use-lcd-with-arduino-uno.html?m=1). You will find solution for your issue after understanding the basics of LCD.

    I had also provided the article named "How to use temperature sensor with Arduino Uno" (https://www.arduinounomagic.com/2019/01/how-to-use-temperature-sensor-with.html?m=1) in which you will find all the basic concepts.

    Hope these articles will help you.

    ReplyDelete
  5. Excellent post, which you shared here on the moisture Absorbers. Information is very important to everyone who is truly interested in these kinds of sensors. Ubibot provides this kind of sensors so if anyone is looking to buy these sensors can contact us.

    ReplyDelete
  6. Thanks for your post. It's very helpful post for them, which is not aware about Zoomvisual.com.sg. If anyone interested about Zoomvisual.com.sg, then visit led video wall singapore. Here you will get best Zoomvisual.com.sg.

    ReplyDelete
  7. Your article contains very much information . Your article is very informative and useful to know . Thank you so much for sharing this article here. Sprinkler companies Perrysburg

    ReplyDelete
  8. Nice information, thanks for sharing valuable information with us.

    Humidity Sensor

    ReplyDelete
  9. Using a rain barrel is an environmentally friendly water-saving solution. If you're looking for a best rain barrel at affordable price, don't forget to visit https://weatherstationprofy.com.

    ReplyDelete
  10. I liked your work and the way in which you have shared this article here about planar tvf It is a beneficial and helpful article for us. Thanks for sharing an article like this.

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete
  12. The information in the post you posted here is useful because it contains some of the best information available. E39 LED bulb. Thanks for sharing it. Keep up the good work.

    ReplyDelete

Post a Comment

Popular posts from this blog

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,

How to use LCD with Arduino Uno

Liquid crystal Display 16x2 (LCD) is the widely used electronic device to establish communication between the real world and electronics based machine world.

ad

ad