16x2 text display

Hi guys

Hoping someone have a bright idea about what's wrong with my display.

It's wired up to my Arduino Mega 2560 and as long as i'm utillizing "lcd.begin(16, 1);" everything works fine, great contrast and all (Though I can only use 1 line).
When I change the "lcd.begin(16, 2);" then the text in the display nearly fades completely out. I can barely make out the "hello, world!" and the next line does have the seconds counting up, but it's very low contrast.

I'm using the standard "Hello Example" as pasted below.

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}

void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}

I hope someone have an idea?

Best regards
Nicklas

some delay might help:

void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
delay(100);
}

Did you use a potentiometer?

Yes I have a 10K potensiometer mounted at the Vo input on the display. and it's working as long as I'm only utillizing the upper line in the display.
I've now tried to use some delay 100-1000ms and it's still the same.
I've measured the voltage on the supply from the Arduino and it's 4,99V. the Vo input at the display gets 0V at min. and 4,98V at max.

If you do lcd.begin(16,2); and then adjust the potentiometer, will you get a better contrast? How did you connect the potentiometer to the lcd? A nice picture will be needed.

Theese 3 pics should display my issue.
I hope the link works :cold_sweat:
https://picasaweb.google.com/nicklas.m.hansen/PublicElectronics?authuser=0&authkey=Gv1sRgCMvGsvaHsd3upQE&feat=directlink

1 pic with the "lcd.begin(16,1);" and full contrast.
next with "lcd.begin(16,2);" and I did nothing else.
and finally one where it should display the potentiometer wirering.

Do you have a spec sheet of this display? I don't know which pin is V0. Usually if you have one row connection the V0 goes to pin 3. But I don't know about this display.

with the pins stacked with two rows of 8 like that on the breadboard, would it not short them out?

do you have a datasheet for that display?

with the pins stacked with two rows of 8 like that on the breadboard, would it not short them out?

It looks like the brown and black wires fit into the 'slot' and are not connected to the breadboard pins. They're obviously not shorted out, the display is working.

Don

I've measured the voltage on the supply from the Arduino and it's 4,99V. the Vo input at the display gets 0V at min. and 4,98V at max.

That's a good sign. With the display showing "Hello World" as in your third picture you should be able to adjust your potentiometer and get the contrast to change. The display should fade out as you increase the voltage at pin 3 and it should get darker when you decrease the voltage. If this works as expected then your potentiometer is probably wired correctly and you can procede.

You cannot adjust the contrast with the display set up for the one line mode and expect that same setting to work for the two line mode, you will have to readjust the setting after you switch modes. You will typically find that the display looks good with about 0.3V at pin 3.

Don

Maybe a Delay and lcd.clear command?

yesterday i begun testing my 16x2 LCD. and i also had some txt that was hard to read. solution, put a delay in your code + a lcd.clear command.

this is my code.

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int ldr =9;
int waarde;
int potMeter =15;
int ldrwaarde;
int licht =12;
int ldrwaarde2;

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);

}

void loop() {
  ldrwaarde = analogRead(ldr);
  lcd.setCursor(0,0);
  lcd.print("LWS:");
  lcd.setCursor(4,0);
  lcd.print(ldrwaarde);
  
  waarde = analogRead(potMeter);
  lcd.setCursor(0,1);
  lcd.print("Pot:");
  lcd.setCursor(4,1);
  lcd.print(waarde);
  
  ldrwaarde2 = analogRead(licht);
  lcd.setCursor(8,0);
  lcd.print("LWS2:");
  lcd.setCursor(13,0);
  lcd.print(ldrwaarde2);
  
  if (ldrwaarde2 == ldrwaarde ){
     lcd.setCursor(9,1);
     lcd.print("Gelijk!");
  }
  else{ 
     lcd.setCursor(10,1);
     lcd.print("...");
  }
  
  
  delay(450);
  lcd.clear();
  
}

@holahoep:

You need the delay in your sketch for an entirely different reason. Without the delay your display is constantly being rewritten, much faster than you or any one else can possibly read it. You need the delay in order to have a stable display before any new data is displayed.

The 'clear' function takes a much longer time for the LCD to complete than most of the other instructions. The required delay is already built into the library. You should consider rewriting your sketch to eliminate it. You should display the unchanging titles in setup() and just update the values in loop(). This will involve positioning the cursor at the start of an old value, displaying several 'spaces' to erase that value, repositioning the cursor, and displaying the new value. This sounds like a lot of work but it is better than clearing the screen.

Don

floresta:
@holahoep:

You need the delay in your sketch for an entirely different reason. Without the delay your display is constantly being rewritten, much faster than you or any one else can possibly read it. You need the delay in order to have a stable display before any new data is displayed.

The 'clear' function takes a much longer time for the LCD to complete than most of the other instructions. The required delay is already built into the library. You should consider rewriting your sketch to eliminate it. You should display the unchanging titles in setup() and just update the values in loop(). This will involve positioning the cursor at the start of an old value, displaying several 'spaces' to erase that value, repositioning the cursor, and displaying the new value. This sounds like a lot of work but it is better than clearing the screen.

Don

Now i changed the unchanging titles to setup. But don't know what you mean with the cursor thing. i used the clear command to reset the screen. because when my potentio meter goes to 1023, and i turn hum back to 3 numbers, like 932) the 4th digit will stay in my screen. But i dont understand your message how to get rid of the '4th' digit.

Now i changed the unchanging titles to setup. But don't know what you mean with the cursor thing. i used the clear command to reset the screen. because when my potentio meter goes to 1023, and i turn hum back to 3 numbers, like 932) the 4th digit will stay in my screen. But i dont understand your message how to get rid of the '4th' digit.

Let's say you want to print a new value for "ldrwaarde".

  1. Position your cursor to (4, 0)
  2. Print four spaces to cover up the old value
  3. Position the cursor back to (4,0)
  4. Print the new value of "ldrwaarde"

Don

Hi,

i did

lcd.print(" ");

it works..but i need the delay on the end of my code. otherwise i can't read the digits on my lcd screen because of the refresh. you also told me but i dont know you mean.

They are two separate issues. You need the delay, as you said, in order to be able to read the screen before it refreshes. Avoiding rewriting the non-changing items on the screen is just a different (better?) technique.

Don

floresta:
They are two separate issues. You need the delay, as you said, in order to be able to read the screen before it refreshes. Avoiding rewriting the non-changing items on the screen is just a different (better?) technique.

Don

Oke, thnx for the answer. i know how to use it now :slight_smile: