Rigid 4x4 keypad decoder - voltage drop

Hi guys, I am trying to implement a keypad decoder: it has 8 digital outputs, 4 that indicate the row of the pressed button, and the other 4 associated with columns. There are green LEDs that serve as a visual indicator. Here is the design I made in circuitjs and Proteus, with a 10mA current for each LED in mind, it works perfectly:

Each optocoupler has a pull-up resistor output, that gives 0 when the associated row is pressed; the same idea is used on the 2n2222a transistors, they give 0 at the output when its column is pressed, There is a group of capacitors for debouncing, and I intend to use a schmitt trigger to smoothen the signal.

In circuitjs, this is my representation of the keypad with my circuit (15k base resistor works fine, like 10k in Proteus):

The keypad I am using is:

I have implemented my circuit in a protoboard, following the same wiring, due to lack of components I am scanning one button at a time, alternating row and column pins; for the buttons that belong to the first row, the LEDs turn on as expected, however for the other rows, I see a voltage drop between the column and row pin (between 1V and 1.8V, depending on the LED color used), this drop causes the 2n2222a to not "turn on", not allowing its column LED to activate.

Any ideas on why this happens? Simulation works as intended.

Why have you made scanning a simple keypad so complex? You literally need 8 Arduino pins and that's it. No resistors, transistors, capacitors or opto-isolators.

If you need to reduce the number of arduino pins required, use a pcf8574 I/o expander.

Yeah its a college project, I have worked with the scanning algorithm before but wanted to go for something different this time, something to implement on a pcb.
Sadly that expander isnt available in my country :frowning: any ideas on why that drop happens though?

There are many other port expanders available. Before port expanders we used shift registers.

No idea. Who cares? You made it over-complicated and it doesn't work. Make it simple and it will work.

Why do you say that i/o expander is not available in your country? You clearly have internet access. Do you have no postal system in your country?

Thanks to the insight from electrical engineering forums, I found the problem, just had to take into consideration the forward voltage of the optoisolator and the internal resistance from each row. Changed a few things and now it works wonders, pcb is ready for manufacturing :slight_smile:
Thanks for nothing, huevonazo

You appear to be wasting resources building an over-complicated circuit which could be so much simpler. Please explain to the forum what advantages your design has to justify that complexity.

Please don't judge the entire forum by the actions of a few.
Glad you got it working
Have a nice day!

@jim-p since you approve of the circuit used by @Double_Helix, please explain it's advantages over the simpler circuits normally used to scan 4x4 keypads.

I neither approve nor disapprove.

I'm glad to say that I am one of the "few" on the forum who is willing to point out when a circuit or sketch is over-complex and wasteful of resources required to achieve its goal and had no advantages to justify it.

I sincerely hope that if I asked the forum for help with a circuit or sketch that fell into that category, one of the "few" would point out my folly and I would have the wisdom to put aside any pride I had in my over-complex design and, at the very least, carefully consider that they might be right. I would not want the forum to congratulate me on getting my over-complex design to work and not point out that fact just to avoid the risk of hurting my pride.