Arduino talking to an I2C LCD display

I had a spare Matrix Orbital 20×4 character LCD floating about so I decided to try and connect it up to my Arduino. The display is a LK204-25, which is a brilliant little serial display, with support for a 25 button keypad and six outputs that can be used to control power to something else.

Being a serial display, I could just write to it from my Arduino using the serial interface, but that would mean that I lose the ability to communicate with my Arduino from my computer over serial. Fortunately the display also supports I2C as an interface (some similar, but newer, models also contain a 1-wire interface and a temperature sensor built in).

It turns out that getting the display to work with my Aruino Uni, using I2C is rather trivial. The display needs power, that is easy enough, and then there are just two wires to connect from the Arduino – Analog pin 4 for is SDA, analog pin 5 is SCL. Connect those two up to the display (the display docs show which pins SDA and SCL are) and you are ready to write the code to control it.

It turns out that I2C has fantastic support in Arduino, Wire.h contains all you need. The code below will read a character from the serial connection from your computer and write it to the display. Easy, eh?

// Note the space after the . in the imports below - This blog seems to object to not having it there
#include < wire.h>
// default MatrixOrbital lcd address (0x5C) converted from 8bit to 7bit
#define LCD (0x2E) 
void setup() {
  // Initialise display with clear command
void loop() {
  if (Serial.available() > 0) {
    char c =;

About Anton Piatek

Professional bit herder, amateur photographer. Linux and tech geek
This entry was posted in Arduino, Programming, Technology and tagged , , , , , , , . Bookmark the permalink.

4 Responses to Arduino talking to an I2C LCD display

  1. Pingback: Blog » Blog Archive » Arduino talking to an I2C LCD display

  2. Dave says:

    Hi, I have the exact same lcd module LK204-25 USB, do you have any diagrams or pictures of where on the module I would connect the ardunio pins 4 and 5 to? i am confused as the lcd manual ( [Page 15]) states in order to communicate via I2C you must first ensure that pull up resistors, with a nominal value of 1K to 10K, are placed on the SCL and SDA communication lines coming from pins two and three of the Data / Power Connector respectively. Many thanks

  3. Anton Piatek says:

    I must admit, I missed that bit about adding a resistor. I suspect the logic is that a 1k to 10k resistor will limit the current going in to your display. Not a bad idea, but I doubt an arduino can deliver enough current to cause issues.

    The pins on the display are as follows (pin 1 is closest to the serial/usb port):
    1. +V, +5v (or 9-12v depending on the model)
    2. SCL clock – connect to pin A5 on the Uno
    3. SDA data – connect to pin A4 on the Uno
    4. Gnd

    Hope that helps

  4. Dale says:

    The resistors are for pull-up to +V.

    IIC devices use open-collector-ish outputs (float open for logic 1, pull down to ~Vss for logic 0), and the devices do not have pull-ups. That’s so you can have any (reasonable) number of devices on the bus. (If every device had pull-ups, you’d get to some number of devices and then the outputs of the devices couldn’t pull the line down to a logic 0.)

    So there is always ONE pull-up for SDA and ONE pull-up for SCL, external to all the devices, and they cover all the deivces on the bus.

    I usually see this in Freescale MCU demo board schematics as being 10k, always to +V. That’s what I used in STA013$ interface for playing MP3 files, and it works flawlessly.

    Hope the above was helpful (and correct! — let me know if not!)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.