< All Topics
Print

Interfacing the 2004 LCD Screen with an Arduino Uno

Introduction

The aim of this project is to interface a 2004 LCD screen with an Arduino Uno. This enables the user to program the Arduino Uno and display text and symbols on the LCD screen.

Materials:

  • PC with Arduino IDE (2.3.2) installed
  • 2004 LCD display
  • Arduino Uno or Mega microcontroller
  • Male to Female Jumper cables
  • 5V USB cable for power

About the 2004 LCD screen

The LCD 2004, also known as the 2004 character-type liquid crystal display, is a dot matrix module designed to showcase letters, numbers, and characters. Its model number, 2004, signifies its capacity to display 4 lines of 20 characters. 

The 2004 LCD screen traditionally uses the SPI communication protocol, but the variant used for this project can use I2C, reducing the number of pins that need to be used.

Click to expand
 Power Connections:

Wire the VCC pin of the LCD Screen to the Arduino Mega 5V Power pin. Connect the GND pin of the screen to an available GND pin on the Arduino Mega.

Communication:

Wire the SCL pin of the LCD Screen to pin A5 and wire the SDA pin of the LCD Screen to the Arduino Mega’s pin A4.

The image below shows the wiring diagram for the Arduino Mega and the 2004 LCD screen.

Click to expand

Libraries and Setup

Libraries:
We will first install libraries for the 2004 LCD Module. They can be downloaded here.

This will download a .zip file with the library for the 2004A LCD display.
Then, open up the Arduino IDE and go to Sketch > Include Library > Add .ZIP Library, and browse for the downloaded library on the system, select to install.
Once the library has been successfully installed, we will load the following code shown below. 

Code

/*# AUTHOR: Nisheli P For MakerBotics
# VERSION: 1
# PURPOSE: Display Data on the 20×4 LCD Display using an Arduino Mega
# License details: Attribution-ShareAlike 4.0 International CC BY-SA 4.0 Deed
*/

 

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);  //The address could be either 0x27 or 0x3C.
 
 
void setup() {
  lcd.init();                 //Initialise the LCD
  lcd.backlight();            //Activate backlight    
  lcd.home();  
}
void loop() {
  lcd.setCursor(0,0);
  lcd.print(”  2004 LCD  “);
  lcd.setCursor(0,1);
  lcd.print(”  POWERED BY”);
  lcd.setCursor(0,2);
  lcd.print(“MAKERBOTICS PTY LTD”);
  lcd.setCursor(0,3);
  lcd.print(“MAKERBOTICS.COM”);
  lcd.display();
}

End Result

Upload the code to the Arduino Microcontroller and a successful compilation and running of the code is displayed below:

Click to expand

Downloadable Content

Please find this tutorial’s code on our GitHub page.

Credits

  • Maker Community
  • The Arduino Community
  • The STEM Community
Table of Contents