![]() |
In This Article, We will learn how to measure the moisture (water content) in soil using the Moisture sensor & Arduino. Arduino is an open-source electronics platform. It consists ATmega328P 8-bit Microcontroller. It can be able to read inputs from different sensors & we can send instructions to the microcontroller in the Arduino. It provides Arduino IDE to write code & connect the hardware devices like Arduino boards & sensors. Soil Moisture sensor: A soil moisture sensor is used to measure the amount of moisture (Water content) present in the soil. Water monitoring is very important for a few crops. A soil moisture sensor is used to automate the process of monitoring moisture levels in the soil. Working: It works based on the conductivity of electricity through moisture in the soil. We know that pure water does not conduct electricity, as well as solid salt in the soil, does not conduct electricity, But they together can conduct electricity. Moisture in the soil having salt content helps to conduct electricity. But it is restricted to conduct a limited amount of electricity based on the amount of water content present in water (Resistance). This resistance helps to sense the amount of water content approximately. If the water content is high, the resistance between probes is low. If the water content is less, the resistance between the two probes is high. Components Required:
Setup:
Circuit diagram: ![]() Soil Moisture Sensor with Arduino Arduino code for Analog Reading (output in the serial monitor):
Simulation Output Tinkercad: ![]() Soil Moisture sensor analog reading
Analog to Digital conversion: Analog Read output = (Input Voltage / Maximum Voltage ) * 1024 Note: Arduino Uno supports 10-bit ADC, Which means the resolution of the output is 2^10 = 1024. We can notice that the sensor reading output goes up to a maximum of Analog value: 876. Here we are applying 5 Volts to the VCC pin of the sensor, For 5 Volts, we are getting a maximum of 4.28 Volts Approximately in the SIG pin (output pin). Its equivalent ADC value is 876. Calculation: ( 4.28 / 5 ) * 1024 = 876 So the output varies from 0 to 876. Note: This range may change based on the hardware manufacturer. Analyze before using the limits. Demonstrating Moisture level using LEDs From the Analysis, We got that the output range is 0 to 876. To monitor the moisture level through LED, Use Arduino Digital IO pins to connect the LEDs. Here we are going to use 5 levels. So we need 5 LEDs. Setup:
Circuit Diagram: ![]() Soil Moisture Level Indicator Circuit Level Indication:
Arduino code for moisture level Indication using LEDs:
Output: Applications:
|
Reffered: https://www.geeksforgeeks.org
Arduino |
Related |
---|
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 12 |