How 16×2 LCDs work | Build a basic 16×2 character LCD


How to Generate Custom Characters in CG-RAM

In LCD displays, each character is in a 5×8 matrix. Where 5 are the number of columns and 8 is the number of rows.


Here is a simple example of how to create letter ‘b’ in CG-RAM.
The Array for generating ‘b’ is char b[7]={0x10,0x10,0x16,0x19,0x11,0x11,0x1E}; That is,

  • Send address where you want to create character.
  • Now create your character at this address. Send the ‘b’ character array values defined above one by one to the data register of LCD.
  • To print the generated character at 0x40. Send command 0 to command register of LCD. The table below would explain this more clearly

table for CGRAM

Interfacing a 16X2 LCD with Arduino

LCD modules form a very important part in many Arduino based embedded system designs to improve the user interface of the system. Interfacing with Arduino gives the programmer more freedom to customise the code easily. Any Arduino board (UNO, MEGA, Due etc), a 16X2 LCD display, a couple of jumper wires and a breadboard are sufficient enough to build the circuit. The interfacing of Arduino to LCD display below.

lcd and arduino.,

Source code for 16X2LCD and Arduino.

Display the LED Brightness on a 16×2 LCD

The combination of an LCD and Arduino yields so many useful projects, the most simple one being LCD to display the brightness of a LED. All we need for this circuit is an LCD, Arduino, breadboard, a resistor, potentiometer, LED and some jumper cables. The circuit connections are below.

LCD displaying LED brightness

The detailed project is available at displaying brightness of a LED on an LCD display

This article was first published on 21 November 2016 and was recently updated on 4 December 2018.



    • connect them to 5v and gnd to illuminate the lime-colored back light led.
      This is useful to read lcd text even in darkness.

      it’s better to add in-series 220 ohm resistor to 5v or ground.

  1. i am interfacing LCD 12864 (128×64)and i give the text but it displays only few seconds after there is no text was displayed please help me in displayin senter of the screen and life span of the text .


Please enter your comment!
Please enter your name here