In this post I’ll show how to connect and use a 16 x 2 LCD on a Raspberry Pi.
The LCD I am using is a Blue Character OLED(LCD) 16x2 from adafruit.
This display has ultra-high contrast and any-angle readability. It has the best display I have seen on any LCD.
This LCD uses the HD44780 controller which is present in almost all LCDs.
LCDs that use this controller usually have 14 or 16 pins. This LCD has 16, numbered from 0 to 16 as shown below.
![]() | ![]() |
Sometimes these pins are present, but not used. Eg, pins 15 & 16 are for back-light and they are not used on this LCD. It depends on the manufacture.
HD44780 pins in Detail | |
---|---|
Pin 1 | Ground. |
Pin 2 | Supply Voltage for OLED and logic |
Pin 3 | Is usually connected to a potentiometer to control the contrast of the display. |
Pin 4 | The register select signal (RS) determines whether the Data Bit values are interpreted as a command (E.g. clear screen) or data (aka: a character to display). |
Pin 5 | Is the Read/Write pin. In read mode, this pin is used to get feedback from the LCD to work out if the LCD can accept commands or to indicate it is too busy. We don’t need this function as we can wait the maximum time for a command to be written (200us) before sending the next command. If read is enabled and Pin4 on the LCD is connected to a pin on your Raspberry Pi, there is a chance that you can destroy your Pi. We only ever want to write to the LCD, we never want to read from it. So this should always be connected to ground. |
Pin 6 | The enable pin (E)functions as the command/data latching signal for the LCD. The LCD will latch in whatever is on the Data Bits and process it on the falling edge of the E signal Meaning, when this pin goes low, the LCD will take the input from the data pins at this time. |
Pins 7 to 14 | Are the data pins. In 4 pin mode, only pins 11 to 14 are used. |
Pins 15 & 16 | Are used for the backlight if present. |
Wiring the LCD up
Below shows how to wire up the LCD to the Raspberry Pi. We will be using 4 pin mode, so there is no need to connect pins 7 to 10. This LCD doesn't use the backlight pins, pins 15 and 16. It also doesn't use the contrast pin, pin 3.
Continue reading Interfacing a 16 x 2 LCD with the Raspberry Pi