0% found this document useful (0 votes)
10 views

LCD

Uploaded by

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

LCD

Uploaded by

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

Activity 1: Displaying Text on an LCD with I2C

Objective:

Students will learn how to connect an LCD display with I2C to an Arduino and program it to
display text.

Materials Needed:

• Arduino board (e.g., Arduino Uno)

• I2C LCD module (e.g., 16x2 LCD with I2C backpack)

• Breadboard and jumper wires

• Computer with Arduino IDE installed if or use TINKERCAD

• USB cable to connect Arduino to the computer

Instructions:

1. Understanding I2C:

o Briefly explain the I2C protocol (Inter-Integrated Circuit), highlighting its


advantages like reduced wiring and multiple device communication.

2. Wiring the Components:

o Show students how to connect the I2C LCD to the Arduino:

▪ Connect VCC on the LCD to 5V on the Arduino.

▪ Connect GND on the LCD to GND on the Arduino.

▪ Connect SDA on the LCD to A4 on the Arduino (for Uno).

▪ Connect SCL on the LCD to A5 on the Arduino.

3. Installing Libraries:

o Guide students to install the necessary libraries in the Arduino IDE:

▪ Open the Arduino IDE.

▪ Go to Sketch > Include Library > Manage Libraries.

▪ Search for and install the "LiquidCrystal I2C" library.

4. Writing the Code:

o Provide students with a simple code template to display text on the LCD:
#include <Wire.h>

#include <LiquidCrystal_I2C.h>

// Set the LCD address (0x27 is common, but check your module)

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {

// Initialize the LCD

lcd.begin();

// Turn on the backlight

lcd.backlight();

// Print a message to the LCD

lcd.setCursor(0, 0); // Set cursor to first row, first column

lcd.print("Hello, World!");

lcd.setCursor(0, 1); // Set cursor to second row, first column

lcd.print("I2C LCD Test");

void loop() {

// Nothing to do here

}
Uploading the Code:

• Instruct students to connect their Arduino to the computer using the USB cable.

• Select the correct board and port from the Tools menu in the Arduino IDE.

• Click the upload button to upload the code to the Arduino.

Testing:

• Once the code is uploaded, students should see "Hello, World!" on the first line and
"I2C LCD Test" on the second line of the LCD.

You might also like