Raspberry Pi LCD: How to Setup a 16×2 LCD Display

In this tutorial I go through the steps on how to setup a Raspberry Pi LCD 16×2 display.  This is a cool way to display some information from the Pi without needing any expensive or complicated display setup.

raspberry pi lcd how to setup a 16x2 lcd display

A 16×2 display unlike a touch screen or a normal LCD screen is best used to display short messages or information. You will find it extremely handy when you only need to display some essential data but don’t really need anything too large and expensive. This tutorial will go through the basics of getting the screen setup and is incredibly handy for anyone who is completely new to circuitry.

If you prefer to watch and listen, then you can find the video on how to both assemble the circuit  & code for the 16×2 LCD display below.

Equipment

The equipment that you will need for this tutorial is listed below.

Recomended:

Raspberry Pi

Micro SD Card or 8 GB SD Card (For old Pi’s)

16×2 LCD with header pins

10k Ohm Potentiometer

Breadboard (A large one is required if you’re using a breakout kit)

Breadboard Wire

Optional

Raspberry Pi Case

USB Keyboard

USB Mouse

Ethernet Cord or WiFi dongle

The Raspberry Pi LCD 16×2 Circuit

It may look like that there is quite a bit to this circuit but basically it just involves connecting the wires up correctly to and from the display.

The potentiometer that’s in the circuit is pretty important for controlling the screen brightness. If you do not have one, then you can try swapping this out for a resistor. If you do use a normal resistor try using anything between 5k and 10k ohms. You may need to try out a few different values before getting the perfect resistance.

A typical 16×2 LCD display has 16 pins but not all of them need to be used. In this circuit we will only need to use 4 of the data bus lines since we’re only going to use it in 4 bit mode.

You will find that most 16 connector displays will be using a HD44780 controller. This makes the display pretty versatile and can be used across a wide range of devices. For example, this display I have used previously in an LCD tutorial for the Arduino.

The typical pin layout of the LCD board can be found below.

LCD 16x2 Display Datasheet

Assembling the 16×2 LCD

You will find that most 16×2 displays do not come with the header pins pre-soldered. This means you will need to solder some header pins on before you can use it. It’s extremely hard getting a good connection to the screen without them. This is a pretty straightforward task and should only take a few minutes for anyone who has soldered before.

  1. First snap the header pins so you have 1 line of 16.
  2. Place the header pins up through the holes of the display. The short side of the header pins should stick up.
  3. Now using a hot soldering iron and some solder, slowly solder each of the pins.
  4. It’s now ready for use.

Connecting Everything Up

Connecting the 16×2 LCD display to the Raspberry Pi is pretty straight forward.  There will be quite a few wires to connect up but there isn’t anything overly complex.

There is one thing that you should be aware of before you jump in and start assembling the circuit. Since we do not want 5v feeding back into the Pi (Pi’s GPIO pins are rated 3v3) we will need to make the read/write pin of the LCD go to ground.

In the steps below the physical/logical numbering of the pins are in the brackets otherwise it’s the GPIO numbering.

  1. Place a wire from 5v (Pin 2) to the positive rail on the breadboard.
  2. Place a wire from ground (pin 6) to the ground rail on the breadboard.
  3. Place the 16×2 display onto the breadboard.
  4. Place the potentiometer onto the breadboard.
    • Connect the positive and ground pins to the relevant rails on the breadboard.

Starting from pin 1 of the LCD display do the following or simply refer to the circuit diagram below. Pin 1 of the screen is the pin closest to two edges of the board.

  1. Pin 1 (Ground) goes to the ground rail.
  2. Pin 2 (VCC/5v) goes to the positive rail.
  3. Pin 3 (V0) goes to the middle wire of the potentiometer.
  4. Pin 4 (RS) goes to GPIO25 (Pin 22)
  5. Pin 5 (RW) goes to the ground rail.
  6. Pin 6 (EN) goes to GPIO24 (Pin 18)
  7. Pin 11 (D4) goes to GPIO23 (Pin 16)
  8. Pin 12 (D5) goes to GPIO17 (Pin 11)
  9. Pin 13 (D6) goes to GPIO18 (Pin 12)
  10. Pin 14 (D7) goes to GPIO22 (Pin 15)
  11. Pin 15 (LED +) goes to the positive rail.
  12. Pin 16 (LED -) goes to the ground rail.

That’s all you need to do, the screen should now be able to turn on and communicate with the Raspberry Pi without any issues. If you’re having trouble refer to the circuit diagram below.circuit raspberry pi lcd how to setup a 16x2 lcd display

For more detail: Raspberry Pi LCD: How to Setup a 16×2 LCD Display


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top