Alternatives to LED for a 13 switch to three pin reduction.

Dear all,

Once again, I am asking for your inspiration and help.

Use case. On both nightstands, I am planning to have six TP223 Switches.
This would mean, that I needed 12 I/O pins.

Idea:
Let's assume, that only one of the switches gets pressed at once. Therefore, it should be possible to map those 12 signals to four I/O pins. (Four Bits)
The following schematic should allow me to do this.

  • Please note: all diodes were planned to be LEDs. Primarily, to prevent the current from flowing in the wrong direction and secondarily to help to debug.
  • Any cut connection is not related to this question. (Mostly PWM outputs)

    Link to schematic.

Issue: The voltage drop over the LED seems to be too large and therefore, no switch input is detected.

Question:

  1. Is my idea just plain stupid and there would be much easier ways to achieve my desire? (I.E. an IC that already does that for me. However, I didn't find one.)
  2. If this idea could work, but only with "proper" diodes, are there any THT Diodes you could recommend to me?
  3. Any other remarks are appreciated as well.

Hardware:
-NodeMCU V3 (The newer larger version)
-TP223 Touch sensor
-3mm LED

Thanks a lot.
Best
Gian

Link to schematic.

Please don't do that. Just attach images to your post, like this:

Unfortunately I cant make sense of it. There are no TP223 shown at all, for example.

The following schematic should allow me to do this.

.
With ordinary mechanical switches, you could connect 12 to 4 pins by arranging them, with diodes, as a charlieplexed matrix. Perhaps that's what you are suggesting?

You can't do that with TP223 touch switches, however.

Thanks a lot for your answers.

I am sorry about not showing the TP223s

Their signal lines are connected to the two 1x6 generic pins (One set is female, the other one male).

I hope, that this clarifies it a bit.

In the meantime, I have to figure out what charliplexing is and why it won't work for the TP223. But on the first glimpse, it could be what I want.

Yes, I see the issue with the TP 223s and Charliplexing.

I guess, in this case I would need normal diodes with less voltage drop or use a Multiplexer.

gian131294:
Yes, I see the issue with the TP 223s and Charliplexing.

I guess, in this case I would need normal diodes with less voltage drop

Then you haven't seen the issue yet.

gian131294:
or use a Multiplexer.

No, just use a pcf8575 or mcp23017. Or 2x pcf8574 or 2x mcp23008 if that's more convenient.

Yes, port extenders are the most sensible solution here. Dozens of such sensors on just two pins (I2C)!

The touch switches you talk about are probably TTP223, not TP223. Those normally have only one output, not two. If yours are different, do post a link to the actual modules you use.

Or 2x 74hc165, if you have them.