DFR0374 LCD Keypad Shield V2.0 for Arduino

DFR0936 LCD Keypad Shield V2.0 for Arduino


This shield with a 16×2 RGB LCD screen could bring you a brand-new experience with LCD screen!

The RGB LCD shield extends all IOs of Arduino UNO on the back, by which you can connect with modules like sensors, LEDs, servos while using this screen to display content. More possibilities for your creative projects!

Besides, there are 6 keys on the shield, 5 of which are programable and can be used to switch and set functions.

The 1602 RGB LCD shield adopts an integrated design approach and I2C communication. No more complicated wiring, you can directly plug this shield onto an Arduino controller, call the Arduino library, add a couple lines of codes, then the screen can display numbers or characters.

This 1602 RGB LCD shield can not only be used in interactive projects, but also suitable for building data monitoring platforms to feed back the real-time status of various devices.


Board Overview

This 1602 RGB LCD module is designed with dual-row analog/digital ports. User can combine this product with other sensors, LEDs, servos, and so on to make various appications based on their needs.

Note: There are silkscreens besides the dual-row pins, and the former corresponds to the upper row while the latter indicates the lower row. Shown as below:

Board Overview

Board Overview 2

Board Overview

There are 5 buttons connected to A0 and the correspondence between key value and key pressed is shown below. If multiple button are pressed at the same time, the lowest readings among all pressed buttons will be read.

Key Pressed A0 value
UP 206
DOWN 407
LEFT 624
No button pressed 1023

As the analog signal is susceptible to interference, the measured value sometime is not exactly the same as the table above, and the error of ±10 is tolerable.


This demo shows how to use 1602 RGB LCD shield.


Sample Code

If your Arduino IDE does not have this library, please follow the steps below to install it.

About how to install the library?

 * @file Button.ino
 * @brief Button.
 * @copyright    Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @licence     The MIT License (MIT)
 * @maintainer DFRobot
 * @version  V1.0
 * @date  2023-07-03
 * @url https://github.com/DFRobot/DFRobot_RGBLCD1602
#include "DFRobot_RGBLCD1602.h"

Change the RGBaddr value based on the hardware version
       Moudule        | Version| RGBAddr|
  LCD1602 Module      |  V1.0  | 0x60   |
  LCD1602 Module      |  V1.1  | 0x6B   |
  LCD1602 RGB Module  |  V1.0  | 0x60   |
  LCD1602 RGB Module  |  V2.0  | 0x2D   |
DFRobot_RGBLCD1602 lcd(/*RGBAddr*/0x60 ,/*lcdCols*/16,/*lcdRows*/2);  //16 characters and 2 lines of show

// Define keys
int lcdKey     = 0;
int adcKeyIN  = 0;
int r=255;   //Set red brightness (Range: 0-255) 
int g=255;   //Set green brightness 
int b=0;     //Set blue brightness

#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5

void setup()
  lcd.setRGB(r,g,b);  // Set RGB

int readLcdButtons()    // Determine which button is pressed
 adcKeyIN = analogRead(0);          // 0 read the ADC from analog values
 // By setting different threshold, you can read the corresponding to the appropriate buttons
 if (adcKeyIN > 1000) return btnNONE;
 if (adcKeyIN < 50)   return btnRIGHT;
 if (adcKeyIN < 250)  return btnUP;
 if (adcKeyIN < 450)  return btnDOWN;
 if (adcKeyIN < 650)  return btnLEFT;
 if (adcKeyIN < 850)  return btnSELECT;
 return btnNONE;

void loop()
 lcd.setCursor(9,1);            //Set display output position 
 lcd.print(millis()/1000);      //Output time(second) 
 lcd.setRGB(r,g,b);             //Set RGB
 lcdKey = readLcdButtons();     // Read button content
 switch (lcdKey)                // Select to output content according to the pressed button
   case btnRIGHT:
     lcd.print("RIGHT ");
   case btnLEFT:
     lcd.print("LEFT   ");
   case btnUP:
     lcd.print("UP    ");
   case btnDOWN:
     lcd.print("DOWN  ");
   case btnSELECT:
     case btnNONE:
     lcd.print("NONE  ");


Yellow background, output NONE when no button pressed, otherwise, output the corresponding button.

More Documents

LCD Keypad Shield V2.0 Schematic

DFshopping_car1.png Get LCD Keypad Shield V2.0 for Arduino from DFRobot Store or DFRobot Distributor.

Turn to the Top