problem with 2004 20x4 i2c LCD

Hi guys,

I am a complete newbie so sorry if this is really stupid.

I have an Arduino Mega 2569 attached to an unbranded chinese LCD. The LCD is a serial enabled 2004A (I think it may be made by Sainsmart.) It’s an i2c 20x4 model.

I have wired it correctly I believe with the SCA and SCL lines going to their respective headers on pins 20 and 21 on the Mega, 5v and gnd.

The display is working, and is displaying text correctly, however the last 4 positions in rows 3 and 4 are lit up solid white, as in all pixels on. This does not seem to change regardless of what code I run.

The code I am running at the moment while trying to work out how to use the LCD is as follows

//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#if defined(ARDUINO) && ARDUINO >= 100
#define printByte(args)  write(args);
#else
#define printByte(args)  print(args,BYTE);
#endif

uint8_t bell[8]  = {0x4,0xe,0xe,0xe,0x1f,0x0,0x4};
uint8_t note[8]  = {0x2,0x3,0x2,0xe,0x1e,0xc,0x0};
uint8_t clock[8] = {0x0,0xe,0x15,0x17,0x11,0xe,0x0};
uint8_t heart[8] = {0x0,0xa,0x1f,0x1f,0xe,0x4,0x0};
uint8_t duck[8]  = {0x0,0xc,0x1d,0xf,0xf,0x6,0x0};
uint8_t check[8] = {0x0,0x1,0x3,0x16,0x1c,0x8,0x0};
uint8_t cross[8] = {0x0,0x1b,0xe,0x4,0xe,0x1b,0x0};
uint8_t retarrow[8] = {	0x1,0x1,0x5,0x9,0x1f,0x8,0x4};
  
LiquidCrystal_I2C lcd(0x3f,F0,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd 
  lcd.backlight();
  
  lcd.createChar(0, bell);
  lcd.createChar(1, note);
  lcd.createChar(2, clock);
  lcd.createChar(3, heart);
  lcd.createChar(4, duck);
  lcd.createChar(5, check);
  lcd.createChar(6, cross);
  lcd.createChar(7, retarrow);
  lcd.home();
  
  lcd.print("Hello world...");
  lcd.setCursor(0, 1);
  lcd.print(" i ");
  lcd.printByte(3);
  lcd.print(" arduinos!");
  delay(5000);
  displayKeyCodes();
  
}

// display all keycodes
void displayKeyCodes(void) {
  uint8_t i = 0;
  while (1) {
    lcd.clear();
    lcd.print("Codes 0x"); lcd.print(i, HEX);
    lcd.print("-0x"); lcd.print(i+16, HEX);
    lcd.setCursor(0, 1);
    for (int j=0; j<16; j++) {
      lcd.printByte(i+j);
    }
    i+=16;
    
    delay(4000);
  }
}

void loop()
{

}
]

The address of the LCD is correct because, as I say, it is working other than those 8 positions mentioned.

Any idea what I should do? I have soldered wires to the 4 pins on the ic2 board on the back of the lcd.

Thanks

Please go back and edit your post to get your regular text separated from the code.

You can just cut the first code tag (it’s the word ‘code’ between two square brackets) and then paste it where it belongs.

I haven’t experienced this situation before but I think trying to read regular text inside a code box is worse (due to the required scrolling) than trying to read code that is not in a code box.

You are to be commended for at least trying to use the code tags as many posters do not.

Don

Fixed, sorry I didn't realize it had done that.

The display is working, and is displaying text correctly, however the last 4 positions in rows 3 and 4 are lit up solid white, as in all pixels on. This does not seem to change regardless of what code I run.

That's a sign of a defective display and no change to your code is going to fix it.

If you look at the back of the display you will see five IC's or, more likely five epoxy 'blobs'. One of them, the largest blob, is the HD44780 or equivalent LCD controller chip. It contains the processor, all of the memory, and circuitry to drive 16 of the characters. Each of the other four blobs are auxiliary controllers that can drive another 16 characters. Your fourth blob is defective, or more likely one or more connections to it are defective.

For some background on this check out the LCD Addressing link at http://web.alfredstate.edu/weimandn .

Don