In my previous project I’ve directly connected a 16×2 LCD display to the Arduino UNO. Although this setup is rather simple, it requires 6 output pins which could be a disadvantage if one wants to build larger projects. Fortunately, an unofficial Arduino LiquidCrystal library was made available, supporting 4 different ways to connect a LCD. The new LiquidCrystal library allows using a M74HC595 shift register for sending data to the display, which reduces the number of required pins to three.
For installation, first backup the original LCD library which is located within the libraries subdirectory of your Arduino folder (under Linux: /opt/arduino-1.0.5/libraries/LiquidCrystal). Next, download and unzip the new LiquidCrystal library from here. Move the LiquidCrystal subfolder from the archive into your /home/user/arduino/sketchbook/libraries folder. Create a new folder if the libraries subdirectory doesn’t exist in your sketchbook folder, yet. The new library should become visible in the File -> Import Library … menu if it installed correctly. Since the new library is fully compatible with the original LiquidCrystal, you can still compile your old sketches without changes.
The LCD should be connected to the shift register M74HC595 as shown in the wiring diagram below. In contrast to my previous project, the six wires of the LCD formerly connected to the Arduino UNO pins are now attached to the shift register, and the SER(14), SCK(11), and RCK(12) pins of the shift register are connected to the digital pins 2 (DATA), 3 (CLOCK) and 4 (LATCH) of the Arduino Uno. If you want to use other pins, the sketch below must be modified accordingly. Note that you can safely disable all “Serial” commands in the sketch, in case that you don’t want serial output to your computer.