LCD Module Contrast and Backlight

Up to this point, we’ve learned how to send commands and characters to the LCD. But there are a couple of pins remaining that affect the visibility of the text to the user.

The example referred to in this article is the Nanox NDM082 LCD. However, the contrast and backlighting setup is similar to most other LCD modules.

LCD Contrast

The contrast of the LCD module is controlled by a variable voltage from a trimmer potentiometer.

Contrast trimpot schematic

Contrast trimpot schematic.

With a 10 kilohm trimpot, connect the first lead to +5 V, the middle lead to pin 3 on the LCD connector, and the third lead to ground.

Most trimpots ship with the dial in the center position. After writing text to the LCD controller, you'll need to rotate the trimpot dial until text appears. Below a certain point, nothing is shown. Above a certain point, all of the pixels (even those that are supposed to be off) turn black or slightly visible. Set the dial to the point where the characters are darkest compared to the background.

After finding the optimal contrast, you usually don’t need to adjust the dial again. After measuring the trimpot resistance, you could use solder a fixed pair of resistors instead of a trimpot to save money. However, LCD contrast will vary based on temperature and power supply voltage. So, you need to decide if this is likely to change in your project, in which case it is preferable to make this adjustable via the trimpot.

One of the most common mistakes when testing an LCD module is to either not draw any characters to the screen or to not connect anything to the contrast pin. In both cases, the screen will be blank and you'll incorrectly assume that either your protocol is wrong or the display is broken.

LED Backlight

To improve visibility, particularly in dark locations, many LCDs (liquid crystal displays) include LEDs (light emitting diodes) behind the screen to provide a light source. This is called a backlight.

Some industry-standard LCDs have 14-pin connectors and some have 16-pin connectors. The displays with 16-pin connectors usually use the top two pins for the backlight. In this case, the Nanox LCD has a 14-pin connector with a separate LED backlight.

Backlight connection for Nanox LCD

Backlight connection for Nanox LCD.

Do NOT hook power directly to the backlight, or else it will instantly overheat and burn out. Instead, use a resistor to limit the current flow.

The backlight is not part of the Sanyo chip. Unfortunately, the Nanox datasheet could not be located. So, I used my LED tester to measure the backlight voltage at 20 mA. That’s a safe maximum current for discrete LEDs.

The backlight voltage measured about 3.7 V. That means the remaining voltage that I want to drop across the current-limiting resistor is 5 V - 3.7 V = 1.3 V. Plugging in 1.3 V and 20 mA into Ohm’s law shows a resistance of 65 ohms is needed.

Therefore, I connected 5 V to a 65 ohm resistor and then to + terminal on the LCD backlight. Then, I connected GND to the - terminal on the LCD backlight. Ta da! The display lit up.

LCDs use very little power (less than 1 milliamp @ 5V), which is why they are so popular on solar-powered and coin-cell devices, such as calculators. LED backlights use quite a bit more power; between 20 mA and 100 mA @ ~3.5 V depending on the display. If there is sufficient light in the room, the backlight should be turned off to save power on battery-operated projects.

You can even use pulse-width modulation to vary the brightness of the backlight. This also allows a microcontroller to turn on and off the backlight, rather than having it hard wired on or off. Note: a resistor is still required to limit the maximum current.

Next, we'll see what the output on the display actually looks like.