Mega damaging LCDs?

Hi Guys,

I'm developing a project with a Mega 2560. It uses a 3x4 matrix membrande keypad and I've been developing the user interface the last couple days.

The unit was running fine. I have a 20x4 blue/white LCD display on it in parallel configuration. today as I was testing the display suddenly went from my menu to gibberish on lines 0 and 2. I unplugged it, checked all the connections and fired it back up - same problem. I uploaded a display example sketch and the tx/rx lights flashed and the gibberish on 0 and 2 seemed to change as the various display routines executed. I swapped the hookup leads in case one had a broken wire. Same result. I then took the working LCD from my Uno and moved it to the Mega. Fired it up and same thing - gibberish on lines 0 and 2. I put the display back on my Uno and guess what? Same thing! Gibberish and only two lines! I hooked the Mega's original LCD up to the Uno too and its the exact same thing.

Evidently something in the Mega went bad and is eating the LCDs!!!

Anyone else experience this?

Thanks!

Steve

It could be a problem with the code, OR you could be running out of memory. We wont know unless you post your code.

When I unhook the data lines and just apply power (Gnd, +5 and contrast through a 10K pot to pin 3) the display just shows two rows of blocks, rows 0 and 2. That pretty much eliminates software, doesn't it?

If the LCD is hooked up correctly then software shouldn't be able to hurt it, should it?

Like I said, the first one was running and sitting there on a menu while I was making a code adjustment when it went bad (it was sitting on the desk next to my keyboard so my eye caught it when the display went wonky). After checking the connections and even switching wires there was no change. I uploaded a screen example and the lights blinked so it appears it ul'd and as it runs through the various displays the garbage on the screen changes.

I took the display from my Uno that was working fine and put it on and got the EXACT same problem right away from the first boot up.

Putting the displays on my Uno give the same problem now and applying power from just my Uno gives the same problem.

The Uno is good - I hooked a 16x2 to it and wah lah, it works fine. It appears something in the Mega is dorking the displays, looks like it's taking one of the controllers out as my understanding is that 20x4 displays have two controllers in them and they control alternating lines.

Can you provide a link to the display you are using?

With these serial displays it's important to avoid having them connected to the hardware serial (pins 0, 1) when uploading sketches. All of the sketch data gets transmitted to the LCD and can confuse the heck out of them.

The displays are cheapies off fleaBay, the data sheet is here: http://www.goodview-lcd.com/fileshow.asp?i=33

The LCD was hooked to Mega pins 12-7: 1)Vss-Gnd 2)Vdd-+5V 3)Vo-10Kpot, center tap, outer taps to +5V & Gnd 4)Rs-12 5)R/W-Gnd 6)En-11 7)D0-No connection 8)D1-No connection 9)D2-No connection 10)D3-No connection 11)D4-10 12)D5-9 13)D6-8 14)D7-7 15)LED+-5V 16)LED--Gnd

A membrane keypad was hooked to pins 1 & 2 though. I was using a 3x4 membrane keypad but I was only using it as a 3x3 by not hooking up the row pin for the last row. Rows were on 6, 5 & 4 Columns were on 3, 2 & 1

I was using the matrix keypad library to manage the keypad program interface.

Do I take it that it's best to simply avoid using pins 1 & 2?

This is a parallel LCD, not serial.

Do I take it that it's best to simply avoid using pins 1 & 2?

How could you NOT use pins 1 and 2 on the LCD?? ; that's it's main power connections.. Pin 1 needs to be connected to Arduino ground, and Pin 2 to +5V.

Puns 15 and 16 are for the LED and do not power the LCD chips.

Let us know what happens...

I meant that on the Mega, not the LCD, there was a keypad hooked up to pin 1 and nothing was hooked to pin 0.

It's a membrane matrix key pad and was hooked to the following pins on the Mega:

Rows were on 6, 5 & 4 Columns were on 3, 2 & 1

When I soldered the header strip onto the displays I soldered some jumper wires too - one jumper from Gnd (LCD pin 1) to R/W (LCD pin 5) and from there to LED - (LCD pin 16). I also soldered a jumper from Vdd (LCD pin 2) to LED + (LCD pin 15).

So, as far as power I just need to hookup LCD Pins 1, 2 & 3 and the R/W pin is hardwired to ground and the backlight is hardwired for power and ground.

