On this undertaking, I’ll present you learn how to interface a 128X64 Graphical LCD with Arduino UNO. This specific LCD Module relies ST7920 LCD Controller. So, we are going to first see a bit bit in regards to the Graphical LCD Module and its LCD Controller ST7920.

Then we are going to see the steps for Interfacing the 128×64 Graphical LCD with Arduino UNO board and show some bitmap picture.

Interfacing-128x64-Graphical-LCD-Arduino-Image1

Introduction

Within the earlier Arduino undertaking, I’ve interfaced a Nokia 5110 LCD Module with Arduino. Additionally it is a graphical LCD which may show some primary bitmap pictures and graphics. However the concern with Nokia 5110 LCD Module is its decision.

At 84 x 48 pixels, the Nokia 5110 LCD can be utilized for implementing a menu-based consumer interface. As a consequence of its small measurement, the ensuing menu will likely be restricted to three or 4 gadgets per web page.

If we wish an even bigger show with extra actual property to work with, then the plain selection is to go for the larger and higher 128×64 Graphical LCD Module.

As an indication, after making all of the {hardware} connections, I’ll show a bitmap picture on the Graphical LCD Module. In case you are focused on implementing a easy 16×2 Alpha-Numeric LCD with Arduino, then take a look at this tutorial.

A Temporary Observe on 128×64 Graphical LCD

At first look, the 128×64 Graphical LCD Module looks as if an even bigger brother to the well-known 16×2 LCD or 20×4 LCD Modules, with their related building and nearly related pin structure.

However there’s a vital distinction between these two. 16×2 or 20×4 LCDs are basically character shows. They’ll solely show alpha-numeric characters and a few easy customized characters which might be confined to a 5×8 matrix.

Coming to the 128×64 Graphical LCD, because the title suggests, it’s a Graphical Show consisting of 128×64 i.e., 8192 individually controllable dots.

Through the use of totally different combos of pixels, we will principally show characters of assorted sizes. However the magic doesn’t finish there. You’ll be able to show pictures and graphics (small animations) as effectively. In a 128×64 LCD Module, there are 64 rows and 128 columns.

Interfacing-128x64-Graphical-LCD-Arduino-Image2

ST7920 LCD Controller

There are a number of variations of the Graphical LCD available in the market. Though the utilization, software and implementations are nearly an identical, the primary distinction lies within the inner LCD Controller used to drive the dot matrix show.

A few of the generally used LCD Controllers are KS0108, SSD1306, ST7920, SH1106, SSD1322, and so forth. The pin out of the ultimate LCD Module would possibly fluctuate relying on the LCD Controller used. So, please confirm the LCD Controller in addition to the pin out earlier than making a purchase order.

The Graphical LCD Module I bought consists of ST7920 Controller. It’s manufactured by Sitronix and helps three forms of bus interfaces i.e., 8-bit mode, 4-bit mode and Serial interface.

When you’ve got used 16×2 LCD Show earlier, then you definately is perhaps conversant in each 4-bit in addition to 8-bit parallel interfaces. The serial interface is one thing new and we are going to discover this selection on this undertaking.

128×64 LCD Pinout

As I already talked about, double-check with the producer in regards to the pinout of the Graphical LCD Module. The next desk describes the pinout of the 128×64 LCD Module that I’ve.

Pin Quantity Pin Identify Pin Description
1 GND Floor
2 VCC Provide Voltage
3 VO Distinction Regulate
4 RS Register Choose (CS in Serial)
5 RW Learn / Write Management (Serial Information In)
6 E Allow (Serial CLK)
7 – 14 D0 – D7 Information
15 PSB Interface Choice (0: Serial, 1: 8-bit/4-bit Parallel)
16 NC Not Linked
17 RST Reset
18 VOUT LCD Voltage Doubler Output
19 BLA Backlight LED Anode
20 BLK Backlight LED Cathode

The next picture exhibits the rear of the LCD with its pinout printed.

128x64-LCD-Pinout

Interfacing 128×64 Graphical LCD with Arduino

