1
votes

I am using an Arduino Mega with a 16x2 LCD. When I start the Arduino the LCD flashes white and sometimes random lines will show up and gradually fade out. The backlight is on, however, so the LCD is not inverted. At first I thought the Arduino was not getting enough power because I am using a Raspberry Pi to program it, but plugging in a 6V battery pack did not change the result. I tried plugging in a different 16x2 LCD to check if the one I was using is broken, but again, the result was the same. I have triple-checked my connections, adjusted the potentiometer, and fiddled around with where the LCD was connected on the breadboard in case some of the pins were broken, but to no avail.

Does the LCD have a problem with Arduino Mega boards? Or am I just unfortunate enough to have two broken LCDs?

Code:

#include <LiquidCrystal.h>
#define led_pin 22
#define buzzer_pin 7

LiquidCrystal lcd(12,11,5,4,3,2);

void setup() {
  pinMode(led_pin, OUTPUT);
  pinMode(buzzer_pin, OUTPUT);

  lcd.begin(16,2);

  digitalWrite(led_pin, HIGH);
  tone(buzzer_pin, 1000, 500);
  delay(500);
  digitalWrite(led_pin, LOW);

  lcd.print("LCD Test");
}

void loop() {
}

EDIT

I moved the LCD and wiring back to the other side of the breadboard and it did not change the output. I'm starting the think that the LCDs are just simply broken because the LCDs will randomly flash and fade unevenly. I found that these LCDs can be easily fried by incorrectly adjusting the potentiometer.

2

2 Answers

1
votes
  1. Make sure that you solder headers to the lcd, then press the headers into your breadboard and connect to arduino with jumper wires. Just resting the LCD on the headers without solder or jabbing the lcd pin holes with jumper wires don't make reliable connections. You WILL see random stuff

  2. Make sure you connect the LCD correctly. If you did, you wouldn't have got any problems. Post a picture.

  3. Make sure the pins you used in the code match pins you connected to the LCD.

  4. Best way to get arduino help is on arduino forum.

0
votes

Specifically which LCD are you using? Do you have datasheets for the exact LCD you are using so you can confirm you have the correct wiring and supply voltages?

If you still have no luck, you may want to try a LCD module that has a serial, i2c, or spi interface. They are much easier to use than HD44780 parallel modules (im assuming this is what you have). An example source of such modules is https://www.crystalfontz.com/c/character-lcd-displays/interface/24