Search Here

INTERFACING LCD WITH AN ARDUINO UNO


INTERFACING LCD WITH AN ARDUINO UNO

In this article the functioning of the LCD connected to an ARDUINO UNO is briefly discussed.

            Basically the LCD is commonly known as Liquid Crystal Display. It is used to have the digital interface with the electronic environment through its display screen. The output of the processed information can be seen and can be read by the human easily with this LCD module.

16*2 LCD screen contain about 16 pins out of which 8 pins are the data pins (pins from 7 to 14) and there are about two pins (1 and 16) for VCC and GROUND. Three Pins are used to control the functioning and operations of LCD (pins 4,5,6) and pin 3 is used to adjust the brightness of the LCD screen. The left over pins 15 and 16 are used to power the LCD.


The complete pin out diagram of LCD screen where each and every pin is shown in detail. The Pins are mentioned with complete name and position.


CONNECTING THE SENSOR WITH ARDUINO

This 16*2 LCD screen can be used in 8 bit mode or 4 bit mode to display the various parameters.

All the 16 pins are connected to the ARDUINO board in the following way
 
Ø   Initially VCC and the LED+ pins are connected to the positive terminal of the battery to supply the power to the board.
 
Ø   VSS and the LED- pins are short circuited and connected to the GROUND terminal to complete the circuit for the power supply. These LED terminals 
are mainly used to supply the power to the LCD and switch the LED lights to ON position that are present in the LCD screen display.
 
Ø   Now the 8 data pins starting from D0 to D7 are connected to the digital pins on the ARDUINO board starting from 10 to 3 as shown in the circuit diagram
 
Ø   Finally the ENABLE, READ/WRITE and the REGISTER SELECT pins are connected to the 11, 12 and 13 numbered digital pins on the ARDUINO board. The left over VEE pin is connected to the GROUND terminal.
 
Ø   The terminals from the LCD screen to the ARDUINO board are connected using different kind of Jumper Wires.

This completes the entire connection of the LCD screen to the ARDUINO board for the functioning of it.

The entire explanation is done with regarding to the circuit diagram shown below.

Once the complete connection of the component to the ARDUINO is done perfectly without any error the entire software coding can be done easily without any sort of issues.


ARDUINO PROGRAM OF  LCD SCREEN

 

 

#include <LiquidCrystal.h>

/* Create object named lcd of the class LiquidCrystal */

LiquidCrystal lcd(13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3); /* For 8-bit mode */

//LiquidCrystal lcd(13, 12, 11, 6, 5, 4, 3);       /* For 4-bit mode */

 

 

 

unsigned char Character1[8] = { 0x04, 0x1F, 0x11, 0x11, 0x1F, 0x1F, 0x1F, 0x1F };            /* Custom Character 1 */

unsigned char Character2[8] = { 0x01, 0x03, 0x07, 0x1F, 0x1F, 0x07, 0x03, 0x01 };            /* Custom Character 2 */

 

void setup() {

  lcd.begin(16,2);    /* Initialize 16x2 LCD */

  lcd.clear();  /* Clear the LCD */

  lcd.createChar(0, Character1);            /* Generate custom character */

  lcd.createChar(1, Character2);

}

 

void loop() {

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

  lcd.print("Hello!!!!");      /* Print data on display */

  lcd.setCursor(0,1); 

  lcd.write(byte(0));           /* Write a character to display */

  lcd.write(1);

}

 

After the successful compiling of the code it is dumped into the ARDUINO board.

Now the code runs and display on the LCD screen.


EXPLAINATION OF THE PROGRAM

Initially Liquid Crystal Libraries are included in the program then the pins that are connected to the 8 bit display are mentioned in the code.

Now the custom characters are defined to use them on them on the LCD.

In the Void setup function is declared and the following things are mentioned.

·        lcd.begin function is used to initialize the LCD screen of 16*2.

·        lcd.clear function is used to clear the LCD screen.

·        lcd.createChar are used to create the characters that are to be displayed. 

Now the Void Loop function is declared where entire code is written. The functions used in this void loop are

·        lcd.setCursor function is used to set the cursor on to the LCD screen.

·        lcd.print is used to print the output on the LCD screen.

·        Lcd.write function is used to display the custom character on the LCD screen.

 

FUNCTIONING OF LCD DISPLAY

After the complete connection and dumping of the code to the ARDUINO board the LCD screen display functions in the following way

Initially the entire LCD screen clears and only the backlight is visible then the message “Hello!!!!” is displayed on the LCD screen.

Next the cursor sets to the next column and the initiated custom character or the written character displays on the screen of the LCD.

This completes the entire explanation of the code and this process continues till there is a break in the loop.

 

CONCLUSION

The above discussed program and the connections are the basics to start with the LCD screen interfacing with the ARDUINO and how it can be used to display the output messages or the parameters. This article helps to be the start guide for the working on the LCD display and any sort of the common mistakes that are evolved while interfacing the components or the functioning of the code can be easily overcome by following the detailed explanation mentioned in this article.

Moreover further assistance to work on various components are going to be published in the website soon.

For any doubts or queries can mention them in the comment box.




More Posts

Compact Fluorescent Lamp Circuit (CFL)

Arduino UNO

SMD Register coding

Thermoelectric Generators AKA Peltier Modules

Capacitors

PN Junction Diode

Introduction To Raspberry Pi

Gas sensor

What Are Resistors?

INTERFACING OF ARDUINO WITH ULTRASONIC SENSOR

Archived