3
\$\begingroup\$

I'm quite inexperienced with electronics in general, so there could be inaccuracies in this.

I have taken the circuit board from an old sky (cable/satellite) box that had some buttons on it. It has a 8 pin ribbon cable attached to it and 9 buttons. The only other components on the board are 3 diodes.

It's a fairly simple layout so I was able to use my multimeter and work out this diagram.

enter image description here

Now, I was planning to connect this to a micro controller, a pi pico to be specific. However I can't work out how I can read which button has been pressed. (aside from IO7 & IO8)

I was thinking that I could supply 3.3v on each of the diode inputs, but if I do that then multiple buttons can trigger the same IO output.

My next thought was that I could supply each of the input diodes one at a time, scanning the outputs before moving to the next input. I imagine I can do this on the controller, but wasn't sure if that's the best way to go about this?

Is this a common type of button setup? I'm happy to do a bit more googling if someone can give me the right keywords.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ It's called (button) multiplexing. Redraw the schematic with the buttons rearranged in the typical matrix layout you will find if you google that term and it'll make sense. \$\endgroup\$ Commented Apr 7, 2021 at 19:00

3 Answers 3

8
\$\begingroup\$

That is a button matrix which is read in a multiplexed fashion. Very common arrangement, almost everything that has many buttons like your PC keyboard or TV remote has a similar matrix.

General procedure is that the buttons are arranged as to connect certain "rows" and "columns" of the matrix together when pressed. A single row or column is activated at a time for reading, so based on that there are three diodes, there are either three rows or three columns depending on how you read the matrix, and thus it is possible to one third of the buttons at a time, whether they are pressed or not.

\$\endgroup\$
15
\$\begingroup\$

It would be much easier to understand if you rearrange schematic like this:

schematic

simulate this circuit – Schematic created using CircuitLab

Now you can see that by applying voltage to IO1 you can read the state of the buttons S6, S7 and S8 on wires IO4, IO6 and IO5 respectively. Same goes for other wires, except there are only 2 buttons to read instead of 3 when IO3 is active.

Note, that this is somewhat shoddy schematics, because it is possible to get wrong result if several buttons pressed simultaneously. Properly arranged diode matrix allows unambiguous reading of as many simultaneously pressed buttons as possible.

Also note, that you can jumper IO7, IO8 to D2, IO6. This way you'll be able to read all 9 buttons with same 6 wires.

\$\endgroup\$
10
  • \$\begingroup\$ Sorry, a side question I have to check my intuition of circuits - Diode D1 has IO1 at its anode and S7, S8 and S6 at its cathode. If S7, S8 and S6 are open, how can it be guaranteed what the state of the diode is? It should be determined by any stray or parasitic capacitances coupling onto the D1 cathode node, right (and IO1 of course)? It probably doesn't matter in this case, but if it did, would a pull-up or pull-down at that D1 cathode make sense to add? \$\endgroup\$ Commented Apr 7, 2021 at 23:32
  • 1
    \$\begingroup\$ When the buttons are open the diode state does not matter. However adding pull-down resistors on IO4-IO6 makes perfect sense, just as @timwescott suggested in his answer \$\endgroup\$
    – Maple
    Commented Apr 7, 2021 at 23:37
  • \$\begingroup\$ Thank you, I was just checking if my thought process was correct! \$\endgroup\$ Commented Apr 8, 2021 at 0:08
  • 1
    \$\begingroup\$ @OmarL If S7, S9 and S6 are pressed, for example, it is impossible to tell whether or not S2 is also pressed. This would be a problem for a computer or piano keyboard, where multiple keys need to be distinguished; I don't think it's much of an issue for a typical remote control keypad. \$\endgroup\$
    – nekomatic
    Commented Apr 8, 2021 at 10:51
  • 1
    \$\begingroup\$ @BrtH You are right. done. \$\endgroup\$
    – Maple
    Commented Apr 8, 2021 at 23:20
7
\$\begingroup\$

Connect IO4, 5 and 6 through resistors to ground. Hold just one of IO1, 2 or 3 high, and read IO4, 5 and 6.

If you look at your schematic, you should see how for all possible combinations of button presses you can scan through IO1, 2, and 3, and read the state of the keyboard.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.