You are on page 1of 5

16/01/2024, 13:00 Arduino Keypad and LCD Interfacing with Code | ee-diary

ee-diary Home  Electronics  MCU  Instruments/Calculators  Web & IoT  RF PCB  

Home  arduino

Arduino Keypad and LCD


Interfacing with Code
by ee-diary • September 21, 2020 •  3 min read 0

In this Arduino electronics tutorial, you will learn how


to interface Arduino with keypad and LCD, how to use
Arduino Keypad library and how to code Arduino
Keypad with LCD. Here we will be using 4x3 Keypad
and 16x2 LCD. Also at the end you will find video
demonstration of how it works.

 Contents 

4x3 Keypad, LCD and Arduino on Breadboard

Below picture shows 4x3 membrane keypad, 16x2


LCD with Arduino UNO on a breadboard.

The interfacing is explained using wiring diagram


below.

4x3 Membrane Keypad

https://www.ee-diary.com/2020/09/arduino-keypad-and-lcd-interfacing-with.html 1/5
16/01/2024, 13:00 Arduino Keypad and LCD Interfacing with Code | ee-diary

ee-diary Home  Electronics  MCU  Instruments/Calculators  Web & IoT  RF PCB  

We will be using 4x3 Keypad as shown in the figure


below. This type of keypad is called membrane
keypad and are inexpensive and popular among
hobbies. The surface of membrane keypad are soft
and flexible and when pressed create a connection
with the underlying circuit. Underneath each key is a
coil shaped are inductors which induces
current/voltage signal when a key is pressed.

Membrane keypad are build using 3 layers. The top


and bottom layer are made up of conductive
materials while the middle one is non-conductive.
When key is not pressed or that is key is open, the
middle layer prevents the top and bottom from
coming into contract. But when key is pressed and
closed, the middle layer creates a small hole that
allows the top and bottom layer to come into contact
and induce current/voltage.

As you can see from the figure, the keypad has 7 pins
with 4 rows and 3 columns. The keypad starts with
rows and ends with the column. In the figure, the first
4 rows are labelled as R1, R2, R3 and R4 and the 3
columns are labelled as C1, C2 and C3.

Interfacing Keypad and LCD with Arduino


In the picture below you can see how to interface 4x3
Keypad and LCD with Arduino.

Popular Posts

https://www.ee-diary.com/2020/09/arduino-keypad-and-lcd-interfacing-with.html 2/5
16/01/2024, 13:00 Arduino Keypad and LCD Interfacing with Code | ee-diary

In the schematic diagram above, we have connected


ee-diary Home Electronics MCU
 Instruments/Calculators

the pins 7, 8, 9 and 10 of Arduino to the four row pins
 Web & IoT  RF PCB  

R1, R2, R3 and R4 of the 4x3 keypad. Similarly, the


Arduino pins 11, 12 and 13 are connected to the three January 10, 2023

columns C1, C2 and C3 of the keypad. Differences between Depletion and


Enhancement MOSFET

We have used the pins A5, 2, 3, 4, 5 and 6 to connect Basic BJT Differential
Arduino to the 16x2 LCD. The pin A5 and 2 are Amplifier Construction and
Analysis
connected to the RS and E pins of the LCD March 19, 2023

respectively. The pins 3, 4, 5 and 6 are connected to


Arduino PID Controller -
the D4, D5, D6 and D7 of the LCD. The R/W pin of the Temperature PID Controller
April 11, 2023
LCD is grounded. A 10KOhm potentiometer is
connected to the LCD with its middle pin to the Vee. what is phase shifter circuit
and how to build it?
The other sides of the POT is connected to +5V and
March 23, 2023 2
ground respectively. The Vss and Vdd of LCD are
ATmega328P Fast PWM
connected to the ground and +5V supply.
mode Programming
Examples
Program Code for Keypad Arduino with LCD July 18, 2021

The program code for Arduino to work with 4x3 Simple Amplitude
Modulation (AM) circuit
membrane keypad and LCD is provided below. In this 
using Single Diode
simple code example, we monitor for any key press Modulator
December 11, 2021
and when a key is pressed we sent that key pressed
to the LCD. Audio Amplifier design with
uA741 op-amp
November 24, 2021 4

#include <Keypad.h>

#include <LiquidCrystal.h> AD

// initialize the LCD

LiquidCrystal lcd(A5, 2, 3, 4, 5, 6);

ng.xpark.com
ng.xpark.com
const byte rows = 4; // set display to 4 rows

TECLAST P20HD 4GLte


const byte cols = 3; // set display to 3 columns
Network 4GB 64GB Android
10 4G...
char keys[rows][cols] =

{{'1','2','3'},

{'4','5','6'}, Topics

{'7','8','9'},
arduino RF op-amp IoT Electronics Oscillator
{'*','0','#'}}; filters AM WISP ATmega328p DC motor
Modulator amplifier LM358 Matlab NodeMCU
byte rowPins[rows] = {7, 8, 9, 10}; ATmega32 BJT ESP8266 FM Programming
Stepper Motor Simulink Multivibrator PCB
byte colPins[cols] = {11, 12, 13}; Diode Instrumentation JFET Node-Red Web
Server 555 Timer E-MOSFET Johnny-Five 741
Keypad keypad = Keypad( makeKeymap(keys), rowPins, col op-amp Arduino Simulink Project Calculator
transistor L293D Servo Motor filter calculator
web app Arduino Due DHT11 Demodulator
void setup () { Temperature Sensor Bluetooth L298N LM35
LM741 Arduino Matlab Projects Moisture Sensor
lcd.begin(16, 2); audio AD633 LDR LM324 Motor Shield PIR
sensor Photodiode EEPROM ESP12E Gas Sensor
lcd.print("Enter Number:"); IR sensor MOSFET Power Amplifier VCO
keypad D-MOSFET GSM HC-05 Humidity LM311
delay(3000); LM393 Sim900 TIP122 Thermocouple fiber-
optics AD8495 AI ATmega16 Accelerometer 
lcd.clear(); Control System Gyroscope Joystick LM566

https://www.ee-diary.com/2020/09/arduino-keypad-and-lcd-interfacing-with.html 3/5
16/01/2024, 13:00 Arduino Keypad and LCD Interfacing with Code | ee-diary
MPU-6050 MQ2 MQ3 OLED LCD PM TIP31C
ee-diary } Home  Electronics  MCU  Instruments/Calculators TL072Web
Ultrasonic
& IoT AD31855
 RFCMOS Darlington
PCB  
Transistor Flip-Flops HC-SR04 LM386 Laser
Diode Oscillator calculator PlatformIO RC filter
void loop() { Seven Segment Display Signal Generator
Sound Sensor VS Code Virtual Reality Visual
char key = keypad.getKey(); Designer phototransistor

if (key != NO_KEY){

lcd.print(key); Latest Tutorials


}

The Advantages of ESP32 LED Blink Tutorial


Joining PCBWay 02 January, 2024
Community
In this program we have used the Arduino Keypad
14 January, 2024
Library. You can install the keypad library by going to
Arduino IDE > Tools > Manage Libraries and search
for keypad.h and install the one by Mark Stanley and
Alexander Brevig as shown in the picture below.
PCBWay Advanced PCB PCB Assembly of
Manufacturing Minimum Arduino
01 January, 2024 Board
17 December, 2023

How to design State Types of Band Pass


Variable Band-Pass Filter circuit
Filter with Online 15 December, 2023
Calculator
15 December, 2023
 Figure: keypad library

Video Demonstration of 4x3 Membrane


Keypad Interfacing with LCD and Arduino
Below video shows demo.

membrane 4x3 keypad and LCD with Arduino…


Arduino…

You might be interested in other similar tutorials.

- Seven Segment Display with Arduino and Shift


Register

- LCD Display of Temperature and Humidity using


DHT11 & Arduino with Code

https://www.ee-diary.com/2020/09/arduino-keypad-and-lcd-interfacing-with.html 4/5
16/01/2024, 13:00 Arduino Keypad and LCD Interfacing with Code | ee-diary

ee-diary Home  Electronics  MCU  Instruments/Calculators  Web & IoT  RF PCB  

Tags: arduino, keypad 4.8 / 390 rates

 Facebook  Tweet Bookmar  Share


k

 You might like 

Post a Comment 

Enter Comment

 Previous Post Next Post 

    
This work is licensed under a Creative Commons Attribution 4.0
International License.

ee-diary.com @2020 About Contact Sitemap Direct Media Network Direct Media Pvt.Ltd.

https://www.ee-diary.com/2020/09/arduino-keypad-and-lcd-interfacing-with.html 5/5

You might also like