Description
The LCD1602 16×2 Blue LCD with Keypad Shield provides a 16 character x 2 line LCD and keypad in an Arduino shield format for providing a user interface for a project.
KEY FEATURES OF LCD1602 16×2 BLUE LCD WITH KEYPAD SHIELD:
- 16 character x 2 line Blue LCD
- 5 button keypad + reset
- Fits Arduino Uno, Mega and similar Arduino boards with compatible I/O pin-out
- 5V operation
This shield provides an easy way to implement a user interface suitable for many projects such as having a user navigate through menus on the screen to select functions or setup a program such as for an automated lighting system.
LCD Display
This shield incorporates a 16 character x 2 line blue LCD display. It uses a 4-bit parallel bus to communicate with the MCU. Good library support makes this easy to use as shown in the example program below.
The backlight has a multi-turn potentiometer for adjusting the contrast of the display for best viewing.
Keypad
The module includes a small keypad that has UP/DOWN/LEFT/RIGHT/SELECT buttons. The last button is a remote RESET button.
The buttons (except for reset) all connect to a resistor voltage divider that come into the analog input A0. The output of the voltage divider will vary depending on which button is pushed, so reading the value on analog pin A0 allows you to determine which button was pushed. The example program below shows how this is done in the Read_Buttons() function.
Arduino to Shield Pin Connections
The shield occupies the following pins on the Arduino:
- D4 = LCD DB4
- D5 = LCD DB5
- D6 = LCD DB6
- D7 = LCD DB7
- D8 = RS
- D9 = LCD Enable
- D10 = Backlight Control
- A0 = Analog value of the button pushed
Many of the other pins not used by the LCD or buttons come out to break-out pads on the shield making them available. Wires or headers can be soldered to these pads if desired.
The holes at the top of the module from left to right connect to the following pins on the Arduino which are not used by the LCD.
D13, D12, D11, D3, D2, D1, D0.
The holes along the bottom edge of the board connect to all the pins from RST on the left thru A5 on the right but skips pin A0 which is used by the buttons.
Important note about the backlight control on pin 10:
The backlight is enabled when the backlight control on pin 10 is set HIGH. By default this signal is pulled up to 5V on the board, so the backlight is always ON if you do nothing, which is fine for many applications.
If you do want to turn the backlight ON/OFF, you need to define pin 10 as an output and drive it LOW.
The problem is that if you want to then turn the backlight back on by driving pin 10 HIGH, a design error on these boards will cause the pin 10 output of the Arduino to basically be shorted to ground through a transistor which can damage the Arduino. The same thing happens if you try to use PWM to dim the backlight. This problem exists on many boards sold on the internet since they all use a common design.
To safely turn the backlight ON and OFF, use the following method:
- First set pin 10 to LOW once during setup.
- To turn backlight ON, set pin 10 as an INPUT. The pull-up resistor then pulls the signal HIGH to turn on the backlight.
- To turn backlight OFF, set pin 10 as an OUTPUT . Since it was set to LOW originally, as an output it will drive the signal LOW and turn off the backlight.
- Note that using PWM on pin 10 to dim the display still cannot be used.
The program below implements this scheme for safely turning the backlight on/off when the SELECT button is pressed.
The other buttons will report that the button was pushed and will also printout the ADC value that was read which told it which button had been pushed.
The software below uses the Arduino “LiquidCrystal.h” library to test the functionality of the module.
LCD1602 16×2 Blue LCD With Keypad Shield Example Program
PACKAGE INCLUDES:
- LCD1602 16×2 Blue LCD With Keypad Shield