Troubles with arduino LCD display

hey all,
I have been trying to use a LCD display with my arduino Uno, but I keep getting strange results like random characters and white boxes to display. i don’t have a schematic, but so far I have the screen pins connected to the arduino pin as follows: VSS to ground, VDD to +5V, VO to ground via a 5K potentiometer, RS to 12, RS to ground, E to ground, D4 to 5, D5 to 4, D6 to 3, D7 to 2, A to +5v and K to ground. Oh, and all the pins I am using are digital pins, not analog pins.

I understand that the white boxes appear to signify that the screen is on, but I still do t understand the strange characters.

I’m just trying to print something basic for the moment, here is by code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  lcd.begin(16, 2);
}

void loop() {
  lcd.setCursor(0, 1);
  lcd.println(“on”);

}

Here’s a picture:

Why would you want to print to the screen 10,000 times per second? The usual approach is to print only when a displayed value changes. That way the processor can do other, more interesting things.

Try this and see if it prints what you expect.


#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  lcd.begin(16, 2);
  lcd.setCursor(0, 1);
  lcd.println(“on”);
}

void loop() {
}

Yeah good point, the code was mostly just meant to test to screen and see if it would display anything. Unfortunately no luck running the code you posted, it just prints the white boxes again

White boxes means that the display is powered correctly, but is not receiving valid commands.

Double check your wiring, including continuity. Did you solder the connections?

Please post a hand drawn wiring diagram, as the photo does not show all the connections.

There’s a bit of my original question that states all of the connections to the arduino from the LCD, is that ok? I’m cool to make a schematic though if you need

A diagram is always better than words, and it gives you a chance to double check your wiring.

While you are doing that, use your multimeter to verify connectivity, as breadboards are unreliable.

Sure thing, here it is:


I also checked all of the connection with a multimeter like you suggested, and they are all good

RW needs to be connected to ground, not pin 11.

E needs to be connected to pin 11, not ground.

That's what your constructor LiquidCrystal lcd(12, 11, 5, 4, 3, 2); has specified.

When you do that, this code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  lcd.begin(16, 2);
  lcd.setCursor(0, 1);
  lcd.println("on");
}

void loop() {
}

will show you this:

R/W and E are not connected properly.

Don

Ah brilliant, cheers a ton!

Does anyone know how to stop the four lines appearing in unused cells?

Use print rather than println.

None of the LCD libraries support the println() function. That is why the extra characters with 4 lines are showing. Only use print() and control cursor position with the setCursor() function.

The 4 line characters are because the LCD cannot print the line feed and carriage return characters that println() sends.

Gotcha

Hello sinewav3

Welcome to the worldbest Arduino forum ever.

Buy an I²C interface adapter to save yourself time and nerves.

1 Like

Yes, get an LCD with an I2C interface, only 4 wires.

Over the years I’ve found these are “much less susceptible” to EMI interference too.

If you do go with the IC2 enabled LCD use the hd44780 library instead of the LiquidCrystal_I2C libraries. It makes using those LCDs much easier by auto detecting I2C address and LCD to I2C backpack pin mapping.

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