Skip to main content

Backlighting And RGB

Bling bling.

QMK-Compatible LED backlighting

This is one LED per switch.

The structure is:

.     |- LED --- Resistor -|
      |                    |     N-Channel
5V ---|- LED --- Resistor -|----- MOSFET ----- GND
      |                    |        |
      |- LED --- Resistor -|     PWM PIN
  • Use a N-channel MOSFET.
  • A PWM pin can only deliver around 20mA absolute maximum. Drawing tons of LEDs from a single PWM pin will easily fry your microchip. Place a resistor between the PWM pin and MOSFET gate.
  • All LED-Resistor pairs are placed in parallel.
  • All LEDs can be run under a few or single resistor, but this leads to brightness inconsistencies among the LEDs.
  • The current from the LED-Resistor pairs feed into the drain of the MOSFET.
  • PWM feeds into the gate of the MOSFET with a 100~1k or so resistor, usually.
  • Source of the MOSFET goes to ground.
  • Each LED resistor should be planned to let around 1-5mA through the LEDs each. 20mA will hurt your eyes.

Choosing the correct MOSFET

Power Dissipation

  • Make sure the current flowing through times the voltage drop doesn't lead to a power dissipation that doesn't fry the MOSFET.

Maximum voltage and current

  • Check for Drain-Source voltage/current max ratings.


  • Do not pick a MOSFET which will not fit on your PCB.

RGB Underglow

WS2812B is the standard used for underglow.

  • Draws 45-50mA per package maximum.
    • However, AliExpress GH60 PCBs have 16 WS2812B.
    • Current can be limited via QMK.
  • Can be daisy-chained together. One LED passes data onto the next, and so on.
  • Can be purchased in individual WS2812B or by strips. Use individual for assembled PCBs.
  • Wired in the following way:
    • VDD to 5V
    • VSS to GND
    • DIN to previous LED DOUT, or AVR pin if first LED
    • DOUT to next LED DIN, or unconnected if last LED
    • Placing a 500 ohm resistor between AVR pin and first LED is highly recommended

Various other RGB choices

WS2812 (without B) - Unsimplified version of WS2812B with 6 pins
WS2811 - The controller within WS2812B. Can be used as standalone controller with other RGBs.
Controller-less RGBs - Use with separate PWM LED controllers.
WS2812C - Low current variant
SK6812 - An alternative that also works with QMK

Indicator LEDs


MCU PIN --- LED --- Resistor --- GND     (Source setup - Toggle pin high to turn on)


5V --- LED --- Resistor --- MCU PIN (Sink setup - Toggle pin high to turn off)

LED and resistor can be swapped.