• On sale!
  • -€4.00

1602 LCD Shield

: ARD03070
€8.54
€4.54 Save €4.00

This is a very popular LCD Keypad shield for Arduino board. It can be directly plugged on the Arudino board, no soldering or fly-wiring needed, it offer the 16x2 characters display and 6 buttons for Arduino.This Shield uses Arudino LCD4Bit library.

Quantity

If you have any questions on this product please feel free to contact us.

*Disclaimer: The images are merely illustrative.

Arduino Keypad LCD Shield

The LCD Keypad shield is developed for Arduino compatible boards, to provide a user-friendly interface that allows users to go through the menu, make selections etc. It consists of a 1602 white character blue backlight LCD. The keypad consists of 5 keys — select, up, right, down and left. To save the digital IO pins, the keypad interface uses only one ADC channel. The key value is read through a 5 stage voltage divider.

Arduino Keypad LCD Shield contains 16*2 LCD with contrast adjustment and backlight. LCD dispays white letters on blue background. It uses only an analog port to input the 5 keys' signal. Here is also a reset button. Still unused IO is prepared for expansion.

Date port: PIN4 (DB4), 5 (DB5), 6 (DB6), 7 (DB7), 8 (RS), 9 (E), 10 (backlight control), simulation key port A0.

 

Pin definition:



Pin Allocation

 

Module Test :

 

Connect Arduino LCD Keypad Shield with Arduino. Download "LCD4Bit_mod.h" library file and save to the "arduino-0021 hardware libraries". Compile the test program below and download to Arduino. If you use the Aduino Keypad LCD Shield for the first time and see nothing on the screen, you may need to use screwdriver to adjust RP1 which controls contrast. If clockwise rotation, characters can appear clearly.

Connecting With GP2D12 :


GP2D12 distance measurement code:

 

#include <LiquidCrystal.h>

LCD4Bit_mod lcd = LCD4Bit_mod (2);

char GP2D12;
char a, b;
char str1 [ ] = "Renge:";
char str2 [ ] = "Renge Over";
char str3 [ ] = "cm";

void setup ()
{
lcd.init ();
lcd.clear ();
lcd.printIn ("GP2D12 testing ...");

}

void loop ()
{
GP2D12 = read_gp2d12_range (1);
if (GP2D12> 80 | | GP2D12 <10)
{
lcd.cursorTo (2,0);
lcd.printIn (str2);
}
else
{
a = 0x30 + GP2D12/10;
b = 0x30 + GP2D12% 10;
lcd.cursorTo (2, 3);
lcd.printIn (str1);
lcd.print (a);
lcd.print (b);
lcd.printIn (str3);
}
delay (50);

}

float read_gp2d12_range (byte pin)
{
int tmp;
tmp = analogRead (pin);
if (tmp return (6787.0 / ((float) tmp - 3.0)) - 4.0;

}

 


 
 
 
And you can also use the official Libraries, and only need to set interface :

Test Code :

/*
  The circuit:
 * LCD RS pin to digital pin 8
 * LCD Enable pin to digital pin 9
 * LCD D4 pin to digital pin 4
 * LCD D5 pin to digital pin 5
 * LCD D6 pin to digital pin 6
 * LCD D7 pin to digital pin 7
 * LCD BL pin to digital pin 10
 * KEY pin to analogl pin 0
 */

#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);

char msgs[5][16] = {"Right Key OK ",
                    "Up Key OK    ",              
                    "Down Key OK  ",
                    "Left Key OK  ",
                    "Select Key OK" };

int adc_key_val[5] ={50, 200, 400, 600, 800 };
int NUM_KEYS = 5;
int adc_key_in;
int key=-1;
int oldkey=-1;

void setup()
{
  lcd.clear();
  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  lcd.print("ADC key testing");
}

void loop()
{
  adc_key_in = analogRead(0);    // read the value from the sensor
  key = get_key(adc_key_in);  // convert into key press
 
  if (key != oldkey)   // if keypress is detected
   {
    delay(50);  // wait for debounce time
    adc_key_in = analogRead(0);    // read the value from the sensor
    key = get_key(adc_key_in);    // convert into key press
    if (key != oldkey)   
    {  
      lcd.setCursor(0, 1);
      oldkey = key;
      if (key >=0){
           lcd.print(msgs[key]);             
      }
    }
  }
 delay(100);
}

// Convert ADC value to key number
int get_key(unsigned int input)
{
    int k;
  
    for (k = 0; k < NUM_KEYS; k++)
    {
      if (input < adc_key_val[k])
 {
            return k;
        }
   }
  
    if (k >= NUM_KEYS)k = -1;  // No valid key pressed
    return k;
}

 


Click to download the Schematics and Example use of LiquidCrystal library

Click to download the LCD datasheet

ARD03070

Related products