2

I have reverse engineered a membrane keypad that connects to a microprocessor.

I have no info on the keypad but it has 39 switches. The output of the keypad is an 11 way ribbon cable. This goes to a small PCB with resistors and diodes - nothing more. Total of five diodes and 6 resistors.

This suggests a 5x6 matrix but that only provides for 30 switches.

Even if I have in some way double counted switches and there are only 30 it still doesn't explain the fact that there are only 6 connections back to the processor from the 6 resistors.

How can the processor read even 30 switch states using just 6 lines?

I can't figure out what is going on.

This is the rough drawing of the circuit as requested. I am fairly confident that it is accurate as there are no active components on the board.

circuit

mike james
  • 23
  • 4
  • It depends. What if you miscounted and it's only 25 switches? If you are not sure about the number of them, it's hard to guess anything. Are you sure about the 6th resistor being disconnected? You might also try to map the matrix by using a multimeter's diode/continuity mode and pressing keys. – Uncle Dino Aug 29 '21 at 14:18
  • Tri-stating may allow magic. || One quick maybe. A driven line may be high low or float. Diodes allow only say high and float to. Some switches. Backwards diodes allow only low and float if driven from the other direction. By suitable drive and read in both directions you get more combinations. I haven't compared this to Charlieplexing. (Sitting on edge if bed and should be asleep :-) ). Anon maybe. – Russell McMahon Aug 29 '21 at 15:04

2 Answers2

2

A standard matrix scanning method using N IO lines can decode a matrix of \$ (\frac N 2 )^2 \$ keypad switches. Half are used as outputs and half as inputs. Charlieplexing uses all as outputs and all as inputs and so can scan \$ N^2 - N\$ switches.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. A "Charlieplexed" keypad arrangement. Note that each column of switches can't feed a switch back onto the line its diode is connected to.

How it works:

  • All inputs have pull-down resistors, not shown.
  • When J1-1 is pulled high the other lines monitor SW1 to SW5.
  • When J1-2 is pulled high the other lines monitor SW6 to SW10.
  • Etc.
  • The diodes prevent backfeeds from one line to another.

That gets you 30 switches for only 6 IO lines. (It won't get 39 with that arrangement - if 39 is possible at all.)

Transistor
  • 168,990
  • 12
  • 186
  • 385
  • Charlieplexing! -- I couldn't remember what it was called but I do vaguely remember it. I think you have nailed it. I am surprised to find it being used in a piece of commercial equipment however. – mike james Aug 30 '21 at 09:16
1

Assuming 30 buttons, the buttons are organized as a matrix of 5 rows and 6 columns (or 6 columns and 5 rows but it does not matter).

The 5 rows and 6 columns add up to the 11 wires you counted.

The 5 rows are scanned one at a time and from each row the state of 6 buttons of the row can be read.

Justme
  • 127,425
  • 3
  • 97
  • 261
  • I think you missed the statement that there are actually 39 switches. – Elliot Alderson Aug 28 '21 at 19:48
  • @ElliotAlderson There is also a statement that the switches may have been double counted and there may be 30 switches, and the final question asks how can a processor read 30 switches. – Justme Aug 28 '21 at 20:38
  • I think you also missed "there are only 6 connections back to the processor". – brhans Aug 29 '21 at 01:31
  • Yes I thought of scanning the lines but there are only resistors and diodes on the adaptor board between the membrane and the processor. I can't see how 6 wires can be multiplexed to an 11 wire matrix with no additional hardware. You could scan the five rows but that doesn't tell you which of the switches is closed. I really want to know how it works or what I'm missing because I think I will learn something. – mike james Aug 29 '21 at 09:14
  • Well, I based my answer what you told and you seem to be unsure about the circuit, then with the additional info that only 6 lines ever are connected to MCU instead of just 6 lines connected back to processor, then you should provide a picture of the circuits. There might be diodes isolating buttons so some are scanned by pushing high and some are scanned pulling low, similar to charlieplexing LEDs. – Justme Aug 29 '21 at 10:04
  • @mikejames if you want to add more your information, please add them to your question instead of editing your added information to people's answers. – Justme Aug 29 '21 at 11:45
  • Sorry!!!! I thought I had -- I didn't scroll up enough to see the original question and thought the quote was it – mike james Aug 29 '21 at 13:31