Go Down

Topic: Uno interfacing to system with scanned keypad (Read 5216 times) previous topic - next topic

dc42



If it's a 4x4 keypad, then you don't need all 8 ways of the 4051, you only need 4 ways. So you only need to drive 2 of the select lines of each 4051. Plus one of the inhibit pins (or both connected together) so that you also have the state of no key pressed. So you only need 5 Arduino pins in total.

He did spec a 4 by 8 matrix - not the earlier system described in the video above.


OK, so 6 pins needed then (3 for one 4051, 2 for the other, and one common inhibit) - assuming he needs to simulate pressing all 32 keys.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

SiriusHardware

#16
Sep 23, 2013, 10:37 pm Last Edit: Sep 23, 2013, 11:13 pm by SiriusHardware Reason: 1



If it's a 4x4 keypad, then you don't need all 8 ways of the 4051, you only need 4 ways. So you only need to drive 2 of the select lines of each 4051. Plus one of the inhibit pins (or both connected together) so that you also have the state of no key pressed. So you only need 5 Arduino pins in total.

He did spec a 4 by 8 matrix - not the earlier system described in the video above.


OK, so 6 pins needed then (3 for one 4051, 2 for the other, and one common inhibit) - assuming he needs to simulate pressing all 32 keys.


Actually, the system in the video above DOES use an eight line by four line keypad matrix, but with many of the intersections not occupied by keys. The reason for this odd arrangement is that the eight lines are also used as drive-low lines for the common cathode terminals of the eight seven segment displays. And look again - there are actually 20 keys on the keypad, not 16. They are more widely spaced across than they are deep, in order to put them in the same positions as the original membrane keypad keys were.

SiriusHardware

#17
Sep 23, 2013, 11:03 pm Last Edit: Sep 23, 2013, 11:17 pm by SiriusHardware Reason: 1


I would use the INH lines as well (so four Arduino port pins per 4051) to make them disappear from the scan lines when they were not actually generating a key press.


Of course, that goes without saying, but the two inhibit/ enable lines are common; connected together, so seven lines overall.

You can always use a shift register if the number of lines becomes a concern.

Addenda: No, you don't of course really need the inhibit/ enable lines because you are not using all of the selected options on the multiplexers, the one controlling four row lines will have four open "ports" which can be selected.  You can either use the inhibit, or the third select line to effectively disable the selection, total remains six control lines in all.  As we are talking about (old) digital logic, it makes no real difference whether the common line between the two multiplexers is entirely floating or not when disabled.

What may be a concern, and the reason that I mentioned digital multiplexers/ demultiplexers may be more appropriate, is the nominal 250 ohm "on" resistance of each 4051 when operated at 5V.



The series resistance of the two muxes combined will not be a problem. The target system's outputs to the keypad matrix are strong current sink outputs and the target system's inputs from the keypad matrix are pulled up by 4K7, so 500R (approx) series resistance for the pulldown will comfortably give a logic 0 state when required - and I gather the series resistance is actually somewhat lower.

I agree that the 4-line MUX could be disconnected by just selecting a channel higher than 03, but I have to think about what will happen to the various lines as the Arduino goes through its reset phase - ideally, everything should definitely be held inactive during that time so it remains totally hands-off from the target system until I actually want it to start pressing keys. I had in mind to have a fairly strong pullup on the _INH / _EN pins so that only an intentional low drive out from an Arduino pin would activate the 4051s.

I've decided to give both methods (my original arduino-only setup) and the multiplexers idea a try. The latter would be a great system to use for general repetitive setup/programming of all sorts of systems which can only be programmed via a keypad - just temporarily disconnect the keypad (or leave it connected), connect the arduino / mux interface to the keypad connector, upload a keypress file to the arduino and watch it programme the system / device.


Go Up