0% found this document useful (0 votes)
12 views7 pages

090 PostLab3

The document outlines an experiment on interfacing an LCD 16x2 display with an Arduino UNO, detailing the necessary connections and providing sample Arduino code. It includes instructions for displaying custom characters on the LCD and a connection diagram. Reference materials and a completed post-lab exercise are also provided.

Uploaded by

premjoshi.int
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)
12 views7 pages

090 PostLab3

The document outlines an experiment on interfacing an LCD 16x2 display with an Arduino UNO, detailing the necessary connections and providing sample Arduino code. It includes instructions for displaying custom characters on the LCD and a connection diagram. Reference materials and a completed post-lab exercise are also provided.

Uploaded by

premjoshi.int
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/ 7

Marwadi University

Faculty of Engineering & Technology


Department of Information and Communication Technology
Subject: Foundation skills in
Aim: LCD Display Interfacing with Arduino UNO
sensor interfacing (01CT1103)
Experiment No: 03 Date: 31Aug’24 Enrollment No: 132261

Aim: LCD Display Interfacing with Arduino UNO

IDE:

Introduction

LCDs (Liquid Crystal Displays) are used in embedded system applications for displaying various parameters
and status of the system.
LCD 16x2 is a 16-pin device that has 2 rows that can accommodate 16 characters each.
LCD 16x2 can be used in 4-bit mode or 8-bit mode.
It is also possible to create custom characters.
It has 8 data lines and 3 control lines that can be used for control purposes.
For more information about LCD 16x2 and how to use it, refer the topic LCD 16x2 module in the sensors and
modules section.
Marwadi University
Faculty of Engineering & Technology
Department of Information and Communication Technology
Subject: Foundation skills in
Aim: LCD Display Interfacing with Arduino UNO
sensor interfacing (01CT1103)
Experiment No: 03 Date: 31Aug’24 Enrollment No: 132261

Connection Diagram of LCD16x2 with Arduino

To wire your LCD screen to your board, connect the following pins:
 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 GND
 LCD VSS pin to GND
 LCD VCC pin to 5V
Marwadi University
Faculty of Engineering & Technology
Department of Information and Communication Technology
Subject: Foundation skills in
Aim: LCD Display Interfacing with Arduino UNO
sensor interfacing (01CT1103)
Experiment No: 03 Date: 31Aug’24 Enrollment No: 132261

 LCD LED+ to 5V through a 220 ohm resistor


 LCD LED- to GND

Arduino Code:
#include <LiquidCrystal.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a message to the LCD.

void loop() {

lcd.setCursor(0,0);

lcd.print("ICT");

lcd.setCursor(2,1);

lcd.print("Department");

}Post Lab Exercise:

1. To display custom characters on the LCD

Reference Material:
https://lastminuteengineers.com/arduino-1602-character-lcd-tutorial/
Marwadi University
Faculty of Engineering & Technology
Department of Information and Communication Technology
Subject: Foundation skills in
Aim: LCD Display Interfacing with Arduino UNO
sensor interfacing (01CT1103)
Experiment No: 03 Date: 31Aug’24 Enrollment No: 132261

Completed Post Lab Exercise

Fig 1: Circuit Diagram

//090-PostLab3-Code
// include the library code:
#include <LiquidCrystal.h>

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


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

//Code for custom characters. Each 'byte here represents 1 cell of


// the 16x2 LCD. The code within with 0s and 1s is used to turn individual
// pixels in the cell on or off. This is how we get custom characters.
byte Moon[8] = {
0b01110,
0b11100,
0b11000,
0b11000,
0b11000,
0b11000,
0b11100,
0b01110
};

byte Swastik[8] = {
0b00000,
0b10111,
0b10100,
Marwadi University
Faculty of Engineering & Technology
Department of Information and Communication Technology
Subject: Foundation skills in
Aim: LCD Display Interfacing with Arduino UNO
sensor interfacing (01CT1103)
Experiment No: 03 Date: 31Aug’24 Enrollment No: 132261

0b11111,
0b00101,
0b11101,
0b00000,
0b00000
};

byte Om[8] = {
0b00000,
0b00010,
0b11011,
0b01000,
0b11110,
0b01010,
0b11011,
0b00000
};

byte Tree[8] = {
0b00000,
0b01110,
0b11111,
0b11111,
0b01110,
0b00100,
0b01110,
0b00000
};

byte Android[8] = {
0b01010,
0b01110,
0b10001,
0b11011,
0b10001,
0b10001,
0b11111,
0b01010
};

byte Dumbbell[8] = {
0b00000,
0b00000,
0b10001,
0b11111,
0b10001,
0b00000,
Marwadi University
Faculty of Engineering & Technology
Department of Information and Communication Technology
Subject: Foundation skills in
Aim: LCD Display Interfacing with Arduino UNO
sensor interfacing (01CT1103)
Experiment No: 03 Date: 31Aug’24 Enrollment No: 132261

0b00000,
0b00000
};

byte Pyramid[8] = {
0b00000,
0b00000,
0b00000,
0b00100,
0b01110,
0b11111,
0b00000,
0b00000
};

byte Dollar[8] = {
0b00000,
0b00100,
0b01110,
0b01000,
0b00100,
0b00010,
0b01110,
0b00100
};

void setup()
{
// initialize LCD and set up the number of columns and rows:
lcd.begin(16, 2);
// Clears the LCD screen
lcd.clear();
// Print to the first row of the lcd.
lcd.print("CustomCharacters");

// create custom character 1


lcd.createChar(0, Moon);
// create custom character 2
lcd.createChar(1, Swastik);
// create custom character 3
lcd.createChar(2, Om);
// create custom character 4
lcd.createChar(3, Tree);
// create custom character 5
lcd.createChar(4, Android);
Marwadi University
Faculty of Engineering & Technology
Department of Information and Communication Technology
Subject: Foundation skills in
Aim: LCD Display Interfacing with Arduino UNO
sensor interfacing (01CT1103)
Experiment No: 03 Date: 31Aug’24 Enrollment No: 132261

// create custom character 6


lcd.createChar(5, Dumbbell);
// create custom character 7
lcd.createChar(6, Pyramid);
// create custom character 8
lcd.createChar(7, Dollar);
}

// Print All the custom characters


void loop()
{
lcd.setCursor(0, 1);
lcd.write(byte(0));

lcd.setCursor(2, 1);
lcd.write(byte(1));

lcd.setCursor(4, 1);
lcd.write(byte(2));

lcd.setCursor(6, 1);
lcd.write(byte(3));

lcd.setCursor(8, 1);
lcd.write(byte(4));

lcd.setCursor(10, 1);
lcd.write(byte(5));

lcd.setCursor(12, 1);
lcd.write(byte(6));

lcd.setCursor(14, 1);
lcd.write(byte(7));
}

You might also like