Like I said, the unit was up and running for a couple weeks with the above configuration, it had several hours on it as I've worked through several projects refreshing my C programming skills from many years ago (I made them use the LCD instead of the serial port so I could get used to programming it). I started on my main project the other day and I was working with programming up the menus when it went out. It was sitting on the desk next to the keyboard while I was making a change to the sketch on the computer when the screen went from my menu to two lines of gibberish. Checked and replaced wiring, same issue. Replaced LCD with a known working one and the same issue again immediately upon powering up, it didn't work correctly even for a second. Hooking both displays to a known good Uno gives the same result now and just powering them up from the Uno gives just two alternating lines of blocks. I know there are two drivers in a 20x4 as that's where the wordwrap bug that makes text extending beyond a line skip a line and continue comes from, so it appears to me that something knocked one of the driver chips out of the LCD - and it did it on both displays.

I wish I could post a pic but my supplier was nice enough to get a new board headed my way and told me to just toss the old one, so I did. I also tossed the displays as I knew they were definitely bad and I have a new one on the way from a US supplier and another couple spares from the Chinese supplier. Hopefully I can be back up and running by the end of the week.

A little later when I'm back at the desk top I'll post the code for you, there's not much to it yet, just menus. It eventually will supply pulses for two pulse direction stepper motor drivers.

since it is unlikely 2 lcd screens failed in the same way I would guess one of the pins on the mega died probably. Too much current draw?

I'm running the lcd and a membrane matrix keypad, dunno how that would overstress it.

// Mega Shell Paster Development Copy
// 3/11/13
#include <Wire.h>
#include <LiquidCrystal.h>
// The below just makes it easier to setup the LCD display,
// it lists the pins and assignments and then calls the routine
// that communicates with the display. The #define statements
// could’ve been left out and the pins simply put in the () for
// the lcd routine call.
#define Rs_pin 12
#define En_pin 11
#define D4_pin 10
#define D5_pin 9
#define D6_pin 8
#define D7_pin 7
LiquidCrystal lcd(Rs_pin, En_pin, D4_pin, D5_pin, D6_pin, D7_pin);

#include <Keypad.h>
const byte ROWS = 3; //three rows
const byte COLS = 3; //three columns
// Below defines the keymap
char keys[ROWS][COLS] = {
{‘1’,‘2’,‘3’},
{‘4’,‘5’,‘6’},
{‘7’,‘8’,‘9’}
};
byte rowPins[ROWS] = {6, 5, 4}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {3, 2, 1}; //connect to the column pinouts of the keypad

// Everything needed for the keypad has been given, below creates it.
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

unsigned int shell_size_selection = 9;
// This sets the intial shell size to 8", you can set it to whatever size
// you want it to start at.

unsigned int shell_profile_selection = 1;
// There are currently four shell profiles per shell selected, this sets
// the profile selection to start at the first one.

unsigned int shell_action_selection = 1;

unsigned int current_page = 1;
// This is a flag to tell the program which menu page to be on.

unsigned int page_1_start_menu_left_arrow_location = 1;

void setup() {
}

void loop() {
// This is the main running loop of the program
//
switch (current_page) {
case (1):
page_1_start_menu ();
break;
case (2):
page_2_shell_select ();
break;
case (3):
page_3_shell_profile_select ();
break;
case (4):
page_4_action_select ();
break;
default:
current_page = 1;
lcd.clear();
break;
}

}

