Go Down

Topic: 74LS151 & Keypad (Read 3204 times) previous topic - next topic

tcox8

Hello,

I have a 3x4 matrix Keypad. Instead of using 7 pins on my Arduino Uno I thought I would multiplex it. I have some 74LS151's laying around but I'm not sure if that will gain me much. Seems that I am only freeing up 1 pin using that IC? I would appreciate any feedback on the following:

1) Is this possible (using a 74LS151 to multiplex the 3x4 Keypad?
2) Does the 74LS151 require 6 pins on the arduino (3 Selects, 1 Strobe, 2 outputs) or am I looking at it wrong?

Paul__B

A 3 by 4 keypad is multiplexed.  You have to select a column and read a row, or vice versa.

You are right.  Using the obsolete 74LS151 (it uses power just to keep warm!) would save only one pin.  You would select one of three columns, and use the 151 to read the rows in turn.  You would use two pins to select which row, and one to read the result.  Total six pins.

You want a keyboard encoder - 74(H)C922.  That gets you down to five pins.  There are ways of using shift registers to reduce the number to less, and if you were already using other shift registers, it could be using pins already used for the others.

tcox8

Thank you for your feedback!

Note: the 3x4 keypad is a 12 digit keypad with 7 pins (I know it is multiplexed already but I was looking to increase the number of free pins on the arduino)

What about using the 74HC595? Looks like that would get it down to 3 pins.

http://www.instructables.com/id/Multiplexing-with-Arduino-and-the-74HC595/

Paul__B

Note: the 3x4 keypad is a 12 digit keypad with 7 pins (I know it is multiplexed already but I was looking to increase the number of free pins on the arduino)
Yes, so four outputs and three inputs, or vice versa.

What about using the 74HC595? Looks like that would get it down to 3 pins.
What about it?  How would you use a 74HC595 to multiplex inputs?

Citing an "instructable" - and that one is clearly no exception - is considered akin to swearing here.

tcox8

What about it?  How would you use a 74HC595 to multiplex inputs?
Duh! Now I just feel stupid.  :smiley-confuse:

Citing an "instructable" - and that one is clearly no exception - is considered akin to swearing here.

Sorry about that. But thanks for the help. I appreciate it!

PaulRB

#5
Mar 11, 2016, 02:51 pm Last Edit: Mar 11, 2016, 03:19 pm by PaulRB
How about a i2c i/o expander? Only 2 pins needed but they must be A4&5 on Uno. If you are already connecting other i2c devices then this solution uses no extra pins at all.


What else is connected to the Arduino? There may be other, easier ways to save pins.

Paul

tcox8

That could work. I also have some CD4021BE Shift Registers that I am thinking of using.

The big picture of this project is an activity board for my son. The keypad is from an old touch-tone phone. I have it playing .wav files of the touch tones which I think is pretty slick.  I also have it ringing with the push of a button. There are several switches and lights that I plan on having light up but haven't got to that part yet. I am also planning on using rgb leds that will be color controlled based on what switches are flipped (I have 3 switches with the three different led's built in). Lot's going on here but I am trying to compartmentalize it all.

PaulRB

#7
Mar 11, 2016, 03:19 pm Last Edit: Mar 11, 2016, 03:22 pm by PaulRB
Another approach would need only 4 pins and no extra chips, but one of the 4 would need to be an analog input. You would make a resistor ladder from 4 equal resistors, say 2K3, to feed the analog input. Then scan the 3 columns with the 3 other pins.

tcox8

My first try was something similar except also having a resistors on the columns as well. Then to measure the voltage using one analog pin. It worked but wasn't very accurate because depending on how hard you pushed the key on the keypad you could get totally different values.

PaulRB

Ah, right, i know the sort you mean.

Paul__B

Well, that's the difference.  The original Touch Tone™ keyboards used real push switches.

PaulRB

#11
Mar 11, 2016, 06:52 pm Last Edit: Mar 11, 2016, 07:35 pm by PaulRB
Something like this?

Might also have to connect Q6 to P6, Q7 to P7 & Q8 to P8.

Grumpy_Mike


PaulRB

You can charlieplex it
Now that is clever!

@tcox8, you could add 4 of your other switches into the same matrix as your keypad, making it 4x4, and save even more pins.

tcox8

You can charlieplex it:-
@Grumpy_Mike - Brilliant! Thanks for this! I only wish I had waited to order my ICs.  >:(


@tcox8, you could add 4 of your other switches into the same matrix as your keypad, making it 4x4, and save even more pins.
@PaulRB - Yet another brilliant idea!

You guys rock!  :)

Go Up