20x4 LCD display text barley visible

I am using a 20x4 LCD display with an arduino Uno connected to a pH sensor. I have uploaded the code and the LCD text is barley visible. What can i do to fix it?


This is the wiring diagram

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
float calibration_value = 21.34;
int phval = 0;
unsigned long int avgval;
int buffer_arr[10],temp;
void setup()
{
Serial.begin(9600);
lcd.init();
lcd.begin(20, 4);
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" Welcome to ");
lcd.setCursor(0, 1);
lcd.print(" Circuit Digest ");
delay(2000);
lcd.clear();
}
void loop() {
for(int i=0;i<10;i++)
{
buffer_arr[i]=analogRead(A0);
delay(30);
}
for(int i=0;i<9;i++)
{
for(int j=i+1;j<10;j++)
{
if(buffer_arr[i]>buffer_arr[j])
{
temp=buffer_arr[i];
buffer_arr[i]=buffer_arr[j];
buffer_arr[j]=temp;
}
}
}
avgval=0;
for(int i=2;i<8;i++)
avgval+=buffer_arr[i];
float volt=(float)avgval*5.0/1024/6;
float ph_act = -5.70 * volt + calibration_value;
lcd.setCursor(0, 0);
lcd.print("pH Val:");
lcd.setCursor(8, 0);
lcd.print(ph_act);
delay(1000);
}

Did you adjust the potentiometer on the LCD bachpack ?

Was that Johann Sebastian's pack? :rofl:

That is of course, the first step, also given that you have managed to have the backlight operating.

franklin_523013, please read the instructions for posting and edit your first post to appropriately cite the code.

I am surprised you actually see anything at all if you are using the deprecated LiquidCrystal_I2C library. You probably should be working from Bill Perry's "HD44780" library installed through the Library manager with examples provided.

That´s a well-tempered potentiometer :nerd_face:

check voltage.I found a barley forum for you if you want!:grinning:
here...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.