2026-04-24 7:53 AM - edited 2026-04-26 1:15 AM
I'm faced with connecting a (piano) keyboard to an MCU using a number of columns and a number of rows.
The principle is shown in the attached photo. I've read approaches where the coulmns are pulled to low while the rows are inputs that are sensed.
Am I right that with the given arrangement it would be appropriate to set the columns to "HIGH" and sense the rows whether they are "HIGH"?
Excuses, forgot to say which MCU: it's an STM32F103C8T6 here.
The diodes are common practice to avoid so called "ghost hits" when multiple contacts are actuated.
2026-04-24 7:54 AM
Hello,
Could you please state what STM32 are you using?
2026-04-24 8:00 AM
Explain for what you use diodes here?
2026-04-24 8:07 AM
I edited the original message.
2026-04-24 8:15 AM
This explains the purpose of the diodes quite nicely.
2026-04-24 9:12 AM
Yes i know for what, but miss your piano info then multipress detecting require it. More safe method is use pullups in MCU and OD (open drain) mode for line scaning to GND...
2026-04-24 11:28 AM
Requirement is to detect every key press, also multiple ones, but avoid wrong ones (ghost).
2026-04-25 2:39 PM
Could you explain the circuit then to catch every key pressed. Pullups to what, outputs, inputs or both?
Pull to ground using open drain?
2026-04-26 12:49 AM
Without diodes for only one key at time, but safe press more. With diodes multi key allowed.
in your variant if no diodes or failed diode you can short with two buttons press out high to out low , result to destroy out driver pin ... With open drain and internal pull ups no risk.
2026-04-26 1:15 AM
And the 0.7V forward voltage is recognized safely as a logic "0"?