How to set up an LCD with Arduino

So you want to set up your LCD module with your Arduino – but maybe you have some questions…  

  • What to do all those pins on an LCD module do?
  • How do you wire up an LCD module?  
  • What kind of LCD Module should you buy for using with Arduino?
  • How do you even start to program an LCD with Arduino?

By the end of this lesson you should be prepared to do the following:

  1. Know what to consider when buying an LCD module.
  2. Wire up your LCD pins to connect to your Arduino.
  3. Be familiar with core Arduino LCD library features like
    • Scrolling text
    • Adjusting the “All Mighty” Cursor (and understand how it works!)
    • Blinking characters displayed on the LCD module
  4. Keep secrets from the Russian Mafia.

Programming Electronics Academy members, check out the Liquid Crystal Display Course to practice building GUIs with LCDs.

Not a member yet?  Sign up here.

What to consider when buying an LCD module for Arduino

Notice some verbiage as we talk about LCDs, you will keep seeing the two words “LCD Module”.  This is because, when you buy LCD screens – you are more than likely going to buy it as a “plug-and-play” module.

The LCD screen itself is a subcomponent of the module, which includes other components and circuitry that make interfacing with the LCD screen far more accessible.

Get an LCD module compatible with Hitachi HD44780 driver

Let’s cut to the chase – the MOST important thing you need to ensure when you are buying your LCD is that is compatible with Hitachi HD44780 driver.  Let me say that bigger:

“Your LCD must be compatible with Hitachi HD44780 driver.”

But don’t worry.  This driver is so common it is pretty much the standard.  If you can’t find any documentation to support whether or not the LCD you want to buy will work, then check the pin out.  Does it have 16 pins?  If the answer is yes, you should feel pretty comfortable that it is compatible.

So why do we need an LCD that is compatible with the Hitachi HD44780 driver?  It’s because the LiquidCrystal Library that we will be using to control the LCD from the Arduino uses the driver as its standard.  The functions in the library won’t necessarily work on other types of LCD screens.

LCD Module Size

The size of the display will be given in the number of character in a row and then the number of rows.

In the picture below, the LCD would be advertised as a 16 X 2 segment.

LCD indexing_3

Some of the more common sizes are 16 x 2, 20 x 2 and 20 x 4, and the bigger 40 x 4.

Colors and backlights:

LCDs can also come in different colors – so you don’t have to go for the standard martian green.  Plus, they can have backlights to help make the characters to stand out better in different light settings.

LCD Module Pin Out Accessibility and PCB Markings.

The LCD you buy will have 16 pads where you will hook up wires or headers to connect to your Arduino, but many manufactures have made modules that also have a second set of 16 pins that are simply duplicates of the first.

The one I use in this video tutorial series has a set of 16 pads at the top of the LCD and 16 pads at the bottom.  What this provides for is more flexibility in where you can connect your wires to control the LCD.

LCD Screen

For example, if you plan on mounting your LCD panel in some type of enclosure, maybe the bottom pins would be more accessible.  You can also use some pads on the top and some on the bottom – since they connect to the same thing on the LCD module the top and bottom pins are interchangeable.

You may also consider soldering on pin headers to the module.  These make connecting your LCD to a breadboard for prototyping about a million times easier. You may not be able to find a 16 pin header, but they are made to be clipped to your desired length.

The final thing I would mention is to check the pin numbering on the PCB.  The LCD module I bought only had the numbers 1 and 16 on the far sides of each of the pads.  This made it a little confusing when trying to figure out which wire to hook where.

PCB markings

That just about sums everything I can think of when it comes to deciding on your LCD module – so lets go ahead and hook one up!

Step by step diagrams to show what LCD module pins to connect to your Arduino

Luckily for us the Arduino website has a great pin layout for us to follow – but I wanted to make one that was step by step – so follow the pictures below and you should be golden.

First let’s look at the final schematic, then we will go step by step.

11.LCD

So – first things first – you are going to need the following:

  • 10K Potentiometer
  • Solder-less Breadboard
  • Arduino
  • LCD Module
  • Hook-up Wire or Pin Headers
  • Pin Headers
  • Jumper Wires ( a ton)
  • Soldering gun
  • Solder
  • OR lots of alligator clips if you are feeling squirrely (not recommended)

What you will need (mostly)

1.LCD

Step 1: Hook up power to the LCD Module2.LCD

Step 2: Hook up ground3.LCD

Step 3: Hook up display brightness control 4.LCD

Step 5: Hook up additional control line5.LCD

Step 6: Hook up another control line6.LCD

Step 7: Start hooking up the data lines7.LCD

Step 8: Another data line…

8.LCD

Step 8: Yet another data line…

9.LCD

Step 8: Give me more cow bell!  I mean…another data line

10.LCD

Final LCD module circuit diagram…not so crazy

11.LCD

Your Challenge:

  1. Connect your LCD up to your Arduino.  I bet you do it right first go! (or not…)
  2. What happens if you reverse the power and ground pins on your potentiometer?
installing Arduino libraries

Installing Arduino Libraries | Beginners Guide

IoT sewage project

Pumping poo! An IoT sewage project

ESP32 webOTA updates

How to update ESP32 firmware using web OTA [Guide + Code]

error message Brackets Thumbnail V1

expected declaration before ‘}’ token [SOLVED]

Compilation SOLVED | 1

Compilation error: expected ‘;’ before [SOLVED]

Learn how to structure your code

10 Comments

  1. […] How to set up an LCD with Arduino […]

  2. […] How to set up an LCD with Arduino 2. LiquidCrystal Library Functions Tour Part 1 3. LiquidCrystal Library Functions Tour Part […]

  3. […] wasn’t here yet and I wanted to get this part done as well I used the part that I had. I used this tutorial to set it up, and needed a lot of wires, a potentiometer, and the screen itself.  (To make it […]

  4. Engineer on January 11, 2017 at 1:13 am

    I have a 40×4 LCD display. It has 18 pins. Is there another way to check if it is compatible?

    Thank you.

    • Thomas Murray on September 9, 2017 at 11:53 pm

      Displays with more than 80 total characters require more than one enable pin (because more than one controller chip is needed), so will not be pin compatible with the type shown here (even though 40 x 4 is listed in the text). If you look up “40×4 lcd arduino”, you should find a number of resources.

  5. Larry S. on August 10, 2019 at 9:35 am

    Nice Christopher Walken/SNL reference!
    I get your jokes! keeps it light!

    • Michael James on August 10, 2019 at 9:54 am

      I’m glad somebody likes my jokes! Thanks for checking this out.

  6. Sandeepan Bhattacharyya on September 2, 2019 at 4:15 am

    is there a programming video on lcd

    • Michael James on September 5, 2019 at 11:19 am

      We have some in our membership training, but not on our public site.

Leave a Comment