//***** These are functions to be called by the main program *****
//
void page_1_start_menu () {
lcd.setCursor(0,0); // sets the cursor to column zero on row zero
lcd.print(“Select Shell”);
lcd.setCursor(0,1); // sets the cursor to column zero on row one
lcd.print(“System Config”);

byte left_arrow[8] = { // Create byte array with ←
B00010,
B00100,
B01000,
B11111,
B01000,
B00100,
B00010,
B00000};
lcd.createChar(0, left_arrow); // Create custom character 0
//
switch (page_1_start_menu_left_arrow_location) {
case (1):
lcd.setCursor(14,0);
break;
case (2):
lcd.setCursor(14,1);
break;
}
lcd.write((byte)0); // Write custom char 0
//
char key = keypad.getKey(); // check the keypad
if(key) // Check for a valid key.
switch (key) {
case (‘2’):
page_1_start_menu_left_arrow_location = 1;
lcd.setCursor(14,1);
lcd.print(" “);
break;
case (‘8’):
page_1_start_menu_left_arrow_location = 2;
lcd.setCursor(14,0);
lcd.print(” ");
break;
case (‘5’):
lcd.clear();
if (page_1_start_menu_left_arrow_location==1) current_page = 2;
break;
}}
// End of page_1_start_menu function
//
void page_2_shell_select () {
lcd.setCursor(0,0);
lcd.print("Shell Size: ");
//
display_shell_size_selected ();
//
char key = keypad.getKey(); // check the keypad
switch (key) {
case (‘4’): { // left arrow pressed
–shell_size_selection; // decrement shell size by one
if (shell_size_selection == 0) shell_size_selection=12; // if at min roll over to the max
break;
}
case (‘6’): { // right arrow pressed
++shell_size_selection; // increment shell size by one
if (shell_size_selection == 13) shell_size_selection=1; //if at max size roll over to min
break;
}
case (‘5’): { // select pressed
current_page = 3;
break;
{
case (‘2’): { // up arrow pressed
current_page = 1;
lcd.clear();
break;
}

}}}}
// End of page_2_shell_select function
//
void display_shell_size_selected () {
// the below looks up the menu text to display for the shell size selections
lcd.setCursor(12,0); // sets the cursor to column 12 on row zero
switch (shell_size_selection) {
case (12):
lcd.print("16 ");
break;
case (11):
lcd.print("12 ");
break;
case (10):
lcd.print("10 ");
break;
case (9):
lcd.print("8 ");
break;
case (8):
lcd.print("6 ");
break;
case (7):
lcd.print("5 ");
break;
case (6):
lcd.print("4 ");
break;
case (5):
lcd.print("3 ");
break;
case (4):
lcd.print(“2-1/2”);
break;
case (3):
lcd.print("2 ");
break;
case (2):
lcd.print(“1-3/4”);
break;
case (1):
lcd.print(“1-1/2”);
break;
}
}
// End of display_shell_size_selected function
void page_3_shell_profile_select () {
lcd.setCursor(0,1);
lcd.print("Profile: ");
display_shell_profile_selected ();
char key = keypad.getKey(); // check the keypad
switch (key) {
case (‘4’): { // left arrow pressed
–shell_profile_selection; // decrement shell profile by one
if (shell_profile_selection == 0) shell_profile_selection=4; // if at min roll over to the max
break;
}
case (‘6’): { // right arrow pressed
++shell_profile_selection; // increment shell profile by one
if (shell_profile_selection == 5) shell_profile_selection=1; //if at max size roll over to min
break;
}
case (‘5’): { // select pressed
current_page = 4;
break;
{
case (‘2’): { // up arrow pressed
current_page = 2;
lcd.clear();
break;
}
}}}}
// end of page 3 function
//
void display_shell_profile_selected () {
// the below looks up the menu text to display for the shell profile selections
lcd.setCursor(9,1); // sets the cursor to column 12 on row one
switch (shell_profile_selection) {
case (1):
lcd.print(“Gen Chinese”);
break;
case (2):
lcd.print("Lidu ");
break;
case (3):
lcd.print("S & C ");
break;
case (4):
lcd.print("Blank ");
break;
}
}
// End of display_shell_profile_selected function
void page_4_action_select () {
lcd.setCursor(0,2);
lcd.print("Action: ");
display_shell_action_selected ();
char key = keypad.getKey(); // check the keypad
switch (key) {
case (‘4’): { // left arrow pressed
–shell_action_selection; // decrement shell profile by one
if (shell_action_selection == 0) shell_action_selection=3; // if at min roll over to the max
break;
}
case (‘6’): { // right arrow pressed
++shell_action_selection; // increment shell profile by one
if (shell_action_selection == 4) shell_profile_selection=1; //if at max size roll over to min
break;
}
case (‘5’): { // select pressed
current_page = 4;
break;
{
case (‘2’): { // up arrow pressed
current_page = 3;
lcd.clear();
break;
}
}}}}

void display_shell_action_selected () {
// the below looks up the menu text to display for the shell action selections
lcd.setCursor(8,2); // sets the cursor to column 8 on row two
switch (shell_action_selection) {
case (1):
lcd.print("Paste Shell ");
break;
case (2):
lcd.print("Burnish ");
break;
case (3):
lcd.print(“Edit Profile”);
break;
}
}
// End of display_shell_profile_selected function

Just a follow up - new mega & lcd arrived, wired 'em & loaded code and wah lah! Back up & running! 8-> I left it running over night and still going fine. Definitely something in the old mega board went awry, hopefully it's not a common issue.