Weird Bugs using 20x4 LCD with Arduino Uno

Hello everybody,

I replaced the LCD on my 3D printer and tried using the old one with my Arduino Uno. The LCD is a 20x4 character one with 16 pins. It is on a shield with 5 more buttons and the necessary resistors. I followed the PCB traces and wired it to the Arduino like this.
After uploading a LiquidCrystal example sketch and changing the display to 20x4 the LCD displays nothing or weird characters. It would be nice if somebody helped me.

It would help if we could see the message that you are trying to display and the 'weird' characters that result.

Make sure you do your testing with a 'static' message, ie. nothing between the { } brackets in loop().

Don

This is the code I’m using:

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

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

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

void loop() {

}

The display is just blank and not showing any text.

We can't check your wiring with the photos that you have provided.

  • We have to be able to verify that you followed the PCB traces correctly.
  • We have to be able to unambiguously follow each wire from one end to the other.

Don

EDIT: With a second look I think you may have D4 - D7 hooked up exactly wrong. The yellow wire from pin 2 looks like it is going to what is probably D4.

This is the wiring:

Here are the PCB traces:

This is the wiring:

No. That is a drawing of how the wires should be connected. We need to be able to follow your actual wires on the actual hardware.

Here are the PCB traces:

Unfortunately that picture doesn't show which pins D4, D5 and D6 go to on the connector, and the connections on the other side of the board are hidden under the display. What did you come up with and have you double checked? One would assume the pins are sequential but you never can tell.

EDIT: Comparing the board to the fritzing diagram it looks like the connections in your diagram make sense and the pins are not quite sequential. Are you SURE you connected them correctly?

Under what conditions does your display show weird characters? As long as something shows up under some conditions we can assume that the contrast setting (controlled by R2 and R3) is OK.

Just curious, why did you replace the display on your printer?

Don

floresta:
No. That is a drawing of how the wires should be connected. We need to be able to follow your actual wires on the actual hardware.

Unfortunately that picture doesn't show which pins D4, D5 and D6 go to on the connector, and the connections on the other side of the board are hidden under the display. What did you come up with and have you double checked? One would assume the pins are sequential but you never can tell.

EDIT: Comparing the board to the fritzing diagram it looks like the connections in your diagram make sense and the pins are not quite sequential. Are you SURE you connected them correctly?

Under what conditions does your display show weird characters? As long as something shows up under some conditions we can assume that the contrast setting (controlled by R2 and R3) is OK.

Just curious, why did you replace the display on your printer?

Don

  1. I checked the wiring multiple times and I'm pretty sure it is correct. I can check once again if you want.

  2. Yes, I assumed the pins are sequential because the traces cant cross on a single layer PCB. Unfortunately I can't check the underside of the display.

  3. The contrast settings are OK. The display worked fine with the printer and the weird characters also had a good contrast. I can upload a unlisted video to YouTube if you want to. They appear kind of randomly, sometimes after reset and sometimes after I pull a data cable out and put it back in again.

  4. I replaced it because I don't like the buttons, it's very difficult to use them. The new display has a knob and is a full graphics display. Also with the new firmware I can change the language.

Ok, as it turned out it was a problem with the wiring. I probed the traces and the ones for the D4-7 pins were mixed up. I corrected it and now the LCD works as planned. Now I only need to get the buttons to work. Do you know a tutorial that explains how to do that?