Interfacing with LK202-25 LCD through I2C

Dear all,

I am trying to interface with the matrix orbital LK202-25 LCD through I2C. So far, no success. I think I have tried pretty much everything possible. Also couldn't find much with google.

I have tried a lot, but following code seems to me the best to apply:

#include <Wire.h>

#define LCD_I2C_WRITE_ADDRESS 0x28  // address is default 0x50, shift bits to the right for Arduino: 0x28

void setup(void) {
    Wire.begin();                                  //  setup I2C
    Serial.begin(9600);                            //  setup serial
    // turn off auto transmission of data in RS232
    Wire.beginTransmission(LCD_I2C_WRITE_ADDRESS);
    Wire.send(254);                               
    Wire.send(160);
    Wire.send(0);    
    Wire.endTransmission();
}
void loop(void)
{
    if (Serial.available() > 0){
        // read the oldest byte in the serial buffer:
            int inByte = Serial.read();
            if (inByte == '1')
            {
              Serial.println("Sending command");
              // write a simple “HELLO” message
              Wire.beginTransmission(LCD_I2C_WRITE_ADDRESS);
              Wire.send(0x48);                        
              Wire.send(0x45);
              Wire.send(0x4C);
              Wire.send(0x4C);
              Wire.send(0x4F);              
              Wire.endTransmission();
              Serial.println("Command Issued");
            }
    }
}

If I send '1', I receive the print commands in the serial box of Arduino, which tells me that the commands are sent. The LCD just does not respond. I don't think pull up resistors are required, I have tried, but as soon as I apply these, the loop hangs and gets stuck at "Sending Command". I use the extended voltage, so I apply 12V supply.

I have succesfully communicated with a devantech relayboard without using pull up resistors, so I doubt I need them as well for the LCD. If I do, what resistor value should I apply, and should I pull up from the 5V arduino, or the 12V supply to the LCD?

I have also soldered the I2C jumpers on the LCD board and removed the RS232 ones from the LCD board. Is there anybody out there which has experience with this LCD and I2C? Thanks in advance!

best regards,

Remco

If I do, what resistor value should I apply

I would always put pull up resistors on the I2C lines. The internal ones are only 30K you need 4K7 pull ups.
If you look at the waveform without pull external ups it looks dreadful despite the fact that it sometimes works.

Hi, thank you for your quick reply. I was aware of the fact that the I2C bus needs to draw current during transactions. As you say only 30K do you mean, 30K so this current will be smaller than when using 4K7 resistors pulling from the seperate power supply?

I tried to use 10K pull ups on the 12V, but then the loop hangs, 10K with 12V is approx. the same as 4K7 with 5V right?

What current is ideal for I2C?, since I use a supply voltage of 12V. Thanks again.

Remco

As you say only 30K do you mean, 30K so this current will be smaller than when using 4K7

Yes it will not pull up as hard.

I tried to use 10K pull ups on the 12V,

Hey if you connect an arduino input to 12v through a pull up you will damage it. 4k7 is the right value for 5V, if your I2C is above or below that value you will have to use a level translator.

What current is ideal for I2C?

It varies but should say in the data sheet 1mA is normally good.

Hi Grumpy_Mike,

Thank you for your advice! I finally got it working. Like Grumpy Mike says and my findings, it seems that some devices can do without strong pull ups, and some don't. For anyone reading this, always apply pull ups for the I2C bus, this to prevent wasting a lot of your time...

Since I am supplying the LCD board with 12V, I applied the 4K7 pull ups and connected them to the 5V supply of the arduino and grounded the arduino with the ground of the LCD board.

Also, the 0x28 address is valid for the Arduino, despite another forum topic which states to forget about the 7 bit address.

Thanks again Mike!

regards,

Remco