You are on page 1of 6

Southern Luzon State

University Lucena Campus


Lucena City

Activity #7

LIQUID CRYSTAL DISPLAY WITH


I2C

Name: Adrian Naiza Group No:

Yr. & Sec: BTVTED-CP3

Date Performed: November 14, 2023

Date Submitted: November 14, 2023

RATING
I. INTRODUCTION

A flat panel called a Liquid Crystal Display (LCD) is used to show users text and other ASCII
symbols. The LCD display created especially for the Arduino typically has a 16x2 display. In other
words, the character limit is 16 characters wide by 2 characters high. i.e., 16 columns and 2 rows of
alphabetic or numeric characters.

They employ two sheets of polarizing material with a liquid crystal solution in between them,
thus the term liquid crystal display, and function in a manner similar to an LCD screen- like TV
(before the advent of LED TVs). Liquid moves the crystals as electricity travels across it, blocking
some of the screen's pixels from receiving light.

II. OBJECTIVE

The basic concepts of connecting an LCD screen to an Arduino Uno are covered in this project.
This experiment may also be used in a variety of applications where the learner expects to see a
visual reaction to data that has been supplied and processed by a microcontroller, in this example an
Arduino Uno.

III. MATERIALS NEEDED


-1pc Arduino Uno
-1pc USB cable
-1pc 16x2 LCD with I2C
-Connecting wires

IV. PROCEDURE
1. Connect the USB cable to your laptop.
2. Connect the I2C to Arduino. The table below shows where the pins of the I2C should be
connected.

Table 1. Connection of I2C to Arduino Board


I2C pin Arduino board
GND Ground
VCC 5V
SDA Analog Pin 4
SCL Analog Pin 5

Figure 1. The actual connection of HC-SR04 in Arduino Uno

42 | P a g e
Another way to install library in Arduino IDE
3. Launch the browser and type "LCD with I2C library" into your search engine and search for the
library of Liquid Crystal. You may also go directly to the link
https://www.arduino.cc/reference/en/libraries/liquidcrystal-i2c/ and download the most recent
library version.

4. Double-click the Arduino application in the Arduino Folder to launch the Arduino IDE.
5. Install the I2C LCD library. Go to Sketch > Include Library > Add .ZIP Library.
6. You will see a window after clicking Add .ZIP Library. Go to your Downloads folder, click
LiquidCrystal_I2C-1.1.2.zip, and click open.

7. You can now see the I2C LCD library in the Examples folder. Click Examples >
LiquidCrystal I2C > HelloWorld.

43 | P a g e
8. Click the Upload icon to upload your sketch or you may press Ctrl + U.
9. You will see at the bottom left of the IDE if the sketch was successfully uploaded.
10. The expected output is shown below.
Hello, World!
Ywrobot Arduin

TEST OUTPUT

V. GUIDE QUESTION
1. What will display in LCD if the setCursor is (4,4)? What causes it, in your opinion?

From what I observe in the activity, If I set the cursor position on the LCD to (4,4), nothing will
display, and the text won't be visible. This is because the LCD in the code is initialized as a 16x2
display (LCD (0x27, 16, 2)), which means it has 16 columns and 2 rows. Setting the cursor to (4,4)
is beyond the dimensions of the display. The valid cursor positions for this setup range from (0,0)
to (15,1) for columns and rows, respectively. If the cursor is set outside these bounds, it won't show
any text on the screen

44 | P a g e
2. Describe what will happen if you remove the lcd.init() function? What do you think the
purpose it?

Based from the activity, If I remove the lcd.init() function, the LCD may not work correctly. This
function is crucial for setting up the LCD, ensuring it understands and responds to commands
from the Arduino. Without it, the LCD might not display the text or behave as intended

VI. Create your own program.

Write a program that will display your name in the first row and ‘The Great!’ in the second row.

PROGRAM 1
//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,16,2);

void setup()
{
lcd.init();
lcd.init();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Adrian Naiza");
lcd.setCursor(0,1);
lcd.print("The Great!");

void loop()
{
}

PROGRAM 2
//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,16,2);

void setup()
{
lcd.init();
lcd.init();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Alyza Amandy");
lcd.setCursor(0,1);
lcd.print("The Great!");
}
loop()
{delay(500); // Delay for one second
CONCLUSION
lcd.scrollDisplayRight();
}
45 | P a g e
In summary, the key to successfully using an LCD with Arduino lies in meticulous
initialization and control. The pivotal role of the lcd.init() function is to precisely configure
the LCD for communication, guaranteeing its proper functionality. Meanwhile, the
setCursor function determines the position of text or the cursor on the display,
necessitating adherence to the LCD's dimensions for precise rendering. Focusing on
these foundational principles is essential for ensuring the seamless interaction between
Arduino and the LCD, facilitating the accurate presentation of information on the display.

46 | P a g e

You might also like