Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] How to detect whether Matrix Keypad is connected or not?

Status
Not open for further replies.

xpress_embedo

Advanced Member level 4
Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,154
Helped
161
Reputation
396
Reaction score
189
Trophy points
1,353
Location
India
Activity points
10,591
Hello Everyone,

I have a 4x4 Matrix Keypad and i successfully interface it with micro-controller.
Everything is working properly, but is there any way to detect whether matrix keypad is present or not present in the slot.
Actually in my project i have to generate error if Matrix Keypad is not present.
Any idea how can i implement it, do i need to modify my hardware.

Please suggest.
 

A matrix keypad with no key pressed is just an open circuit. It can't be detected as such. You'll need to add other identification elements, e.g. resistor connected between matrix lines or additional signals.
 

    V

    Points: 2
    Helpful Answer Positive Rating
Hi,

maybe with the increased capacitance.

swtich all lines to the default state (I assume pulled up)
then switch only one line to GND
Wait some ms
Then switch the same line to pull up. (If possible use a very weak pullup)
Read the port (and count the loops) until it becomes HIGH.

Without keypad it should be faster HIGH than with connected keypad.

I´m nor sure if it works. It depends on pullup value, and capacitance..

Maybe worth a try.

Klaus
 

    V

    Points: 2
    Helpful Answer Positive Rating
A matrix keypad with no key pressed is just an open circuit. It can't be detected as such. You'll need to add other identification elements, e.g. resistor connected between matrix lines or additional signals.

Hmm this will definitely work, but for this i have to order customized keypads with one such extra sensing signal. I think this is not possible in membrane based keypads available in markets/online.

- - - Updated - - -

swtich all lines to the default state (I assume pulled up) You means all rows and columns configured as input mode
then switch only one line to GND Sorry but i didn't get this point
Wait some ms
Then switch the same line to pull up. (If possible use a very weak pullup)
Read the port (and count the loops) until it becomes HIGH.

I am sorry i didn't understand this properly.
Can you please elaborate.
 

Assuming a 4x4 keypad, perhaps just adding 1 up to 4 diodes ( katodes tied together ) in parallel with the matrix polarized in the opposite direction of which is intended to scan the nibble, this way you could check at large intervals for existing connection. Indeed, this is suited to work only with routines that scan only one key pressed at a time - the standard procedure ( routines that read multiple keys pressed at a once, performs reading of entire nible, alternating row/column ).
 
its not possible with just the matrix keyboard. However you could do a key test, in the same way that is done by a PC during bootup (ie: check if a key is pressed by mistake or stuck), the criteria here is that during startup ensure no keys are pressed,

however this will not work if only the pullups are connected and not the keyboard.
 
Hi,

I am sorry i didn't understand this properly.
Can you please elaborate.

I don´t know what your default state is, because you don´t show us your schematic nor your code...

I can only assume, and that´s what I wrote....


Klaus
 
If you are able to change the electrical design, the simplest method is to fit the pull-down (or pull-up) resistors to the keypad itself. On one or more of the microcontroller input lines, connect a high value resistor pulling to the opposite polarity. Reading the lines without the keypad will show the high value resistor state, with it plugged in, the lower value resistors on the keypad will reverse the state. It isn't foolproof, it can mistake a keypad with all the keys held down at once as no keypad at all but that's an unlikely scenario.

Brian.
 
Hello Everyone,

I have a 4x4 Matrix Keypad and i successfully interface it with micro-controller.
Everything is working properly, but is there any way to detect whether matrix keypad is present or not present in the slot.
Actually in my project i have to generate error if Matrix Keypad is not present.
Any idea how can i implement it, do i need to modify my hardware.

Please suggest.

Simple method is to provide ground loopback to a logic with pullup input to detect device installed. When installed input becomes grounded, which can be 1 of many status bits in an addressable latch for self test or auto-config.
 
Thanks guys for your suggestion.

To detect Keypad without any problem i think ground loopback method suggested by SunnySkyguy is good.
 

If the keyboard lines are connected to lines that can be switched temporarily one to PWM and another one to ADC you could try generating a very high frequency pulse train sending it down the line and measure the disturbance it creates on the ADC line coming from electromagnetic coupling between lines from the cables or parallel traces in the keyboard's pcb. You could add an RF diode as rectifier and a small cap in the ADC linec to read DC from the rectification coming from the RF pickup.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top