Introduction: How to Interface a 16x4 LCD With an Arduino

About: Passionate about MAKING projects based on the Arduino and Raspberry Pi. Keeping things simple yet innovative and very useful. Also delves into gardening vegetables and fruits.

Introduction

I recently received some free LCD samples from my friends at FocusLCDs.com. One of which is a 16x4 LCD; P/N: C164AXBSYLY6WT. It uses a ST7066U controller (see datasheet here) instead of the HD44780 commonly found in LCD shields. I am not so sure if it will work with an Arduino and its libraries, so I wanted to try it out.

Summary of Features

  • Sharper Image, Wider Viewing Angle
  • Driver: ST7066U
  • Yellow Background
  • Y/G Backlight
  • Temperature Range: -20° C to +70° C
  • ROHS Compliant

Step 1: Materials

Gather up the materials listed below:

  1. Arduino (UNO or MEGA)
  2. 16x4 LCD; C164AXBSYLY6WT
  3. Solderless Breadboard
  4. Dupont Jumper Wires
  5. 2.54mm-Pitch Headers
  6. 10k Ohm Potentiometer
  7. Arduino IDE
  8. USB Cable

Step 2: Solder Headers

Solder the header to the LCD module. 16 pins on total. Refer to this image for the pinouts.

Step 3: Wire the Circuit

Wire the circuit as shown; made it with Fritzing. The potentiometer is for varying the backlight.

Step 4: Fire Up Arduino IDE

Fire up your Arduino IDE. Take care to select the correct board i.e. Arduino UNO or MEGA, etc. and select the correct port.

Step 5: Code the Sketch

Type in this sketch in the IDE and upload.

/* This is a sketch to test 16x4 LCD:

* FocusLCD P/N: C164AXBSYLY6WT

*/

#include LiquidCrystal lcd(8,9,4,5,6,7);

void setup() {

lcd.begin(16,4);

lcd.setCursor(0,0);

lcd.print("FocusLCDs.com");

lcd.setCursor(0,1);

lcd.print("The BEST LCDs!");

lcd.setCursor(0,2);

lcd.print("P/N: ");

lcd.setCursor(0,3);

lcd.print("C164AXBSYLY6WT");

}

void loop() {

}

Step 6: View the Result

Congratulations! Your LCD should show something like this.