Wiring keypad in cube instead of matrix

As common switches only have two terminals they can only be connected to two dimension planes. Okey, 2 switches can share one "plane".....
Using 6 I/O, like in Your example, a 2 dimensional rigging handles 9 buttons, one more then the 8 in Your example.

Isn't that what I wrote?


In the image my 1st post, I have switches with 2 terminals, what's the problem?

Sure, you can Charlieplex a keyboard too. No gates or transistors, just diodes.

You could have a 3x9 matrix, and envision folding it up into a 3x3x3 cube mechanically, and still keep the 3x9 wiring going.
Still uses the same number of pins.
Physically, I don't have a need for a cube of buttons, and think it would be awkward to use, having to move you hand in and out of the cube to transition between layers. Maybe you have something else in mind.

The idea was to have the switches layed out in a 2D matrix, but have them wired as a 3D cube to save pins.
I just wanted to share the idea, I don't really have a need for it myself.
I'm guessing that, most likely, the extra costs of the components would make it cheaper to just buy an additional micro controller. But still, I thought it was an interesting idea to explore.

Cool. Never heard of charlieplexing before, very interesting.

So really, you're adding extra electronics as sort of an enable line for what could be envisioned as additional layers, or sections of the 2D matrix.
Could be as simple as 74HC125 gates, where the switch is allowed to drive the matrix when the output is enabled. Or something larger, like the equivalent of 74HC244, with 1 enable to support 8 Ins & Outs.

Exactly.

Nice, those were actually cheaper than I expected, perhaps it's economically viable anyway. Interesting.

But 3 pins have 8 different options. With multiplexers and demultiplexers you could drive an 8x8 matrix with 6 pins.

Or you could use four pins to drive two shift registers: Clock, Data Out, Data In, and Latch. That would get you 64 keys with four pins. :slight_smile:

That's actually a great point. Haven't seen any design use those. As each column is scanned 1 at a time, a demultiplexer can easily be used for that, so that's kind of a no-brainer. But what would you use a multiplexer for? Multiple rows can be activated at once for the same column and you want to detect each of them, so I don't really see how you would do that.

Are you sure about that?

Instead of demultiplexers, decoders can also be used I guess.

Yes, I'm sure you can Charlieplex a keyboard. If you can turn on a single LED that way, you can select a diode/switch pair in exactly the same way. Thought experiment - Charlieplex a bunch of LEDs. Now put a switch in series with each LED. When you select a given LED, current will flow if and only if the switch is closed. Now measure the impedance across the two select lines you used to select that LED. But the driving circuit has to be reconfigured constantly to allow for the bidirectional polarity of opposing diodes.

OK, well you need to specify that by "just diodes", you actually meant LEDs.

And preferably green ones, not red!
No, I take that back. Green LEDs are likely not to work, with threshold over 2.5 V. By the same token, red LEDs are the correct ones to use. :+1:

Why is that? Is the higher voltage drop of a led, compared to other types of diodes, required?

From what I understand, you can't, in most applications, because both musical keyboards and typing keyboards need to be able to deal with multiple keys pressed at once. With Charlieplexed key matrices, you can't avoid "phantom" key presses appearing when multiple keys are pressed. So only applications where it would be the case that only one key is ever pressed at once would Charlieplexing be used. Am I right?

In my opinion, this way of connecting is very complicated and unjustified. If I needed a lot of buttons I would use several 74HC595 registers connected in series and 1 Arduino pin as input. Thus, each added 74HC595 adds 8 buttons and the number of required Arduino pins remains the same - 3 for registers control and 1 for reading a pressed button, ie. total 4. Or I would use an IR remote control connected with a cable and in this case I will need only 1 pin - with 2 wires from the IR diode to 1 pin of the Arduino and ground connection.

Without diodes, you are right. But with one diode for each key, you would have full n-key rollover.

Yes.

OK, I was waiting for aarg, but I will reveal the secret. "Phantom" paths. :sunglasses:

That's it. You can avoid it by selecting the LED voltage such that one LED drop (1.8 V) pulls the logic down (or up if you use it that way) past the threshold, but two LED drops (3.6 V) will not.

For Charlieplexed LED displays, you may have a problem with red LEDs, or with higher than 5 V.

Well, your opinion. :roll_eyes:

Ah! Latecomer!

Yes, with red LED diodes. :grin:

Actually, without diodes, you lose half of the switch positions. :astonished:

Charlieplexing is based on the use of diodes (and thresholds). It does not work for incandescent bulbs.

Yes, the simplest Charlieplex is two back to back diodes. So, 2 LEDs on 2 wires.