LamaPLC: Arduino LCD

classic, no I²C

An LCD character display is a unique type of display that can only output individual ASCII characters with fixed size. Using these individual characters then we can form a text.

If we take a closer look at the display we can notice that there are small rectangular areas composed of 5×8 pixels grid. Each pixel can light up individually, and so we can generate characters within each grid.

The number of the rectangular areas define the size of the LCD. The most popular LCD is the 16×2 LCD, which has two rows with 16 rectangular areas or characters. Of course, there are other sizes like 16×1, 16×4, 20×4 and so on, but they all work on the same principle. Also, these LCDs can have different background and text color.

Arduino LCD

The LCDs have a parallel interface, meaning that the microcontroller has to manipulate several interface pins at once to control the display. The interface consists of the following pins:

  • A register select (RS) pin that controls where in the LCD's memory you're writing data to. You can select either the data register, which holds what goes on the screen, or an instruction register, which is where the LCD's controller looks for instructions on what to do next.
  • A Read/Write (R/W) pin that selects reading mode or writing mode
  • An Enable pin that enables writing to the registers
  • 8 data pins (D0 -D7). The states of these pins (high or low) are the bits that you're writing to a register when you write, or the values you're reading when you read.

There's also a display contrast pin (Vo), power supply pins (+5V and GND) and LED Backlight (Bklt+ and BKlt-) pins that you can use to power the LCD, control the display contrast, and turn on and off the LED backlight, respectively.

Arduino LCD

Liquid Crystal Displays (LCD) with Arduino: https://docs.arduino.cc/learn/electronics/lcd-displays/
LiquidCrystal library: https://www.arduino.cc/reference/en/libraries/liquidcrystal/

I²C LCD

I²C LCD Adapter

At the heart of the adapter is an 8-bit I/O expander chip – PCF8574. This chip converts the I²C data from an Arduino into the parallel data required for an LCD display. More information from I²C » here.

I²C LCD Adapter

An important point to note here is that several companies, including Texas Instruments and NXP Semiconductors, manufacture the same PCF8574 chip. And the I²C address of your LCD depends on the chip manufacturer:

  • Texas Instruments’ PCF8574, default I²C address of 0x27, can set: 0x20 .. 0x27
  • NXP’s PCF8574, default I²C address of 0x3F, can set: 0x38 .. 0x3F

I²C LCD Adapter

More info: https://lastminuteengineers.com/i2c-lcd-arduino-tutorial/
I²C Liquid Crystal Displays: https://projecthub.arduino.cc/arduino_uno_guy/i2c-liquid-crystal-displays-5eb615
LiquidCrystal I2C: https://www.arduino.cc/reference/en/libraries/liquidcrystal-i2c/