0% found this document useful (0 votes)
82 views3 pages

Experiment 6

This document describes an experiment to interface a liquid crystal display to an Arduino microcontroller. It provides the objectives, equipment needed, syntax, procedures, and questions for the experiment. The procedures involve downloading an LCD library, writing code to initialize the LCD and display text, connecting the LCD to an Arduino, uploading the code, and modifying the code to display a name and ID number on the LCD screen.

Uploaded by

Ken Dulay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views3 pages

Experiment 6

This document describes an experiment to interface a liquid crystal display to an Arduino microcontroller. It provides the objectives, equipment needed, syntax, procedures, and questions for the experiment. The procedures involve downloading an LCD library, writing code to initialize the LCD and display text, connecting the LCD to an Arduino, uploading the code, and modifying the code to display a name and ID number on the LCD screen.

Uploaded by

Ken Dulay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

EXPERIMENT NO.

6
LCD Interfacing

OBJECTIVES:

This exercise aims to create a program that will interface a liquid crystal display to the Arduino
microcontroller.

EQUIPMENTS AND MATERIALS NEEDED:

 Arduino Atmega 168/328 or any Arduino clone boards


 USB Type B cable
 Latest Arduino IDE
 PC work station
 16x2 LCD
 10K ohms potentiometer
 Breadboard
 Connecting wires

SYNTAX:

 lcd.begin() - set up the LCD's number of columns and rows


 lcd.setCursor() – set the cursor to 0,0 (you can change the value of the 2 numbers)
 lcd.noBlink() - Turn off the blinking cursor
 lcd.blink() - Turn on the blinking cursor
 lcd.noDisplay() - Turn off the display
 lcd.display() - Turn on the display
 lcd.noCursor() - Turn off the cursor
 lcd.cursor() - Turn on the cursor
 lcd.println() - output display

PROCEDURES:

1. Download and install the latest LCD library from http://playground.arduino.cc.

2. Write the given program code in the Arduino editor. ( //Ignore the comments )

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins


LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
lcd.begin(16, 2); // set up the LCD's number of columns and rows:
lcd.print("hello, world!");
}
void loop() {

// set the cursor to column 0, line 1


// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);

// print the number of seconds since reset:


lcd.print(millis()/1000);

3. Connect the following circuit.

 LCD RS pin to digital pin 12


 LCD Enable pin to digital pin 11
 LCD D4 pin to digital pin 5
 LCD D5 pin to digital pin 4
 LCD D6 pin to digital pin 3
 LCD D7 pin to digital pin 2
 LCD R/W pin to ground

Connection of Arduino to LCD

4. Verify and upload the program. Make sure to set the correct com port and type of board.

5. Open the serial monitor and check the output.

6. Modify the program so that the LCD will display your name in the first line and your student ID
number in the 2nd line.
SUPPLEMENTARY:

Create a program that will monitor the contrast of your LCD. Make the table below as your
reference for identifying the contrast of LCD.

Voltage level Definition


0 - 255 Too Dark
256 - 800 Normal
801- 1023 Too light

The output on the LCD should look like this:

Voltage level: 1020


Contrast: Too light

QUESTIONS AND PROBLEMS:

1. What is the importance of lcd.begin() ?


2. What is the function of the potentiometer in the circuit? What will happen if you connect it
directly to ground or 5V?
3. What will happen if you uploaded a sketch without the presence of an Arduino? Explain.

You might also like