LCD_Keypad_Shield_V2.0_SKU__DFR0374-DFRobot

DFR0374 LCD Keypad Shield V2.0 for Arduino

Introduction

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

The RGB LCD shield supports both backlit brightness and color adjustment. It offers 16 million color combinations that make colors on screen appear vivid and bright. Moreover, the screen backlit color can be programmed to adjust automatically according to the changes in the measured parameters, which allows you to intuitively feel the real-time status of the monitored object. For example, when detecting the indoor temperature, set the backlit color to blue if temperature ≤26℃ and change the color to red if temperature >26℃.

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.

Specification

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
RIGHT 0
UP 206
DOWN 407
LEFT 624
SELECT 824
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.

Tutorial

This demo shows how to use 1602 RGB LCD shield.

Requirements

Sample Code

The new Arduino IDE has built-in LiquidCrystal library to drive 1602 screen. If your Arduino IDE does not have this library, please follow the steps below to install it.

About how to install the library?

#include "DFRobot_RGBLCD1602.h"
DFRobot_RGBLCD1602 lcd(16,2);
// Define keys
int lcd_key     = 0;
int adc_key_in  = 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(){
  Serial.begin(9600);
  lcd.init();
  lcd.setRGB(r,g,b);  //Set RGB
}
int read_LCD_buttons()    //Determine which button is pressed 
{
 adc_key_in = analogRead(0);          // 0 read the ADC from analog values
 // By setting different threshold, you can read the corresponding to the appropriate buttons
 if (adc_key_in > 1000) return btnNONE;
 if (adc_key_in < 50)   return btnRIGHT;
 if (adc_key_in < 250)  return btnUP;
 if (adc_key_in < 450)  return btnDOWN;
 if (adc_key_in < 650)  return btnLEFT;
 if (adc_key_in < 850)  return btnSELECT;
 return btnNONE;
}
void loop(){
//  lcd.setCursor(0,0);
//  lcd.print("1234567891234567");
//  lcd.setCursor(0,1);
//  lcd.print("ABCDEFGHIJKLMNOP");
//  delay(2000);
 lcd.setCursor(9,1);            //Set display output position 
 lcd.print(millis()/1000);      //Output time(second) 
 lcd.setRGB(r,g,b);             //Set RGB
 lcd.setCursor(0,1);            
 lcd_key = read_LCD_buttons();  // Read button content 
 switch (lcd_key)               // Select to output content according to the pressed button 
 {
   case btnRIGHT:
     {
     lcd.print("RIGHT ");
     break;
     }
   case btnLEFT:
     {
     lcd.print("LEFT   ");
     break;
     }
   case btnUP:
     {
     lcd.print("UP    ");
     break;
     }
   case btnDOWN:
     {
     lcd.print("DOWN  ");
     break;
     }
   case btnSELECT:
     {
     lcd.print("SELECT");
     break;
     }
     case btnNONE:
     {
     lcd.print("NONE  ");
     break;
     }
 }           
}

Result

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