Arduino Nano - Keypad - LCD
This tutorial instructs you how to use Arduino Nano to display the input from keypad on LCD display.
Hardware Preparation
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Overview of Keypad and LCD
If you are unfamiliar with keypad and LCD (pinout, how it works, how to program ...), the following tutorials can help you:
Wiring Diagram
This image is created using Fritzing. Click to enlarge image
See The best way to supply power to the Arduino Nano and other components.
Arduino Nano Code
※ NOTE THAT:
The address of the LCD may differ depending on the manufacturer. In our code, we have used 0x27, as specified by DIYables.
Detailed Instructions
- Connect an USB cable to the Arduino Nano and the PC.
- Open the Arduino IDE, select the appropriate board and port.
- Click to the Libraries icon on the left bar of the Arduino IDE.
- Search for “keypad” and locate the keypad library by Mark Stanley and Alexander Brevig.
- Press the Install button to install the keypad library.
- Search for “LiquidCrystal I2C” and locate the LiquidCrystal_I2C library created by Frank de Brabander.
- Then, click the Install button to install the said library.
- Copy the code and open it in Arduino IDE.
- Click the Upload button on Arduino IDE to compile and upload the code to Arduino Nano.
- Press certain keys on the keypad
- Check out the outcome on the LCD display
If the LCD does not show anything, . check out Troubleshooting on LCD I2C for help.
Code Explanation
Check out the line-by-line explanation contained in the comments of the source code!