Help Needed: LCD Display Not Lighting Up in Arduino Automatic Watering System
Hey Arduino Community!
I'm currently working on a project to create an automatic watering system using an Arduino Uno R3 board, a 16x2 LCD display, a water pump, and a soil moisture sensor. However, I've hit a roadblock and could really use some assistance.
The issue I'm facing is that my LCD display isn't lighting up at all. I've double-checked all the connections, made sure the code is correct. Here's a rundown of my setup:
Arduino Uno R3 board
16x2 LCD display
Water pump
Soil moisture sensor
I've followed tutorials and guides closely, but I can't seem to figure out what's causing the problem.
If anyone has experienced a similar issue or has any suggestions on how to troubleshoot this problem, I would greatly appreciate your help. This is the code i am using:
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
lcd.clear();
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
delay(1000);
lcd.setCursor(0, 0);
lcd.print("IRRIGATION");
lcd.setCursor(0, 1);
lcd.print("SYSTEM IS ON ");
lcd.print("");
delay(3000);
lcd.clear();
}
void loop() {
int value = analogRead(A0);
Serial.println(value);
if (value > 950) {
digitalWrite(2, LOW);
lcd.setCursor(0, 0);
lcd.print("Water Pump is ON ");
} else {
digitalWrite(2, HIGH);
lcd.setCursor(0, 0);
lcd.print("Water Pump is OFF");
}
if (value < 300) {
lcd.setCursor(0, 1);
lcd.print("Moisture : HIGH");
} else if (value > 300 && value < 950) {
lcd.setCursor(0, 1);
lcd.print("Moisture : MID ");
} else if (value > 950) {
lcd.setCursor(0, 1);
lcd.print("Moisture : LOW ");
}
}