Multiplexing
Created: 2023-11-11 06:21:24 -0800 Modified: 2023-11-11 06:27:18 -0800
Background
Section titled BackgroundThis is sort of weird background information, but every once in a while, I would try to think of how multiplexing works in a keyboard, but I would end up being confused about something or another.
Overview (reference)
Section titled Overview (reference)- The goal is to minimize the number of I/O lines needed.
- If you wanted to have 12 switches without multiplexing, you’d need 12 inputs. With multiplexing, you organize the inputs and outputs in a grid. E.g. in a 3xt grid, you would have 4 outputs leading to your switches, then the switches lead to 3 inputs (for a total of 7 I/O lines instead of 12).
- The outputs normally emit logic high, but a logic-low signal is moved through each of them sequentially, then the inputs are inspected in each of these phases. If any switches are pressed, the corresponding input will read zero.
- For my Corne, the Pro Micro microcontroller has 18 I/O pins, which is more than enough for the 18-21 keys that it supports for each half. E.g. a 6x4 grid would support 24 keys and only take 10 of the pins.
- For a traditional 108-key keyboard, you would typically have a 6x18 grid (or 24 GPIO pins) (reference).
- There are other ways to do multiplexing, e.g. with a resistor ladder (reference), but I just wanted to jot down some notes to remember how a single form works.