I2C LCD-Display - Performance [Solved]

Hello, I would like to use a LCD-Display and control it with I2C. So I bought a 1604 device which consists obviously of the display itself and an attached I2C port expander MCP23008.

It took me some time to find a (at least working) library for it here:


and so far it works, but the performance is unacceptable slow:

If I run this snippet, in notice an interval of 240 ms just to display "hello, word". And if I send it twice, it also exacly doubles the 240 ms to 480 ms. This means the sketch is blocked for this interval and it seems to me inappropriate high.

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  int oldMillis = millis();
  lcd.print("hello, world!");
  int newMillis = millis();
  Serial.print(newMillis - oldMillis);

I really cannot believe that I2C is that slow. I have the strong suspicion, that the library in combination with the I2C port expander MCP23008 might cause the problem. But my knowledge and understanding is not deep enough to analize this in detail. I know, I could tune the I2C-Bus Speed from 100kHz to 400kHz, and I already tried to do so, yes, improves the situation significantly, but in this case I would consider this as a workaround, I think I would rather spend the 10 or more pins and attach the display directly.

But now my questions: Did I buy an unsuitable hardware for my purpose ? Is there a chance to find a library with faster performance ? If not, is there a different LCD 1604 / 2004 that working different in principle ? (I think of maybe buffering the received string first before putting it to the display)

If someone has an idea of which hardware to use or features I should look for, this would be very appreciated.

Best reagrds and thank you in advance.


I really cannot believe that I2C is that slow.

Don't blame the bus for that. The MCP23008 is just a I2C GPIO expander, so you set IO pins by submitting commands by I2C. The library uses the 4-pin interface so to set one character on the LCD it uses about 16 emulated "pinMode/digitalWrite" calls. Everyone of these calls transmits about 7 bytes on I2C, makes about 2000 bits to transfer for one character. A "hello, world" are 11 characters, which results in about 220ms in the ideal case (no processor time used), so the 240ms are a really good value.

There are other I2C based displays that include a microprocessor (often a ATtiny or a PIC), these are much faster because you only have to transfer the real data (plus a little bit overhead) and the embedded processor takes care of setting the output pins according to the Hitachi chip protocol. These modules are obviously much faster.

Hy Pylon,

thank you for the clear statement, your answer shows very clear to me, that the data-transfer requires much more effort than I thought. I will now try to get a hardware more suitable like you purposed, or maybe try to use the SPI which should be much faster.

Thank you one more time and best regards.


Hi Christoph1968,

I have a 16X4 Display with a "elecfreaks" iic/spi module. I suppose the same device as you, and I tried to use the same library as you use. But the device don't work. Can you put in the forum an simple example of "hello world"?


I will now try to get a hardware more suitable like you purposed, or maybe try to use the SPI which should be much faster.

You don't have to use SPI to get more speed. Just as an example I show you a project where I helped a bit with the software. It uses an ATtiny to control the LCD hardware and listens on the I2C bus for commands. It transfers just the necessary information, so it's much faster than the hard-/software combo you used.