Arduino Atmega and LCD 20x4 connection

Im trying to connect my LCD 20x4 to my arduino atmega and its displaying weird characters. I attached a pic of what the LCD displays.

LCD -- Arduino
1(GND) -- GND
2(VDD) -- 5V
3(Contrast) -- GND
4(RS) -- 40
5(R/W) -- GND
6(Enable) -- 41
7-10 no connections
11(DB4) -- 42
12(DB5) -- 43
13(DB6) -- 44
14(DB7) -- 45
15 -- 5V
16 -- GND

here is my code:

#include <LiquidCrystal.h>
LiquidCrystal lcd1(40, 41, 42, 43, 44, 45);

void setup() {
lcd1.print("hello, world");

void loop() {

what am I doing wrong?

Can you post a few clear photos showing your wiring between the LCD and the Arduino so we can check your wiring?

--- bill

You've got the classic missing or offset nibble problem that is explained in many of the other threads that have a mention of 'weird characters' in their title.

You can tell by the identical incorrect characters where the 'l's (lower case L) belong. Bill can explain the probable reasons and recommend his library as a solution.


After carefully looking at the characters on the display vs what was being sent to the display, it appears that that nibble bits 2 & 3 in both nibbles of the character have been flipped.

I have no idea how the display could get into 4 bit mode if the arduino pin connections to DB6 and DB7 were flipped but the characters that show up appear to have nibble bits 2 and 3 flipped of both nibbles of the byte.

This would indicate a wiring issue with DB6 and DB7.

A photo of how things are wired up would be helpful.

--- bill