By dave | March 25, 2016

Wiring a 20x4 character display to an Arduino board

In this article I describe how to wire a 20x4 character display to an Arduino. I'm assuming you are using a regular 5V 8bit Arduino, if this is not the case this article will not work for you as you'll need voltage level converters. Most character based LCD displays use the same wiring, but I can't guarantee that all will be the same. If your display is the same it will look like the diagrams on this page and will have 16 pins.

This wiriing diagram assumes you'll be using the excellent LiquidCrystal Arduino library. If you were intending to use a different library to drive the display, then this wiring tutorial may still be useful, but you'd have to check with the library vendors.

Display pin out left to right:

  1. Vss - connect to ground
  2. Vdd - connect to 5V supply rail
  3. Vo - contrast, either connect to potentiometer or smoothed PWM output. See below
  4. RS - Connect to an Arduino pin, needed by the LiquidCrystal library.
  5. RW - connect to ground
  6. E - Connect to an Arduino pin, needed by the LiquidCrystal library.
  7. D0 - not used
  8. D1 - not used
  9. D2 - not used
  10. D3 - not used
  11. D4 - connect  to Arduino pin, needed by the LiquidCrystal library
  12. D5 - connect  to Arduino pin, needed by the LiquidCrystal library
  13. D6 - connect  to Arduino pin, needed by the LiquidCrystal library
  14. D7 - connect  to Arduino pin, needed by the LiquidCrystal library
  15. A - Backlight Anode, connect via 220-1K resistor to 5V.
  16. K - Backlight Cathode, connect to ground.

PWM based contrast adjustment

Sometimes, when I use one of these displays, I use a PWM contrast circuit to avoid the need for a potentiometer. The circuit directly below normally works fine from any PWM compatbile output of the Arduino board and does not flicker in a noticeable way. If it does flicker for, just increase the capacitor (C1) size. This circuit connects to display pin 3 of a standard display (the Vo pin). If you don’t want to take this approach then just include a potentiometer of at least 10K ohms, the outer connectors go to 5V and ground with the wiper connected to Vo. You’ll have to add code to you sketch to set the PWM port to OUTPUT and set the analog level. This code is included below. I found that a value of 90 works well for many displays.

pwm contrast circuit

Circuit for PWM contrast adjustment

Extra code needed for PWM contrast.

void setup() {
	analogWrite(DISPLAY_CONTRAST_PIN, 90);
	// rest of setup...

Example breadboard layout

Below is an example of how to layout the breadboard in order to connect the display to the Arduino. This is one example layout, and as you can see it includes the PWM contrast adjustment.

LCD Display connected to Arduino

Example LCD display connected to device

Other pages within this category

comments powered by Disqus

This site uses cookies to analyse traffic, and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.

Send a message

Please use the forum for help with UI & libraries.

This message will be securely transmitted to our servers.