16x2 Character LCD display with I²C-backpack - HD44780

This LCD can be used to display on-site information from a sensor or from data within an application.

HD44780 character lcd

For circuit, pin and interface specification see this datasheet

Usage
With the I²C-backpack on the display it is possible to interface with the LCD using 8-bits total. This means that the LCD must run in 4-bit mode, how this is accomplished is specified in the datasheet.

Extra information
The I²C-backpack has the following pinlayout

I²C byte: b7 b6 b5 b4 b3 b2 b1 b0
LCD Pins: D7 D6 D5 D4 Backlight E Rw Rs

The Backlight pin directly controls the backlight so in order to keep the backlight on at all times, the backlight-bit should always contain a 1.

In order to clock an instruction into the registers on the display it is necessary to write a value twice on the I²C-bus. First writing the desired value with the E-bit high and then writing the same value again but with the E-bit low (see example below).

//Writing the value 0b00000001 (clear display) to the lcd with the backlight on
bus.write(0x0C); //0x0C <=> 0b00001100, upper 4 databits followed by backlight:on, E:on, Rw: off, Rs: off
bus.write(0x08); //0x08 <=> 0b00001000, upper 4 databits followed by backlight:on, E:off, Rw: off, Rs: off
bus.write(0x1C); //0x1C <=> 0b00011100, lower 4 databits followed by backlight:on, E:on, Rw: off, Rs: off
bus.write(0x18); //0x18 <=> 0b00011000, lower 4 databits followed by backlight:on, E:off, Rw: off, Rs: off

An example library for integrating with the display can be downloaded here

Sample code

console.log("Coming soon");