Things used in this project
This mini project shows you how to read a 3x4 matrix keypad and display the results on a 7 segment display via a 74HC595 serial to parallel shift register.
- Adafruits Membrane 3x4 Matrix Keypad
- 7 Seg LCD Display (common cathode is what I used)
- 330 resistor
- hookup wire
Connect the keypad to the Arduino to match this image
Connecting up the 74HC595
Make the following connections: GND (pin 8) to ground, Vcc (pin 16) to 5V OE (pin 13) to ground MR (pin 10) to 5V
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run. You can get around this by controlling the MR and OE pins from your Arduino board too, but this way will work and leave you with more open pins.
Arduino Connections to 74HC595
DS (pin 14) to Ardunio DigitalPin 11 (blue wire) SH_CP (pin 11) to to Ardunio DigitalPin 10 (yellow wire) ST_CP (pin 12) to Ardunio DigitalPin 9 (green wire)
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1"f capacitor on the latchPin, if you have some flicker when the latch pin pulses you can use a capacitor to even it out.
Connecting 7 Seg Dispay to 74HC595
I used a common cathode seven segment display which means the middle pin on the top (pin 9) and bottom (pin 3) of the display would be connected to ground via a 220ohm current limiting resistor (pins 3 and 9). Starting with D0 of the 74HC595 (pin 15) I connected to the dot segment on the 7 segment display, and followed around connecting D2 - D7 to the remaining segments.
I use trial and error to figure out what my bit map would be. You can look at the symbols array in the code and compare the bits being turned on with the segments that it takes to make that number. For example. to display a character number 1 on a seven segment display we need to turn on segments 'c' and 'b'. The bit pattern to do that is B00010010, so we can conclude that D1 connects to the c segment and D4 to the b (notice when making a 6 that D4 is off while D1 is on, that is how I knew D1 connects to the c segment and b to the D4)
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!