Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

How To Create Custom Characters On LCD Using Arduino- (Part 5/49)

By Ajish Alfred

The LCD module is the most common output unit in a microcontroller board. It is very effective since it can display messages, values, clock etc. Special kinds of LCD drivers are used to drive the LCD. Two or more of this kind of driver ICs together with the LCD screen forms LCD modules found in embedded systems. The characters displayed in the LCD modules are actually stored in the internal memory locations of those controllers. They are stored in such a way that they exactly resemble the ASCII table. Whenever the microcontrollers send an ASCII value the LCD controllers displays the ASCII character which has been stored corresponding to that value.

The LCD modules can display not only ASCII characters but custom characters also. The user can store the pixel array corresponding to the custom character in an LCD module. The stored custom character can be made to display by sending the corresponding value to the LCD module.The Arduino is an easy prototyping platform in which the hardware is very simple to use and connected with any other circuit. The programing environment is also very easy to start with and has lot of built-in functions for every simple and complex task. The IDE has functions for the LCD interfacing also and among them there are functions which help in creating custom character also. This project demonstrates how it is possible to create the custom characters in an LCD and displaying the same using the Arduino.

 


 

The LCD module has two or more display driver ICs which stores the character pattern to be displayed. Whenever an ASCII value is send to the LCD module the controller loads the corresponding character array and displays it on the LCD screen. To display each character the LCD screen uses 8*5 pixel array in the screen. In the internal memory which all pixels to be turned on for a particular character are stored as 1 and others are kept as 0. An example a character stored in the internal EPROM memory of the common LCD controller HD44780 is shown in the following image;

Character Pattern Stored In EPROM Memory Of LCD Controller HD44780

Fig. 2: Character Pattern Stored In EPROM Memory Of LCD Controller HD44780

The above shown image is the character pattern stored in the internal memory of the LCD controller. The ASCII value for the letter ‘b’ in binary is 0b01100010 and hence the pattern is stored in the location of the memory with the same address. Hence when the microcontroller send the ASCII value of the character ‘b’, the LCD controller loads the character pattern from the same location with the address equal to that ASCII value. The memory where the standard characters are stored is referred to as Character Generator ROM (CGROM). The user cannot write into these locations since it is Read Only Memory (ROM). The LCD controller has another memory block which is a Read Write memory with 64 byte (8*8) storage per location where the user can store their custom characters. The user can write 64 custom characters into this memory referred to as Character Generator RAM (CGRAM).

In this project the Arduino pro-mini board is used which is then programmed with the help of Arduino IDE version 1.0.3 on windows operating system. The image of the Arduino pro-mini board and the Arduino IDE is shown in the following;

Typical Arduino Pro-Mini Board

Fig. 3: Typical Arduino Pro-Mini Board

 

 Arduino IDE Software Window

Fig. 4: Arduino IDE Software Window

Another hardware which can perform the USB to TTL conversion is used to upload the program into the arduino board.

External USB To TTL Converter Board For Programming Arduino And Serial Communication

Fig. 5: External USB to TTL converter board for programming Arduino and serial communication

It is assumed that the reader has gone through the project how to get started with the arduino and done all the things discussed in it. One has to work out the character of the custom character that needs to be displayed in the LCD screen. The custom characters which are displayed in this project are shown in the following image and the section following it explains how to find out the required character pattern for each custom character.

Custom Characters Created In Project On LCD Using Arduino Circuit Setup On Breadboard

Fig. 6: Custom Characters Created in project On LCD Using Arduino Circuit Setup On Breadboard

The LCD uses 8*8 pixel block to display each character and hence one has to assume an 8*5 array and draw the required custom character and find out the required bit pattern. One can work out with the help of the pixel array and binary array as shown in the following image.

8*5 Pixel And Binary Array For Positive Half Cycle For Custom Character

Fig. 7: 8*5 Pixel And Binary Array For Positive Half Cycle For Custom Character

There eight rows R0 to R7 and eight columns C0 to C7. The values in all the rows and columns are now zero since all the pixels are turned off. Which all pixels need to be turned on should be given the value 1 and the rest should be kept as 0. Now read the binary pattern and write the same into the CGRAM to generate the custom character. It is advised to store the character pattern in a character array so that it would be easy to use with the C code. The pixel array and the binary array for the first custom character displayed in the project are shown in the following image;

 8* 5 Pixel And Binary Array For First Custom Character

Fig. 8: 8* 5 Pixel And Binary Array For First Custom Character

The 8 byte long character array for the above shown custom character can be defined in the code as given below;

            {

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b11111

              };

The pixel array and the binary array for the second custom character displayed in the project are shown in the following image;

8*5 Pixel And Binary Array For Second Custom Character Using Arduino

