Introduction: How to Interface a 16x4 LCD With an Arduino
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:
- Arduino (UNO or MEGA)
- 16x4 LCD; C164AXBSYLY6WT
- Solderless Breadboard
- Dupont Jumper Wires
- 2.54mm-Pitch Headers
- 10k Ohm Potentiometer
- Arduino IDE
- 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.