Finding Moisture in Soil In LCD Display with Arduino Uno


Finding Moisture in Soil In LCD Display with Arduino Uno
Note this project should not be copied without my permission.
//Included Libraries
#include
//MACROS are defined here
const int resetPin = 12;
const int enablePin = 11;
const int d4 = 5;
const int d5 = 4;
const int d6 = 3;
const int d7 = 2;
LiquidCrystal lcd16x2(resetPin, enablePin, d4, d5, d6, d7);
//Gloabl Variables are declared here
float Soil_Mositure;
void setup() {
//put your setup code here, to run once:
Serial.begin(9600);
lcd16x2.begin(16, 2);
pinMode(A0, INPUT);
}
void loop() {
//put your main code here, to run repeatedly:
Soil_Mositure = analogRead(A0);
lcd16x2.setCursor(1 - 1, 1 - 1);
lcd16x2.print(Soil_Mositure);
Serial.println(Soil_Mositure);
if(((395.5 < Soil_Mositure) && (600 > Soil_Mositure))) {
lcd16x2.setCursor(1 - 1, 2 - 1);
lcd16x2.print("Medium Moisture");
}
else {
if(((601 < Soil_Mositure) && (1500 > Soil_Mositure))) {
lcd16x2.setCursor(1 - 1, 2 - 1);
lcd16x2.print("High Moisture");
}
else {
if(((0 < Soil_Mositure) && (100 > Soil_Mositure))) {
lcd16x2.setCursor(1 - 1, 2 - 1);
lcd16x2.print("VeryLowMoisture");
}
else {
if(((101 < Soil_Mositure) && (354 > Soil_Mositure))) {
lcd16x2.setCursor(1 - 1, 2 - 1);
lcd16x2.print("Low moisture");
}
else {
if((Soil_Mositure == 0)) {
lcd16x2.setCursor(1 - 1, 2 - 1);
lcd16x2.print("No moisture");
}
}
}
}
}
delay(0.1 * 1000);
lcd16x2.clear();
}
Discussion (1 comment)
Arduino47 2 years ago
Cordially
m_hashir147 2 years ago
creator of this project,
This is an open source project and the reason I uploaded this is for educational purposes for students to learn. anyone can use this project, but only for competition and exhibition purposes. The reason that the moisture of soil is printed on the LCD display is because, first, basically we have to know how soil moisturing sensor works. First, the sensor will detect the water content in the soil with the 2-conductor and then keep a value for that. then, i programed it that it should print the value of the soil moisture sensor on the LCD display. Then the wordings came as "low mositure, High Moisture, Medium Moisture" because I added a code with "if" condition.
example:
if 300 > soil_mositure (the value in variable) and soil_moisture < 500 (or something):
lcd.print that soil moisture is low or high or medium something.
if you wanted to know the exact wording for the exact values, you have to do research in google.