LCD backlight only works with Serial.begin(...)

Hi, I've got the 16x2 LCD display with blue backlight, dropped directly into the Mega2560 R3, no wiring. But there are a few issues that I hope you might have guidance on:

  • Code can only be uploaded when the LCD is removed from the unit.
  • The unit must be powered off before replacing the LCD.
  • Strangely, the backlight only powers up with a call to the Serial initialisation. Even when powered-up, only very faint blocks (or none) are shown, and no text.
#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, E, b4, b5, b6, b7);
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup()
{
  Serial.begin(9600);      //if this is removed, even the backlight doesn't activate...
  
  lcd.begin(16, 2);
  lcd.clear();
  lcd.display();
  //lcd.noDisplay();

  lcd.setCursor(0, 0);
  lcd.print("test");
}

void loop()
{
  //lcd.setCursor(0, 0);
  //lcd.print("test");
  //lcd.print(millis() / 1000);
  //delay(1000);
}

Post a few images please.

how is the LCD connected to the Arduino ? quality of the soldering job?

Hey guys. Normally I wouldn't ask simple questions like this, but there was zero documentation from the manufacturer or retailer. Anyway like I said it's dropped in, no wires.

Some new code, which reveals something interesting:

#include <Wire.h>
#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, E, b4, b5, b6, b7);
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup()
{
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcd.clear();

  //lcd.setCursor(0, 0);
  //lcd.print("test");  
}

void loop()
{
  lcd.setCursor(0, 0);
  lcd.print(millis() / 1000);
  delay(100);
}

Now the screen lights up 5 seconds, flashes maybe 50 times, and repeats the cycle over.. no writing. If a picture is 1000 words then a video is... 30Mb

https://updriva.com/public/arduino_lcd.mp4

What if LiquidCrystal lcd(8, 9, 4, 5, 6, 7); is wrong?

Then the backlight flashes instead of data going over with the print command?

Also contrast sounds good but also, I was unable to get any docos on that. The pot on this board doesn't seem to do anything in that context.

I found that the 4 data pins go to 14, 15, 16, 17 (tx4 rx3 tx2 rx2) on the Mega, and the other two A8 and A9 for the buttons. It's hard to see in the photo but I followed the tracks underneath the display board.

You are plugging the shield into the wrong pins.

That shield is made for an Uno so plugs into the pins that would be on an Uno. Pins 4, 5, 6, 7, 8, 9 and 10 are used to interface with the LCD. Just one Analog Pin A0 is used to read the five pushbuttons. Those are the Mega pins that should be connecting to the shield as well.

Genius! I moved it over 8 pins and it's working perfectly, thanks :grinning:

You are welcome.

Please mark the thread as solved so that others do not waste their time trying to help with a solved issue.

I am fascinated by how you managed to forcibly jam the shield into the wrong sockets in the first place! :astonished:

1 Like

They actually lined up perfectly with the others. Since it seemed directly over the other PCB, I assumed that was how it was meant to go. haha

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