Fig. 9: 8*5 Pixel and Binary Array For Second custom character using Arduino

The 8 byte long character array for the above shown custom character can be defined in the code as given below;

{

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b11111,

                0b11111

              };

The pixel array and the binary array for the third custom character displayed in the project are shown in the following image;

 Pixel And Binary Array For Third Custom Character Using Arduino

Fig. 10: Pixel and Binary Array For Third custom character using Arduino

The 8 byte long character array for the above shown custom character can be defined in the code as given below;

  {

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b11111,

                0b11111,

                0b11111

              };

The pixel array and the binary array for the fourth custom character displayed in the project are shown in the following image;

Pixel and Binary Array For Fourth Custom Character

Fig. 11: Pixel and Binary Array For Fourth custom character

The 8 byte long character array for the above shown custom character can be defined in the code as given below;

              {

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b11111,

                0b11111,

                0b11111,

                0b11111

              };

The pixel array and the binary array for the fifth custom character displayed in the project are shown in the following image;

Pixel And Binary Array For Fifth Custom Character

Fig. 12: Pixel and Binary Array For Fifth custom character

The 8 byte long character array for the above shown custom character can be defined in the code as given below;

              {

                0b00000,

                0b00000,

                0b00000,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111

              };

The pixel array and the binary array for the sixth custom character displayed in the project are shown in the following image;

Pixel And Binary Array For Sixth Custom Character

Fig. 13: Pixel and Binary Array For Sixth custom character

The 8 byte long character array for the above shown custom character can be defined in the code as given below;

              {

                0b00000,

                0b00000,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111

              };

The pixel array and the binary array for the seventh custom character displayed in the project are shown in the following image;

 Pixel And Binary Array For Seventh Custom Character Using Arduino

Fig. 14: Pixel and Binary Array For Seventh custom character using Arduino

The 8 byte long character array for the above shown custom character can be defined in the code as given below;

              {

                0b00000,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111

              };

The pixel array and the binary array for the eigth custom character displayed in the project are shown in the following image;

Pixel And Binary Array For Eighth Custom Character Using Arduino

Fig. 15: Pixel and Binary Array For Eighth custom character using Arduino

The 8 byte long character array for the above shown custom character can be defined in the code as given below;

              {

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111

              };

The Arduino IDE has a library called <LiquidCrystal.h> which provides lot of functions to access the LCD module. Few of those functions which are very useful is small applications are already discussed in the previous project on how to interface an LCD, how to display sensor value on LCD, how to connect the LCD with the PC and how to make an LCD scrolling display.

The code written for this project has a function lcd.createChar() which helps to create the custom characters in an LCD screen. The details of the lcd.createChar() function are discussed in the following section.

lcd.createChar()

The function lcd.createChar() can be used to write a custom character to the required location in the CGRAM. The function has two parameters in which the first parameter is the location in the CGRAM memory where the character array corresponding to the custom character need to be stored and the second parameter is the character array itself. For example if there is a custom character array called ‘cc’ and it need to be stored in the 5th location of CGRAM one can use the following statement;

lcd.createChar(5, cc);

The above statement writes the character array to the 5th location of the CGRAM of the LCD controller from where it can be displayed by calling the lcd.write() function discussed in the projects on how to connect the LCD with the PCand how to make an LCD scrolling display.

lcd.write(5);

 

Project Source Code

###




/*================================= EG LABS =======================================

 Receive a character through the serial port of the PC and display the same cahracter

 in a 16*2 LCD in scrolling manner along with glowing an LED each time

 

 The circuit:

 * LED attached from pin 5 to ground through a 1K resistor

 

 LCD:

 * 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 ground

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD pin 3

 * LED anode attached to digital output 6

 * LED cathode attached to ground through a 1K resistor

//================================= EG LABS =======================================*/


// 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);


//----------------- store the custom characters in arrays ---------------------//

byte cc1[8] = 

              {

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b11111

              };


byte cc2[8] = 

              {

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b11111,

                0b11111

              };


byte cc3[8] = 

              {

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b11111,

                0b11111,

                0b11111

              };


byte cc4[8] = 

              {

                0b00000,

                0b00000,

                0b00000,

                0b00000,

                0b11111,

                0b11111,

                0b11111,

                0b11111

              };


byte cc5[8] = 

              {

                0b00000,

                0b00000,

                0b00000,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111

              };


byte cc6[8] = 

              {

                0b00000,

                0b00000,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111

              };


byte cc7[8] = 

              {

                0b00000,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111

              };


byte cc8[8] = 

              {

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111,

                0b11111

              };

//----------------- store the custom characters in arrays ---------------------//


// give the LED pin a name:

int led = 6;


