Using 1602 LCD Keypad Shield W/ Arduino [+Practical Projects]
by Electropeak in Circuits > Arduino
17400 Views, 11 Favorites, 0 Comments
Using 1602 LCD Keypad Shield W/ Arduino [+Practical Projects]
You can read this and other amazing tutorials on ElectroPeak's official website
Overview
In this tutorial, you’ll learn how to use Arduino LCD keypad shield with 3 practical projects.
What You Will Learn:
- How to set up the shield and identify the keys
- How to scroll text
- How to display special characters
1602 Arduino LCD Keypad Shield Features
Displaying information in electronic projects has always been the most compelling issue. There are various ways to display data. These screens can be so simple such as 7segments or LEDs, or they can be more fascinating such as LCDs. Using LCDs has always been one of the most popular ways to display information. LCDs are divided into two generic types: Characters and Graphics.
One of the most common, cheapest and simplest LCDs available is the character LCD. This LCD consists of several rows and columns. Letters and numbers are written in places created by rows and columns. For example, LCD character 16*2 has 2 rows and 16 columns. So it can display 32 characters. Working with these LCDs is very simple and they have full compatibility with all microcontrollers and processor boards. For easier use of these LCDs, its 16x2model, including four keys for making the menu, is made as a Shield which is also compatible with Arduino boards.
How to Use Arduino LCD Keypad Shield
Arduino shiels is a user-friendly and simple shield. To use it you need to know its pinout and its connection to Arduino at first.
Required Materials
How to Read the Keys?
In this shield, all 4 keys are connected to the analog pin 0 to save on digital pins. So we should use ADC to read them. When you press a key, it returns a value to the A0 pin according to the internal resistive splitting circuit, which identifies the type of the key.
Let’s take a deeper look at the code:
#include <LiquidCrystal.h>
The library you need for character LCD.
LiquidCrystal LCD( pin_RS, pin_EN, pin_d4, pin_d5, pin_d6, pin_d7);
Defining the LCD object according to the pins that are connected to Arduino.
lcd.begin(16, 2);
Initial configuration of the LCD by specifying the number of columns and rows. The first argument is the number of columns, and the second is the number of rows.
in the above table are some of the important functions to work with LCD.
You can check the Arduino website for more functions.
Downloads
How to Scroll a Text?
We can do it easily using the above functions.
Downloads
How to Display a Specific Character?
You can create a character in each block from your LCD. To do this, you should convert your desired character to an array of codes, then display it on LCD. To convert your character to codes you can use online websites like this. Design your character, then copy the generated array to your code.
lcd.createChar stores your array in a memory location and you can display it withlcd.write
What's Next?
- Try to create a menu with ability of selecting options.