LCD and OLED displays
An LCD makes an image by letting a backlight through or blocking it, pixel by pixel, with liquid crystal between two polarizers; an OLED display has no backlight, because every pixel is a tiny LED that makes its own light.
frame bytes = width × height × bits per pixel ÷ 8
so a 128 × 64 monochrome OLED takes 1,024 bytes, half an Arduino Uno’s RAM.
For projects, a 16x2 I2C LCD shows text, an SSD1306 OLED small graphics, and a TFT color.
What are LCD and OLED displays?
LCD and OLED displays are the two common kinds of flat screen: an LCD shapes light from a backlight, while an OLED’s pixels glow by themselves, and both come small enough for an Arduino project.
E-ink, a third kind, reflects room light like paper. Figure 1 shows how one pixel of each goes light or dark.
LCD, pixel lit: with no voltage, the liquid crystal twists the backlight’s light a quarter turn, so it passes the second polarizer, crossed with the first. The backlight stays on, so even dark pixels cost power.
How does an LCD work?
An LCD works by twisting light: liquid crystal between two crossed polarizers turns the backlight’s light a quarter turn so it passes, and a small voltage untwists the crystal so the light is blocked.
Each pixel, or each segment of a calculator digit, is a patch of crystal with its own transparent electrodes. Color LCDs split every pixel into red, green and blue filters.
What is an OLED display?
An OLED display is made of organic light-emitting diodes, thin layers of carbon-based material that glow when current flows, one or more per pixel, with no backlight.
Its blacks are truly black and it can be very thin. A pixel left showing the same thing for thousands of hours can fade unevenly, called burn-in.
LCD vs OLED: which is better?
OLED is better for contrast, true black and viewing angle; LCD is cheaper, brighter in sunlight, and has no burn-in, so each wins somewhere.
An OLED’s power depends on what it shows: mostly dark screens use little. An LCD’s backlight draws about the same whatever is on screen.
What is an e-ink display?
An e-ink display, or e-paper, holds millions of tiny capsules of charged white and black particles that a voltage moves to the top or bottom, so each pixel looks white or black like ink.
It needs power only to change, so it can show a sign or a weather forecast for months on a battery. It updates slowly, often taking a second.
What is a TFT display?
A TFT display is a color LCD with a thin-film transistor behind every pixel, which holds each pixel’s state between refreshes for a sharp, fast image.
For projects, 1.8 to 3.5 inch TFTs with an ILI9341 or ST7789 controller connect over SPI. Many add a touch layer.
How do you use a 16x2 LCD with an Arduino?
To use a 16x2 LCD with an Arduino, wire its RS, E and D4 to D7 pins to six digital pins, its contrast pin V0 to a 10 kΩ potentiometer, and power it from 5 V.
It shows two lines of 16 characters through its HD44780-compatible controller, and the LiquidCrystal library drives it. If you see only blocks or nothing, turn the contrast potentiometer.
What is an I2C LCD?
An I2C LCD is a 16x2 or 20x4 character LCD with a small PCF8574 backpack soldered on, so it needs only two data wires, SDA and SCL, instead of six.
Its address is usually 0x27 or 0x3F, and its contrast potentiometer sits on the backpack. Other I2C parts can share the same two wires.
What is the SSD1306 OLED?
The SSD1306 is the controller chip inside the common 0.96 inch monochrome OLED, 128 × 64 pixels, that talks I2C at address 0x3C, or SPI on some boards.
Most modules run from 3.3 or 5 V. Libraries such as Adafruit SSD1306 or U8g2 draw text and shapes, but keep a 1,024-byte copy of the screen in RAM, as Example 1 works out.
Which display should you use for a project?
Use a 16x2 I2C LCD for text, an SSD1306 OLED for small graphics, a TFT for color, and e-ink for a battery display that changes rarely.
Figure 2 matches each need to a display. Check the logic voltage too: an ESP32 runs at 3.3 V.
Graphics: a 0.96 inch SSD1306 OLED draws text, icons and graphs at 128 × 64 pixels, crisp and high in contrast.
How do you work out a display’s memory and refresh time?
Multiply width by height by bits per pixel and divide by 8 for a frame’s bytes, then divide its bits by the bus’s clock for the time to send it.
Example 1: a display’s frame memory
A graphics library keeps a copy of every pixel in RAM. How much does a 128 × 64 OLED need?
- Given
- a 128 × 64 OLED, 1 bit a pixel, on or off
- Find
- the memory a full frame takes
- Solution
- 128 × 64 × 1 ÷ 8 = 1,024 bytes
- Answer
- 1,024 bytes, half of an Arduino Uno’s 2,048
Example 2: how fast a display can refresh
A full frame for a 128 × 64 OLED goes over I2C, 400 kHz. How long does it take, before any overhead?
- Given
- a 128 × 64 OLED’s 1,024-byte frame sent over I2C, 400 kHz, 9 clock pulses a byte with I2C’s acknowledge
- Find
- the time for one frame, and the most frames a second
- Solution
- t = 1,024 × 9 ÷ 400,000 Hz ≈ 23 msRate = 1,000 ÷ 23 ≈ 43.5 a second
- Answer
- about 43.5 frames a second at most
Summary
Key equations
- bytes = W × H × bits ÷ 8 a frame’s memory
- t = bytes × bits per byte ÷ clock time to send a frame
Key terms
- LCD
- Liquid crystal display.
- OLED
- Organic LED display.
- TFT
- A color LCD, a transistor per pixel.
- Backpack
- An I2C adapter on an LCD.
Practice problems
-
Which display makes its own light in every pixel?
Each OLED pixel is a tiny LED; an LCD needs a backlight, and e-ink reflects room light.
-
How many Arduino pins does a 16x2 LCD with an I2C backpack use?
Just SDA and SCL, plus power; without the backpack, 4-bit mode needs 6.
-
How many bytes does a 128 × 64 monochrome frame take?
128 × 64 × 1 ÷ 8 = 1,024 bytes.
-
Which display keeps its image with the power off?
Its particles stay where they were moved, so only changes cost power.
-
What is the usual I2C address of an SSD1306 OLED?
0x3C, or 0x3D with its address jumper moved; 0x27 is a common LCD backpack’s.
FAQ
Why is my 16x2 LCD showing only blocks?
Usually the contrast is wrong or the display is not initialized; turn the contrast potentiometer, then check the wiring and the I2C address.
Can an OLED display burn in?
Yes, slowly. Change what it shows, or turn it off when idle.