void setup()

{

  //---- create custom characters ----//

  lcd.createChar(1, cc1);

  lcd.createChar(2, cc2);

  lcd.createChar(3, cc3);

  lcd.createChar(4, cc4);

  lcd.createChar(5, cc5);

  lcd.createChar(6, cc6);

  lcd.createChar(7, cc7);

  lcd.createChar(8, cc8);

  //---- create custom characters ----//

  

  // initialize the led pin as an output.

  pinMode(led, OUTPUT);

  

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

  lcd.begin(16, 2);

}


void loop()

{

  lcd.print("EG LABS ");  

 

  lcd.write(1);                    // dispaly custom character

  //---- blink LED -----//

  digitalWrite(led, HIGH);       

  delay(1000);

  digitalWrite(led, LOW);

  delay(1000);

   //---- blink LED -----//

   

  lcd.write(2);                   // dispaly custom character

  //---- blink LED -----//

  digitalWrite(led, HIGH);       

  delay(1000);

  digitalWrite(led, LOW);

  delay(1000);

  //---- blink LED -----//

  

  lcd.write(3);                   // dispaly custom character

   //---- blink LED -----//

  digitalWrite(led, HIGH);       

  delay(1000);

  digitalWrite(led, LOW);

  delay(1000);

   //---- blink LED -----//

   

  lcd.write(4);                   // dispaly custom character

  //---- blink LED -----//

  digitalWrite(led, HIGH);       

  delay(1000);

  digitalWrite(led, LOW);

  delay(1000);

  //---- blink LED -----//

     

  lcd.write(5);                   // dispaly custom character

  //---- blink LED -----//

  digitalWrite(led, HIGH);       

  delay(1000);

  digitalWrite(led, LOW);

  delay(1000);

  //---- blink LED -----//

  

  lcd.write(6);                   // dispaly custom character

  //---- blink LED -----//

  digitalWrite(led, HIGH);       

  delay(1000);

  digitalWrite(led, LOW);

  delay(1000);

  //---- blink LED -----//

  

  lcd.write(7);

  //---- blink LED -----//

  digitalWrite(led, HIGH);       

  delay(1000);

  digitalWrite(led, LOW);

  delay(1000);

  //---- blink LED -----//

  

  lcd.write(8);                   // dispaly custom character

  //---- blink LED -----// 

  digitalWrite(led, HIGH);       

  delay(1000);

  digitalWrite(led, LOW);

  delay(1000);

  //---- blink LED -----//

 

  lcd.clear();

}

###

 

Circuit Diagrams

Circuit-Diagram-Creating-Custom-Characters-LCD-Using-Arduino

Project Components

  • Arduino Pro Mini
  • LCD
  • LED
  • Resistor

Project Video


Filed Under: Arduino
Tagged With: Arduino, custom characters, lcd
 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • PS2 Keyboard To Store Text In SD Card Using Arduino Circuit Setup On Breadboard
    How To Use PS2 Keyboard To Store Text In SD Card Using Arduino- (Part 42/49)
  • Wireless Path Tracking System Using Mouse, XBee And Arduino Circuit Setup On Breadboard
    How To Make A Wireless Path Tracking System Using Mouse, XBee And Arduino- (Part 43/49)
  • How to Make a Wireless Keyboard Using Xbee with Arduino- (Part 44/49)
  • Making Phone Call From GSM Module Using Arduino Circuit Setup On Breadboard
    How to Make Phonecall From GSM Module Using Arduino- (Part 45/49)
  • How to Make a Call using Keyboard, GSM Module and Arduino
    How To Make A Call Using Keyboard, GSM Module And Arduino- (Part 46/49)
  • Receiving SMS Using GSM Module With Arduino Prototype
    How to Receive SMS Using GSM Module with Arduino- (Part 47/49)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Renesas delivers intelligent sensor solutions for IoT applications
  • Microchip Technology releases AVR-IoT Cellular Mini Development Board
  • Qualcomm acquires Cellwize to accelerate 5G adoption and spur infrastructure innovation
  • MediaTek’s chipset offers high-performance option for 5G smartphones
  • Nexperia’s new level translators support legacy and future mobile SIM cards

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • DC Motor Speed Control
  • D Flip Flop frequency divider
  • FPGA LVDS with separate clock
  • How do you find the angle made by two isosceles triangles in a kite?
  • Limits of duty cycle for ICM7555 IC?

RSS Electro-Tech-Online.com Discussions

  • Are Cross-wind compensation and Road crown compensation functions inputs to LKA function?
  • we are facing an issue with one-wire communication by using DS2485
  • RF modules which can handle high number of bytes per second
  • Component identification.
  • Flickering (candle) LED to trigger 555
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering