Introduction: DIY LCD Keypad Shield for Arduino Uno
i searched a lot for making a DIY LCD Keypad shield and i found none so i made one and want to share with u guys.
Step 1: Parts Required
- a Arduino Uno
- 16x2 char disply
- male and female Header pins
- Zero pcb
- couple of resistors
- a 10k pot (get one solder friendly )
- 5 push buttons
- some small pieces of wires
- TOOLS REQUIRED
- a cutter (for cutting zero pcb )
- a soldering iron
- some wire
- a wire clipper
- thats alll
Step 2: The Theory Part (imp)
The LCD keypad shield use a very clever and neat Technique that is reading buttons from Analog read pin A0
that's a cool thing.
The secret is VOLTAGE DIVIDERS
so what is a voltage divider.
A voltage divider is a simple circuit which turns a large voltage into a smaller one. Using just two series resistors and an input voltage, we can create an output voltage that is a fraction of the input.
yeah i copy pasted it from google ;-)
so now we need to make a voltage divider between 5v and A0 of arduino
and there will be 4 different voltage dividers and each will come to life as we press the button
and that's how we get different inputs at a single pin.
Step 3: THE LIBRARY and RESISTOR CALCULATION
Now we know that how to take inputs
but what value of resistors for voltage dividers we need
our base voltage is 5v.
according to LCD Keypad library written by dzindra on GitHub
the link is:-
in LCD Keypad.h
// you can change thresholds for detecting key presses
#define KEYPAD_TRESHOLD_NONE 1000
#define KEYPAD_TRESHOLD_RIGHT 50
#define KEYPAD_TRESHOLD_DOWN 380
#define KEYPAD_TRESHOLD_UP 195
#define KEYPAD_TRESHOLD_LEFT 555
#define KEYPAD_TRESHOLD_SELECT 790
so the thresholds hold is analog read of pin A0
accrding to my readings
150k as base resistor (all other are based on it )
250k - select
82k - down
15k - up
2 ohm -right
# if you dont have any values u can go slightly up or down because we need to just be in that threshold.
Step 4: Start Making LCD (CONNECTION)
Now grab the parts and resistors you calculated and start making
cut the zero pcb to the size of Arduino uno
add male headers to board
* the pins connected to lcd are
#define KEYPAD_LCD_PINS 8, 9, 4, 5, 6, 7
mount male headers
Analog pins are good with zero pcb wholes
BUT u need to slightly bend digital pins (to Adjust it)
LCD RS pin to digital pin 08
LCD Enable pin to digital pin 09
LCD D4 pin to digital pin 4
LCD D5 pin to digital pin 5
LCD D6 pin to digital pin 6
LCD D7 pin to digital pin 7
Additionally, wire a 10k pot to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3). A 220 ohm resistor is used to power back-light and its controlled by pin 10
Step 5: Mounting the Lcd and Soldering Buttons
i wanted my lcd to be removable so i used a female header
just bend the connection pins so that they can be soldered on pcb
add the pot accordingly
Step 6: Soldering the Buttons on the Zero Pcb
i soldered 4 keys and select to another side .
you can solder it wherever you prefer and its ready to use
THE PIN-OUTS OF PUSH BUTTONS ARE :
THE * marked corners are normally open and on pressing the button they get connected
We have a be nice policy.
Please be positive and constructive.