Monday, July 11, 2016

Diodes

LEDs do not work as diodes in a keyboard matrix

Six "diodes" tested
  • BYV10-40 Schottky
  • 1N34A Germanium
  • 1N4001 Silicon
  • 1N4148 Silicon
  • Red LED 1.8mm
  • White LED 2x3x4mm
According to the AtMega32U4 datasheet, at a Vcc of 5volts, for a pin to read as low it must be below 0.9volts. To read as high it must be over 1.9volts.

When a switch is pressed that column (data pin) is pulled to ground through the diode and should read as low. When no switch is pressed that column remains in a high state, pulled to Vcc through a built in resistor. The 4 rectifying diodes all pull the voltage down to below 0.9volts. The two LEDs do not.

Testing was done using a 6 key macropad wired in a 2x3 matrix. This was connected to an Arduino Pro Micro running QMK firmware.


These graphs show the voltage drop when pressing the key of a particular diode. The major divisions are 2 volts.