← Wiki · Component

Diode

A diode lets current flow one way only. Small signal diodes like the 1N4148 stop ghosting in key matrices and protect against coil kickback.

What it does#

Current flows from anode to cathode (the bar in the symbol, the line on the part). In that direction the diode drops about 0.7 V (silicon); the other way it blocks. The 1N4148 is the classic small signal diode: 100 V, 150 mA DC, fast.

Where hobby boards use it#

  • Key matrices: one diode per key stops “ghosting”, where pressing three keys makes a fourth look pressed. See key switches.
  • Flyback protection: across a relay coil, solenoid or motor, so the voltage spike when it switches off has a path (for currents above ~150 mA use a Schottky like SS14).
  • OR-ing and reverse protection: better done with a Schottky (lower drop).

Example: a 2 × 2 key matrix#

Example circuit: COL2ROW: the column drives the switch, the diode's anode is on the switch and its cathode on the row. Rows and columns go to the controller through J1.
COL2ROW: the column drives the switch, the diode's anode is on the switch and its cathode on the row. Rows and columns go to the controller through J1. Open the diode_matrix example from this page in PCB Canvas: “Insert into my schematic”.

In QMK this is DIODE_DIRECTION COL2ROW; ZMK calls it col2row. Flip every diode and it becomes ROW2COL. Both work, but firmware and board must agree.

Pitfalls#

  • Direction. A diode the wrong way round in a matrix makes its key dead. On SOD-123 the cathode band is on the silkscreen side matching pad 1.
  • Current. 1N4148W is for signals. A 1 A load needs SS14 or similar.

Footprint#

  • Hand soldering: SOD-123 is easy; DO-35 through-hole is the easiest.
  • JLCPCB assembly: 1N4148W in SOD-123 (C81598), basic part.