Display Hindi or Custom character on LCD 16×2 using Arduino

Earlier we learn how to display English letters or ASCII codes (defined for characters) on LCD 16×2.  But now we will learn how to display Hindi or custom character on LCD 16×2 using Arduino (regional language) like Hindi letters or degree symbol or smiley ☺etc.

Before we begin we first need to understand some concepts

  • First of all we know LCD 16×2 can display 32 characters on the screen but each character space had predefined pixels dimension of 5×8, here 5 refers to vertical lines (5 column) and 8 refers to horizontal lines (8 row).
pixel dimension of LCD 16x2 5x8
Pixel Dimension of LCD 16×2 is 5×8
  • Secondly, there are 8 location presents on LCD controller where a custom character can be stored. That means we can store maximum of 8 characters at a time.
  • To display a custom character we need to design that character on display matrix of 5×8 and to generate a binary or hex code corresponding to that.
  • We need 8 byte code for one custom-character/letter (each byte contains 8 bit). See diagram below to understand it more or visit this URL “https://www.riyas.org/2013/12/online-led-matrix-font-generator-with.html” to generate code for any pattern:

PATTERN CODE GENERATOR

First row makes first byte code i.e. “byte 0” then second row makes second byte i.e. “byte 1”, and so on up for 8 bytes.

This is 5×8 led pattern generator matrix.

LCD pattern generator 5x8
LCD pattern generator matrix 5×8

For first byte, in row 1 all led are marked HIGH that means all are 1’s which makes binary number as “11111” (byte contains 8 bit we will consider them as 0 before the number as this not make any difference). Decimal number of Binary 11111 is 31 and hexadecimal is 1F.

DISPLAY HINDI OR CUSTOM CHARACTER ON LCD 16X2 USING ARDUINO
LCD pattern generator 5×8 First line byte code

Following the same process generate 8 byte code.

For second byte in row 2 only single led is marked that means only that make 1’s, it makes binary number as “00100”.

For third byte in row 3 three led are marked that means three led make 1’s, which makes binary number as “01110”.

For fourth byte 10101

For fifth byte 01101

For sixth byte 00100

For seventh byte 00100

For eighth byte 00000

In short which are marked or high are considered as 1, and which are unmarked or low are consider as 0.

Note: Red dot shows led are ON to generate pattern & white are OFF.

LCD pattern generator 5x8 eight lines byte code
LCD pattern generator 5×8 eight lines byte code
  • After generating binary values, we send address location either 64 or 72 or 80 etc. for first symbol to command register of LCD then we sent bitmap value to the LCD data register to get stored in that space. Similarly other characters can be stored of sizes up to (8 bytes). Location of next space is apart by 8-byte space.

ARDUINO PROGRAMMING CODE : DISPLAY HINDI OR CUSTOM CHARACTER ON LCD 16X2 USING ARDUINO

The symbol locations with their base addresses are given below:

#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

// generating hindi ‘क’ using hexadecimal value
byte hindi_k[8] = {
  0x1F, 0x04, 0x0E, 0x15, 0x0D, 0x04, 0x04, 0x00,
};

// generating smiley using binary value
byte smiley[8] = {
  B00000,
  B10001,
  B00000,
  B00000,
  B10001,
  B01110,
  B00000,
};

void setup( ) {

  /* It is important to use createChar() first before lcd.begin() then only it will work properly*/
  lcd.createChar(0, hindi_k);
  lcd.createChar(1, smiley);

  lcd.begin(16, 2);
  lcd.write(byte(0));
  lcd.write(byte(1));
  delay(1000);
}

void loop( ) {

}

OUTPUT

DISPLAY HINDI OR CUSTOM CHARACTER ON LCD 16X2 USING ARDUINO

 

READ NEXT : 4 BIT MODE & 8 BIT MODE OF LCD 16×2

 

Total Visits: 997
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Translate »
0
Would love your thoughts, please comment.x
()
x