Now that we’ve seen a bit bit in regards to the Graphical LCD and its controller ST7920, allow us to now proceed with interfacing the 128×64 Graphical LCD with Arduino. I’ll implement a easy circuit to reveal how straightforward it’s to interface the LCD and Arduino utilizing only a few exterior elements.

I’ll use the Serial Interface for Information Switch and likewise show a Bitmap Picture on the Graphical LCD.

Circuit Diagram

The next picture exhibits the circuit diagram for Interfacing ST7920 Graphical LCD with Arduino UNO.

128x64-LCD-Arduino-Circuit-Diagram

Parts Required

  • Arduino UNO
  • 128×64 Graphical LCD Module
  • 10KΩ Potentiometer
  • Breadboard
  • Breadboard Energy Provide
  • Connecting Wires

{Hardware} Connections

As talked about earlier, there are three other ways in which you’ll interface the Graphical LCD with Arduino. They’re:

  • 4-bit Parallel Mode
  • 8-bit Parallel Mode
  • Serial Mode

In Serial Mode, we’d like solely three pins for the precise knowledge switch. They’re RS, RW and E. RS acts as Chip Choose Pin in Serial Communication. RW and E acts as Serial Information IN and Serial CLK pins respectively.

128x64-LCD-Connections

So, join the RS, RW and E of the LCD to Digital IO pins 10, 11 and 13 of Arduino UNO. Additionally, with a view to choose the Serial Interface Mode, the PCB pin have to be related to GND.

The remaining connections are just like a standard 16×2 LCD. VCC and GND are related to 5V and floor of the facility provide. VO is related to the wiper of a 10KΩ POT whereas the opposite two terminals of the POT are related to 5V and GND respectively.

With a view to illuminate the LCD with backlight, join the BLA to 5V and BLK to GND.

The color of backlight in my LCD is blue. However White and Inexperienced are additionally frequent.

Producing HEX Code for Bitmap Picture

As a substitute of displaying characters of various fonts (sure, there are libraries utilizing which you’ll implement varied fonts), I’ll immediately show a picture within the type of bitmap. Earlier than writing the code, it’s essential to convert the bitmap picture into byte arrays.

128x64-Bitmap-Sample

I’ve used the above “The Workplace” emblem. Keep in mind that the decision of the 128×64 LCD is, effectively 128×64 pixels. So, the utmost picture measurement must be 128×64. So, utilizing Microsoft Paint, I’ve introduced down the decision of the above picture to 128×64 pixels and likewise saved it as Monochrome Bitmap Picture.

The following step is to transform this bitmap picture into bytes array. I’ve tried a number of converter instruments (each on-line and offline) however none of them have been capable of generate a code that’s suitable with my setup.

So, I’ve used the “GIMP” software program. You’ll be able to obtain GIMP from this hyperlink and set up it. After putting in, you may open the 128×64 Bitmap picture within the GIMP software program and export it as “X Bitmap Picture”.

GIMP-XBM-Export

A .xbm file will likely be generated. It comprises the HEX code for the chosen 128×64 Bitmap Picture. Open it with any textual content editor (like Notepad++) and make the next modifications. The Array must be a static const unsigned char and append “PROGMEM” after the array title.

static const unsigned char myBitmap [] PROGMEM = {

0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,

0xff, 0xff, 0xff, 0x3f, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

…..

0xff, 0xff, 0xff, 0x7f };

Code

Earlier than writing the code, it’s essential to obtain a particular library referred to as “U8g2”. Within the Arduino IDE, go to Instruments -> Handle Libraries… Seek for “u8g2” and set up the most recent model. It’s a complicated library and its github web page consists of all the mandatory documentation.

The beforehand generated HEX code have to be added into our code.

Conclusion

A easy undertaking for interfacing the 128×64 Graphical LCD with Arduino is carried out right here. As a substitute of displaying plain characters, I’ve displayed a bitmap picture on the LCD to indicate its functionality.

Within the subsequent undertaking, I’ll present you learn how to design a easy Menu Show on the 128×64 Graphical LCD utilizing Rotary Encoder.