SOLVED: How to wire an mjkdz I2C board to a 20 x 4 LCD

Sometimes cheap is fine :wink:

There are two versions (at least) of the mjkdz board. The one you have is the 22 turn trimmer and has address 0x20 by default. The other one has a single turn pot and is 0x27 by default. I have both and have worked through connection issues just like you.

First, download the New Liquid Crystal library - https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads

Make sure you remove the existing standard LiquidCrystal and LiquidCrystal_I2C libraries. Don't just rename them, you have to remove them from the 'libraries' folder completely or there will be a conflict.

If your LCD connections are (Left to Right) - VSS, VDD, VO, RS, RW, E, D0, D1, D2, D3, D4, D5, D6, D7, A (or LED+), K (or LED-) then the connection goes to the following bits on the I2C chip

RS - 6
RW - 5
E - 4
D4 - 0
D5 - 1
D6 - 2
D7 - 3
Backlight - 7

This makes your constructor 4,5,6,0,1,2,3,7 so use the following example sketch:-

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

#define lcdAddr 0x20 // set the address of the I2C device the LCD is connected to

// create an lcd instance with correct constructor for how the lcd is wired to the I2C chip
LiquidCrystal_I2C lcd(lcdAdrr, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE); // addr, EN, RW, RS, D4, D5, D6, D7, Backlight, POLARITY

// Creat a set of new characters
const uint8_t charBitmap[][8] = {
   { 0xc, 0x12, 0x12, 0xc, 0, 0, 0, 0 },
   { 0x6, 0x9, 0x9, 0x6, 0, 0, 0, 0 },
   { 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0, 0x0 },
   { 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0, 0x0 },
   { 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0x0 },
   { 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0x0 },
   { 0x0, 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0x0 },
   { 0x0, 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0x0 }
   
};

void setup()
{
   int charBitmapSize = (sizeof(charBitmap ) / sizeof (charBitmap[0]));

  lcd.begin(20,4);  // initialize the lcd as 20x4 (16,2 for 16x2)
  
  lcd.setBacklight(1); // switch on the backlight

  for ( int i = 0; i < charBitmapSize; i++ )
   {
      lcd.createChar ( i, (uint8_t *)charBitmap[i] );
   }

  lcd.home ();  // go home to character 0 on line 0 (1st line)
  lcd.print("Hello, ARDUINO ");  
  lcd.setCursor(0,1);  // character 0 on line 1 (2nd line)
  lcd.print (" FORUM - fm   ");
  lcd.setCursor(0,2) // character 0 on line 2 (3rd line)
  lcd.print("This is line 3");
  lcd.setCursor(0,3) // character 0 on line 3 (4th line)
  lcd.print("This is line 3");
  delay(1000);
}

void loop()
{
   lcd.clear()
   lcd.home ();
   // Do a little animation by writing to the same location
   for ( int i = 0; i < 2; i++ )
   {
      for ( int j = 0; j < 16; j++ )
      {
         lcd.print (char(random(7)));
      }
      lcd.setCursor ( 0, 1 );
   }
   delay (200);
}

I've just modified that on the fly (mine are 16x2 LCD's) so hopefully it will work straight off for you. If not then look on it as a learning exercise to fix it, now you have the example :wink: