Arduino LCD Library

There are currently a number of libraries and tutorials available for interfacing the Arduino with a standard HD44780 based LCD module, but they aren't complete and you have to edit the source code to change pin numbers and use a different library for 4bit and 8bit mode.

So I decided to write another. This one lets you set the pin mapping (without modifying the source) and supports both 4bit and 8bit mode. It also supports all documented features of the HD44780 controller including defining custom characters.

The library is licensed under the GNU GPL.

You can always find the latest source code in here.

Latest snapshot can be downloaded here.

The first release 0.1 does not require the RW pin to be connected to the arduino since it does not check the busy flag of the LCD. This is likely less reliable but if you have problems with the latest version you might try this one instead.


You can find a simple schematic in the download package, or here.

Download the source and extract it to the Arduino libraries directory.

$ tar -xzf lcdlib-0.X.tar.gz
$ cp -r lcdlib-0.X /path/to/arduino/hardware/libraries

Getting Started

The best way to get to know the library is to read the header file Lcd.h. I have documented all of the functions and the LCD class rather thoroughly in there. Included with the package is also a README file and a few samples.

Here is a Hello, World! program to get you started with the basics. This sample uses 4pin mode.

 * Simple hello world program in 4 pin mode.
#include <Lcd.h>

// LCD module is 16 columns wide, use 4 pin mode
Lcd lcd = Lcd(16, FUNCTION_4BIT);

char msg[] = "Hello, World!";

void setup()
  // for the sake of demonstration change pin assignment
  lcd.set_ctrl_pins(CTRLPINS(1,2,3)); // RS->1, RW->2, E->3
  lcd.set_data_pins(_4PINS(4,5,6,7)); // D4->4, D5->5, D6->6, D7->7

  lcd.setup();  // setup arduino and initialize LCD

void loop()
  lcd.home();     // return cursor to home possition
  lcd.print(msg); // print the ever so familiar message