For fast transaction call 0916.457.0748
Arduino Soil Moisture Sensor with 1602 LCD display  -- Tutorial

Arduino Soil Moisture Sensor with 1602 LCD display -- Tutorial

Soil moisture sensor is a sensor used to measure the amount of water in the soil at any particular point in time. Instead of the old gravimetric method of measuring soil water content, the soil moisture sensor measures the volumetric water content indirectly by using other properties associated with the soil, like its electrical resistance to measure the soil humidity and the output of the soil moisture sensor display at 1602 LCD display .

Soil Moisture Sensor and 1602 LCD Display with Arduino UNO R3

Things you’ll need:

  • Arduino Uno R3
  • Soil Moisture Sensor
  • 1602 LCD with IIC
  • Connecting Wire

Schematic Diagram:

The schematic for this project is a fairly easy to replicate one. we have covered connecting the 1602 LCD Display with IIC to the Arduino. The soil sensor has just three pins which are VCC, GND, and SIG(signal) pin and they are connected to the Arduino as shown in the schematics below.

     

 

Connections:

Soil moisture Sensor – Arduino

VCC – 5V

GND – GND

SIG – A0

1602 LCD Display with IIC– Arduino

VCC – 5V

GND – GND

SCL – A4   (SCL of Arduino)
SDA – A5  (SDA of Arduino)

Building the Code

For you to make this project work, you’ll need first to download the Arduino Software and install it in your computer. To do so, visit the Arduino Website and download the application.

Libraries

     #include <Wire.h>

    #include <LiquidCrystal_I2C.h> // Using version 1.2.1

    // The LCD constructor - address shown is 0x27 - may or may not be correct for yours
    // Also based on YWRobot LCM1602 IIC V1
    LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  
    const int analogInPin = A0; // Analog input pin that the Sensor is attached to 
    int sensorValue = 0; // value read from the Soil Moisture 
    void setup() {
    // set up the LCD's number of columns and rows:
    lcd.begin(16, 2);
    delay(100);
    } 
    void loop() {
    lcd.clear();
    lcd.print("Soil Moisture:");// print the results to the LCD Display:
    sensorValue = analogRead(analogInPin);// read the analog in value:
    lcd.setCursor(0, 1);
    lcd.print(sensorValue);
    // wait 300 milliseconds before the next loop for the 
    //analog-to-digital converter to settle after the last reading:
    delay(300);
    }

    Connect your Arduino Board to your computer using the Power Cable.

    Open up your Arduino software and write the following code:

    
    

    Select the Board and Port you are using, in the Menu Bar select “Tools”. Select the corresponding board you are using and the designated port. Check this out on how to select board, Arduino moisture sensor kit.

    Upload your code.

    Documents:

     

    Happy Coding!

     

    0 comments

    Leave a comment

    Please note, comments must be approved before they are published

    Payment Methods

    Facebook Rewards Program