Underglow with LED strips
While LEDs on a keyboard, especially per-key RGB LEDs, are often associated with kids and gamers, they may have a useful function by indicating the active layer. Thus, while they are not necessary components of a keyboard, knowing how to choose, wire and program them may come in handy.
After reading this article you will be able to compare, choose and purchase LED strips for an underglow effect, wire it up to your controller or PCB and program it to achieve different effects e.g. in QMK firmware.
Different LED types for keyboards
There are individual LEDs for per-key effects or mounted on a PCB, there are THM and SMD LEDs, but in this article I cover underglow with LED strips, often used with handwired builds or as a hardware mod.
Addressable LEDs contain a tiny microchip that understands a protocol sent over a single data wire (instead of using a wire per color).
Most popular LED models have this chip integrated in the LED chassis (WS2812) but the chip can also be placed exposed on the strip PCB (WS2811).
Exposed ICs usually handle more LEDs and can be cut accordingly (e.g. the WS2811's per 3 key addressing).
The chip passes on the remaining data to the next LED, allowing them to be chained together.
This means, you can easily control the color of the individual LEDs on a strip through a single data pin of your controller. This is especially useful on a development board with few easily accessable pins, like a Pro Micro.
Choosing LED strips
There is a whole lot of different addressable LED strips available. They come with different LED densities, level of weatherproofness and in different lengths.
The multitude of these strips can be intimidating, let's see what factors to consider before placing an order!
LEDs supported by QMK
Unless you are a practicing masochist, it's safe to say you want a model with firmware support. At the moment, in QMK, these models are mainly WS2812 and SK6812 variants:
LED strip nomenclature
Looking for WS2812 on aliexpress you can find offers like: "1m 30 IP30" or "5m 144 IP67". Abbreviations lice ECO, RGBW, WWA may be attached to product titles. What do all these mean?
The first value is usually the lenght of the strip expressed in meters: 1m, 2m, 5m.
A full rail is usually 5 m (or 4 m depending on LED density). They are stitched together from 0.5 m pieces so on longer strips expect solder joints every 0.5 m.
The strips can be cut to the desired length. (Whilst everything can be cut in pieces, these LED strips will actually retain their functionality.)
LED density / LEDs per meter
The second value is the number of LEDs per meter, common numbers are: 30/60/74/96/100/144.
While the light provided by a more dense strip may prove more homogenous, it may also dissipate considerably more power (see Power considerations below).
60 LEDs per meter is a good choice for most projects.
For context: 30 LEDs per meter means an LED for every second key/column, while 60 LEDs for every key/column, give or take:
|Spacing (from LED to LED)||Distance (between LEDs)||Strip width|
The number of LEDs per meter also defines the width of the strip through the arrangement of electronic components on the PCB.
A general width of the most common strips with 30/60/100 LEDs per meter is 10 mm, while that of a 74/96/144 strip is 12 mm.
(Adafruit's NeoPixel product family has a skinny form factor which is 7.5/10 mm wide. With removing the casing you can reduce this further to 5/7.5 mm.)
Contrary to most fields of usage, the color of PCB is not just personal preference with lighting projects.
A white PCB may provide a more diffused, uniform effect, where a black PCB provides a clearer defined point of light, making all the LEDs more singular.
Water protection class
The third value shows if the strip is waterproof: IP30 is not waterproof, IP65 has a silicone/epoxy coating on the face (retaining the self-adhesive tape on the back) and IP67/68 is practically inside a silicone tube.
This protection is rather weatherproof since submersion in water is not recommended.
In general, IP30 is for indoor use, thus, this is your best bet for keyboard underglow. It's also cheaper and has better heat dissipation without the coating/sleeve.
The silica gel, epoxy resin sealing or a silicone sleeve has an effect on the overall thickness of the strip as well: the thickness is increased from 2.13 mm to 3 and 3.85 mm, which may be a problem for low profile builds.
RGBW, CW, NW, WW
White color mixed from RGB components can be really... not white. RGBW LEDs (SK6812) try to mitigate this issue by adding a dedicated white component.
CN, NW and WW stand for cold, neutral and warm white, respectively.
Other than the quality, RGBW produces white light by consuming considerably less power (up to 20-50% decrease).
However, the W component is not supported by QMK at the moment. SK6812 RGBW strips work fine but you cannot utilize this feature.
Some LEDs and strip models are branded as "ECO", e.g. "WS2812B ECO". What does this mean? Economic, i.e. cheaper to manufacture and lower price? Ecological, thus, environmentally friendly?
I seems the answer is both.
The WS2812B ECO uses the least power among the popular 5V versions.
According to the specifications, the LEDs and chips on these strips have a different material, shorter warranty, and thus probably shorter lifespan. Also, the light emission characteristics of these LEDs are slightly different.
|IC trace||pure gold||admixture gold|
|Warranty||36 months||18 months|
(*These are not wavelenghts but "intensity values" (Iv). The intensity value of an LED is used to characterize its light emission, expressed in millicandella [mcd].)
What these values tell us is that the lifespan of an ECO may be considerably shorter, and the RGB components are brighter with lower sensitivity to voltage (smaller Iv range).
For comparison, let's see the prices of a 5 m strip with 60 LEDs per meter (5m 60 IP30). All offers include free shipping and were collected from Aliexpress on 2021-01-20:
Your USB port (or controller) can provide only a limited amount of current (max. 500 mA), thus, you don't want too much LEDs.
Power consumption depends on the LED type, number and brightness of LEDs.
The most popular ones in order of power consumption: WS2812B > SK6812 >= WS2812B ECO
A good average is 20mA per moderately glowing LED, but this may be much more for LEDs with full brightness (60mA).
The overall power consumption is hard to estimate because with animated lighting effects it changes all the time. In addition, producing different hues may require different amount of power too (WS2812B ECO is surprisingly efficient in producing blue).
Usually, less than 20-24 LEDs are recommended for a project using a single USB port. (You have to incorporate about 25 mA for your controller into the 500 mA limit.)
Idle power usage
This may come as a surprise, but addressable LED strips consume power even when turned off (because of the chips).
An idle 5 m 60 strip (300 LEDs) dissipates 5.00-6.43 W with the WS2812B ECO being the most efficient (5.00 W).
The three most popular LED types dissipate 3.3-4.2 mA with the WS2812B ECO being the most efficient (3.3 mA).
@@@ tablehttps://quinled.inf o/2020/03/12/digital-led-power-usage/
|LEDs Pure Red 100%||25.54||23.90||21.20||34.55|
|LEDs Pure Red 50%||15.10||13.50||13.20||21.40|
|LEDs Pure Green 100%||25.50||23.10||21.20||34.50|
|LEDs Pure Green 50%||15.00||13.00||13.10||21.10|
|LEDs Pure Blue 100%||25.50||14.20||21.20||34.00|
|LEDs Pure Blue 50%||15.40||9.10||13.30||20.90|
|LEDs RGB White 100%||65.00||46.80||49.00||88.10|
|LEDs RGB White 50%||33.90||24.80||26.30||45.40|
|Effect 1 (Police All) 100%||25.50||18.60||21.20||34.50|
|Effect 1 (Police All) 50%||15.40||11.30||13.40||20.20|
|Effect 2 (Loading/Default (Orange)) 100%||11.00||9.40||10.10||14.50|
|Effect 2 (Loading/Default (Orange)) 50%||8.20||6.90||8.00||10.00|
|Effect 3 (Rainbow) 100%||25.50||19.60||21.00||34.20|
|Effect 3 (Rainbow) 66%||18.40||13.90||15.70||25.10|
|Effect 3 (Rainbow) 33%||11.50||8.40||10.50||14.50|
Since QMK doesn't support the white LED in RGBW variants anyway, WS2811 needs 12V, and SK6812 is much more expensive (2-3x) than WS2812, I went with 1 m of WS2812B ECO with white PCB for $3.28.
If you prefer the characteristics of SK6812 and don't mind the relatively hefty pricetag, choose accordingly.
The default wiring is quite self-explanatory. Most strips have only three wires: VCC, Din and GND.
VCC and GND are shared, they don't consume additional pins. And the Din, i.e. the data wire requires only one pin of your controller.
Some strip types (e.g. WS2813) have four wires: two data wires are an attempt to mitigate the problem with failing pixels.
In non-keyboard related projects with a more serious power supply:
Programming in QMK
The configuration and programming part is well documented.
The RGB lighting feature is enabled by default, and only the data pin and the number of LEDs have to be set in config.h.
Lighting layers feature
Lighting layers is the feature which is able to indicate your layer states by lighting up the underglow in different colors. When it comes to functionality (over aesthetics), this is what you want.
Below is an example but see the documentation for more details.
Layer state underglow indicator example
WS2812B seems to be the natural choice for most people. It's the upgraded version of WS2812, has reverse connect protection (the power supply reverse connection does not damage the IC) and is relatively cheap.
However, WS2812B ECO (on white PCB) might be the best choice with less power consumption and a considerably lower pricetag.
Thanks for reading! Below you can find a more comprehensive list of LED strips. For more tips and project ideas check the KBD Magazine.
LED and LED strip types used in keyboards
As a summary, here are some often used LED strip types and their characteristics:
WS2811. 12v. External IC. Addressable only per 3 LEDs.
WS2812 - The reference. 5x5 mm LED size, one data wire, no reverse connection protection. Power hungry. The colors may be affected by voltage drops. Sensitive to higher temperatures.
WS2812B. Updated WS2812 with reverse connect protection (data sheet).
WS2812B ECO. Uses the least amount of power (-6-44%) with most hues and is cheaper.
WS2812C. Anecdotally similar to WS2812 but with less power consumption (?). I've never seen this one. According to the data sheet much dimmer than anything else.
WS2813. Updated WS2812B with dual signal wires for breakpoint resume function, thus, 4 wires. The failure of an LED won't affect the others (unless two consecutive LEDs are broken).
SK6812. Dedicated white component. Voltage-independent color and brightness over a wide voltage range. I.e. the colors of the LEDs should not be affected by a drop in the supply voltage as much as they are on the WS2812B. Compared to WS2812B, SK6812 uses less power (-10-20%) and LED quality is said to be better. At higher temperatures SK6812 is less prone to fail. Still power hungry though and way more expensive (x2-3).
SK6812 mini. Mini version of the SK6812 with 3.5mm*3.5mm LED size. Smaller size, lower brightness and power consumption. Recommended for per-key (i.e. many) LEDs.
SK6812 mini-e. Same as SK6812 mini but intended for hand soldering (larger pads).
APA 102. The brightest LED strip but uses the most power among the 5V ones (+20-40%). Expensive.
WS2815. 12V. Signal break-point continuous transmission. About the double of power usage compared to 5V strips. This is rather for projects using longer strips, not for keyboards.
- aliexpress / BTF-Lighting
- Power consumption tests