LCD displays "scrambled" letters

My first Arduino kit arrived a few days ago. I’ve had experience before with simulators, so I was easily able to get started with LED setups and servos. However, the LCD has stumped me.

Whenever I power my arduino, the LCD displays scrambled text inside white boxes (1st picture in the attached document)

My code is as follows:

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 9, 8, 7, 10);

void setup() {
  lcd.begin(16, 2);
  lcd.print("Hello World");
}

void loop() {

}

The wiring can be found in the 2nd and 3rd pictures in the document included. Connections are as follows:

VSS>GND
VDD>5V
V0>GND
RS>Pin 12
RW>GND
E>Pin 11
D4>Pin 9
D5>Pin 8
D6>Pin 7
D7>Pin 10
A>GND
K>5V(w/ 220Ω resistor)

Can anyone help me fix this?
PS: Please note that there is no potentiometer connected to V0. Im not sure if that is a problem or not.

LCD scrambled text.pdf (916 KB)

V0>GND

Should be fine.

A>GND
K>5V(w/ 220Ω resistor)

Your photo shows the backlight. So the backlight LED must have cathode on pin#15 and anode on pin#16.
Most 16x2 have anode (A) on pin#15 and cathode (K) on pin#16. It is not uncommon to have swapped A, K.

Please check you wires. Post a clear photo as JPG, PNG, … not a PDF.

David.

the LCD displays scrambled text inside white boxes... there is no potentiometer connected to V0

The white boxes are caused by the contrast not being set correctly. That's what the pot is for.

Even though your photos are terrible quality, I can see the words "Hello World" reasonably clearly, repeated several times over.


I think that's just because you have been uploading the sketch or pressing reset several times, and the text appears in different places each time, because your code does not set the cursor position before printing the text.

I've checked the pins and A is before K, plus I tried switching the wires and that only dimmed the LCD so it isn't that.

I've swapped the wires of pin 7 and 10 on the breadboard the LCD is connected to as well as their positions in the code so the parameters for the LCD class now read "(12, 11, 9, 8, 10, 7)". The screen still displays white boxes, but "Hello World" now displays only once.

EDIT: I've put a 2k ohm resistor on V0 to help set the contrast, the message now displays clearly. Thank you all for your advice.

You are right - a PDF is indeed “A very unconventional method of posting pictures to the Arduino forums”. :roll_eyes: It is inconvenient to view, particularly on tablets/ phones (as some people actually use here!) and cannot be embedded in the thread.

OK, I am really wondering what the 9 V “PP3” battery is doing - it would be a rather short-lived means of powering an Arduino. :grinning:

It would seem that however you have the backlight connected, it is working. Swapping the connections should not allow it to light up at all, though the text will still be visible in good light. In general, given that resistor “R8” on the LCD board is “101”, that is 100 Ohms, you do not actually need the 220 Ohm series resistor except to dim the backlight.

A resistor from Vo to ground is the correct means of setting the contrast. There should be no connection to Vcc. 5 V - showing a potentiometer connected to ground and Vcc is a longstanding blunder perpetuated by people who just do not understand how the LCD actually works. You do need to adjust the resistor value for best contrast, 470 Ohms or less is likely to be good. :sunglasses:

zenith5720:
My first Arduino kit arrived a few days ago. I've had experience before with simulators, so I was easily able to get started with LED setups and servos. However, the LCD has stumped me.

Ah! So your previous discussion thread was in regard to a simulation. :astonished: (As you revealed in your third posting. OK. :fearful: )

It happens from time to time here that helpers spend substantial time attempting to resolve an intractable problem only to (hopefully) realise the problem described was in fact, not real! :roll_eyes: