Overview
In this tutorial, we will learn how to interfacing 4*4 keypad with Arduino by a single analog pin. The use of a lot of pins can be reduced by following this procedure. It helps to use rest of pins for another purpose. For this tutorial, we will use a single analog pin to interfacing keypad with Arduino.
You can watch the following video below:-
Components Required
The required components list for this tutorial given below:-
Keypad Pinout
The following below figure shows 4*4 keypad pinout.
Circuit Schematic
The given below schematic is single wire keypad with Arduino:-
Fig 3.1: One wire keypad with Arduino |
Circuit Description
One single analog pin keypad control based on basic voltage divider role. The voltage increase gradually from left to right (Fig: 4.1) in the row and up to down (Fig: 4.1) in the column. The voltage is minimum at the first-row first column and the maximum voltage is at point row 4 and column 4. Three 4.7k ohm resistors will gradually connect between row 1 to 2, 2 to 3, 3 to 4. Similarly, three 1k ohm resistors will connect between column 1 to 2, 2 to 3, and 3 to 4 respectively. The remaining one 1k ohm resistor will go to ground from column 1. Next +5V will connect with row 1 and analog input A0 pin from Arduino will connect with column 1.
Fig: 4.1 |
Fig 4.2: One wire keypad with LCD using Arduino |
Source Code
One wire keypad with Arduino source code is given below:-
One wire keypad with LCD using Arduino source code is given below:-
You can download the library here: https://github.com/AndrewMascolo/OnewireKeypad
You can download the library here: https://github.com/AndrewMascolo/OnewireKeypad
I tried this example and it appears that once I interface my esp microcontroller with an LCD module and and rfid reader, the keypad voltages fluctuates drastically. i can't exactly use a particular voltage range anymore for each key pressed
ReplyDelete