Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO Controlled LCD Display with Adjustable Contrast

Image of Arduino UNO Controlled LCD Display with Adjustable Contrast

Circuit Documentation

Summary of the Circuit

This circuit is designed to interface an Arduino UNO with a 16x2 LCD display using the LiquidCrystal library. The LCD is used to display text and the number of seconds since the Arduino was reset. A trimmer potentiometer is included to adjust the contrast of the LCD, and a resistor is used to limit the current to the LCD backlight.

Component List

Arduino UNO

  • Microcontroller board based on the ATmega328P
  • It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.

Trimmer Potentiometer

  • A three-legged device with a variable resistance of 10k Ohms
  • Used for adjusting the contrast of the LCD display

Resistor

  • A passive two-terminal electrical component
  • Resistance value of 220 Ohms
  • Limits the current to the LCD backlight

LCD Display (16 pin)

  • A 16x2 character LCD display compatible with the Hitachi HD44780 driver
  • It has 16 pins for various functions including data, control, power, and backlight.

Wiring Details

Arduino UNO

  • 5V and GND pins are used to power the LCD display and the potentiometer.
  • Digital pins D2 to D5 are connected to the data pins DB7 to DB4 of the LCD.
  • Digital pin D11 is connected to the enable (E) pin of the LCD.
  • Digital pin D12 is connected to the register select (RS) pin of the LCD.

Trimmer Potentiometer

  • One side (leg1) is connected to GND.
  • The other side (leg2) is connected to the 5V supply through a resistor.
  • The wiper is connected to the VO pin of the LCD for contrast control.

Resistor

  • One pin is connected to the 5V supply.
  • The other pin is connected to the anode (A) pin of the LCD for backlight.

LCD Display (16 pin)

  • VDD pin is connected to the 5V supply.
  • VSS and K (cathode) pins are connected to GND.
  • RS, E, and DB4 to DB7 are connected to the corresponding Arduino UNO pins for data and control.
  • VO pin is connected to the wiper of the potentiometer for contrast control.
  • A (anode) pin is connected to the 5V supply through a 220 Ohm resistor for backlight.

Documented Code

/*
  LCD Display Tutorial

  This Arduino sketch demonstrates how to use a 16x2 LCD display with the LiquidCrystal library.
  The LiquidCrystal library works with all LCD displays that are compatible with the
  Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the
  16-pin interface.

  Circuit Configuration:
  - LCD RS pin to Arduino digital pin 12
  - LCD Enable pin to Arduino digital pin 11
  - LCD D4 pin to Arduino digital pin 5
  - LCD D5 pin to Arduino digital pin 4
  - LCD D6 pin to Arduino digital pin 3
  - LCD D7 pin to Arduino digital pin 2
  - LCD R/W pin to ground (write mode)
  - LCD VSS pin to ground
  - LCD VDD pin to 5V
  - LCD VO pin (contrast control) connected to the wiper of a 10K potentiometer
    (other ends of the potentiometer connected to +5V and ground)
  - LCD A (anode) pin to 5V through a 220 Ohm resistor for backlight
  - LCD K (cathode) pin to ground

  The sketch prints "hello, world!" on the first line of the LCD.
  On the second line, it displays the number of seconds since the Arduino was reset.

  Written for educational purposes. Feel free to use and modify.
*/

#include <LiquidCrystal.h>

// Pin assignments for the LCD interface
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  lcd.begin(16, 2); // Initialize LCD (16 columns by 2 rows)
  lcd.print("hello, world!"); // Print a message to the LCD
}

void loop() {
  lcd.setCursor(0, 1); // Move cursor to the second row
  lcd.print(millis() / 1000); // Print elapsed seconds since reset
}

This code initializes the LCD and prints "hello, world!" on the first line. The second line of the LCD displays the number of seconds since the Arduino was reset. The LiquidCrystal library is used to manage the LCD's operations.