John L Errington MSc

John Errington's Experiments with an Arduino

Using the I2C LCD display

LCD Displays

An LCD display is a great way of presenting measurements, but its also useful for printing out debugging information while you are developing a sketch.

I2C or parallel

If you want to use an LCD display, you can choose to drive it directly from the parallel bus ( digital i/o pins), or use the I2C bus.

The parallel bus gives good flexibility, but ties up at least six of the digital pins; so I chose to use a display that includes an adaptor board to allow it to run using the I2C bus.

I used this 2*16 LCD display

You will also need to get the library which is linked on the same page. Its important to get the right one!

You can also get a 20*4 IIC display if you need more characters.

The Wiki here gives more information.

Connections

The I2C bus uses only two wires (Serial Data SDA and Serial clock SCL) , plus ground - and you also need the supply voltage for the display, so that's 4 wires in all. Note the connections for I2C are different - as follows - on different versions of the Arduino board.

Edit the library

There is an issue with the lcd.write() function in the library; when you use write it only prints one character to the screen, (as described here) because the lcd.print function incorrectly returns a value of 0 - which indicates a write error.

You need to rename or delete the old "LiquidCrystal" library and copy the new library folder to your libaries folder as described here

You must then edit LiquidCrystal_I2C.cpp in the library at this point:

#define printIIC(args) Wire.write(args)
inline size_t LiquidCrystal_I2C::write(uint8_t value) {
send(value, Rs);
return 0; // change this to read return 1;

The print function then works correctly.