Using the RGB LCD Shield

The shield is really easy to use. Once you have attached the LCD of choice, plug it onto the Arduino and download our library from github. The example included shows how to use the RGB backlight control and reading from the keypad.

Download the Library

To interface with the LCD and buttons you must use our library which translates the commands through the port expander

You can find our Arduino library source repository at the Github RGB LCD library page. To install it, click the button below to download the compressed ZIP file then install it. This guide will help you with the install process if you have never installed an Arduino library.
Restart the IDE.

You should now be able to open up the File->Examples->Adafruit_RGBLCDShield->HelloWorld example. Upload this to the Arduino with the shield on top and you should be able to perform the following to test the buttons, LCD and backlight.

Adjusting Contrast

The shield uses a character LCD with an external contrast potentiometer. The first time you use it, adjust the potentiometer in the bottom right until you see the text clearly. If you don't upload code to the Arduino, some boxes will appear instead
If you don't see any text on the LCD, be sure to try twisting the orange contrast potentiometer until the text appears. You may have to turn it all the way around from one side to the other until you see text

Shared Pins

The I2C pins are shared with other pins, and each Arduino type has a different sharing scheme. Those pins cannot be used for anything else than I2C when this shield is used!
Uno/Duemilanove/Diecimila - I2C pins are also the same pins as Analog 4 and Analog 5
Mega 1280 and 2560 - I2C pins are also the same pins as Digital 20 and 21
Leonardo and other 32u4-based - I2C pins are also the same pins as Digital 2 and 3

Writing Your Own Sketches

The Adafruit_RGBLCDShield library is a derivative of the LiquidCrystal library that comes with Arduino so you can call any of the functions that you're used to and they'll work just the same.

There are two extra functions you may want to use. One is lcd.setBacklight(color); which will change the backlight color assuming you have an RGB LCD on. At this time, the library does not do any PWM on the RGB backlight, so you can select from 8 different colors (inlcuding OFF) - if you place these #define's at the top of your sketch you can simply call whichever color you want to appear.

// These #defines make it easy to set the backlight color
#define OFF 0x0
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7 
Another extra of the shield is a 4-way directional keypad plus select button. This will let you design your own control interface for 'stand-alone' Arduino projects. All the buttons are read at once when you call lcd.readButtons(); which returns a variable that has individual bits set for the buttons. You can easily test for which buttons were held down at the time of the readButtons() call by using bitwise & as seen in this code snippet.

Note that the library handles button debouncing internally.  There is no need to debounce the buttons in your code.
uint8_t buttons = lcd.readButtons();

  if (buttons) {
    if (buttons & BUTTON_UP) {
    if (buttons & BUTTON_DOWN) {
    if (buttons & BUTTON_LEFT) {
    if (buttons & BUTTON_RIGHT) {
    if (buttons & BUTTON_SELECT) {

Using with Monochrome Displays

Displays with monochrome backlights are controlled by the RED pin and will only respond to colors that have RED in them (RED, YELLOW, VIOLET). For these displays, you can use ON and OFF instead as in the snippet below:
uint8_t buttons = lcd.readButtons();

  if (buttons) {
    if (buttons & BUTTON_UP) {
      lcd.print("UP ");
    if (buttons & BUTTON_DOWN) {
      lcd.print("DOWN ");

Detached Usage

If you want to have the shield disconnected from the Arduino (say to panel mount it) or if you want to use it with a different type of processor board, its very easy!

Just power the 5V pin with 5V, common ground to GND and then connect the SCL labeled pin (top left) to I2C clock and SDA to I2C data. Those are the only four wires you need to control the entire shield.

  • On Uno-shaped Arduinos, SCL is also connected to Analog 5 and SDA is connected to Analog 4.
  • On Mega Arduinos, SCL is also connected to Digital 21 and SDA is connected to Digital 20.
  • On Leonardo Arduinos, SCL is also connected to Digital 3 and SDA is connected to Digital 2.
Important: Wire +5V and GND to the shield pins shown in the pictures! The GND pin next to the 5v pin is NOT connected. You must use the one next to the VIN pin!
Last updated on 2015-05-04 at 04.27.56 PM Published on 2012-07-29 at 11.58.37 AM