Beginner here. I am working on building my own keyboard PCB, and I wanted to add a backlight for my keys. However, I've been reading methods of powering teensy little 3mm LEDs and it seems like an impossible task to get 77 powered by anything less than a billion volt power supply with them in series or somehow get a billion amps pumped out to run them in parallel. (I know I'm exaggerating, but still...)

I'm looking at using white 3mm LEDs with a max current of 20 mA and a forward voltage of 3-3.4v. If I put all of the LEDs in series, I'd need 77*3.4V = 261V power supply, and if I put all of the LEDs in parallel I'd need to supply 77*20mA = 1540 mA of current. The teensy microcontroller that will process the keyboard inputs and that I plug into my computer is what I would like to power my LEDs, but its pins can only supply 3.3V at 250mA. (and I've only got 2 to use).

How do everyday computers power so many little key backlights without running out of battery immediately?

The only way I could think of getting this to work would be to have a separate power supply of a million AA batteries taped to the bottom of the keyboard separately powering just the LEDs.

Is there a better solution out there?

Thank you for your time.

  • 5
    \$\begingroup\$ Are you making a keyboard or xmas tree? There are SMD LEDs consuming 0.5-1 mA bright enough to work as backlight of individual keys. 40mA all 77 of them. \$\endgroup\$
    – Maple
    Jan 4, 2020 at 18:30
  • 2
    \$\begingroup\$ why do you feel that all serial and all parallel are the only two connection configurations to choose from? \$\endgroup\$
    – jsotola
    Jan 4, 2020 at 18:38
  • \$\begingroup\$ @Maple The keyswitches that I end up using may or may not have clear housings. Thats why I was looking at THT 3mm LEDs because I knew that I would be guaranteed to be able to get some light past the keyboard plate which hides the pcb, but I can't find (or more probably don't understand) how to get an LED that will light up at such a low power. \$\endgroup\$
    – Henri
    Jan 4, 2020 at 18:43
  • 1
    \$\begingroup\$ What I see on my laptop is that there is generic lighting under the keyboard, not an LED per key. You probably can get away with 4-8 LEDS for the whole keyboard. \$\endgroup\$
    – Oldfart
    Jan 4, 2020 at 18:55
  • 1
    \$\begingroup\$ It is better to learn from the shoulders of giants than reinvent a new square wheel rog.asus.com/forum/… \$\endgroup\$ Jan 4, 2020 at 20:28

4 Answers 4


If keyboard components aren't rated for LED light through them, don't buy them. They are likely to be opaque, which means you could put a searchlight down there and not get any light through. Anyway you would be unable to power it off USB, and you'll need to get under 2.5W for that, and will want to get under 500mw if possible.

How to size

Let's take this Cree C512A-WNS/WNN LED. It's rated up to 25ma but the specs assume 20ma test current. Forward voltage is 3.2-4.0 depending on how hard you want to overdrive it.

After the initial specs, the next thing you see on the data sheet is about binning. When they manufacture these, they get variances. They sort these into "bins" by luminous intensity at current, operating voltage, color temperature (that's the CIE chromaticity chart), etc. You select the bin code that you want for your lights, and the pricing is decided by supply/demand, e.g. how well that bin is produced vs selling.

Then you get into the performance charts. Now, if these were illumination LEDs, Cree would produce full-page charts with more detail. But this is sold as an indicator LED, so they sorta hustle by these points.

Current vs voltage

enter image description here

Note that this curve is actually much, much steeper than it appears. The current scale starts at 0 but the voltage scale starts at 2.8. This makes it difficult to drive it at constant-voltage mode, e.g. you have to hit 3.0V pretty precisely if you want 15ma.

Further, this chart varies by temperature, which is not shown. As the LED warms, current increases for a particular voltage, and it increases fast, because this is a very steep curve. If you drove it with 3.00V, it would draw 15ma until it warms, then 20ma, which would hasten warming, 25ma, warming faster still, 35ma, 50ma, 100ma, pop.

That's called thermal runaway.

The preferred way to drive LEDs is constant-current mode. Then, behavior will be fairly consistent. Drive voltage will drop slightly because now you're looking at the curve sideways: the curve is pretty flat from this view.

Voltage at current also gives you power (watts).

Luminous intensity at current

enter image description here

The lower scale is the milliamps of current. The side scale is the luminous intensity, and it's expressed as a factor of the spec (back on page 2-3). 1.0 is exact spec. 2.0 is double the spec.

Note that 100% of spec happens at 20.0ma, and 200% of spec happens at 53ma - that's not very efficient at higher power, is it? It's worse than that.

  • 100% of spec 20.0ma happens (according to the other chart) at 3.2 volts (giving 64 milliwatts), but
  • 200% of spec (53ma) happens at 3.75V (giving 198mw) -- in other words twice the light takes 3x the power. Efficiency really falls off at higher power, eh?

Blinded by the light!

However, 198mw x 77 keys means 15.3 watts of searing LED light. Assuming typical poor 85 lm/w from a Cree LED overdriven that hard, that's 1300 lumens - the brightness of a fluorescent tube. That's orders of magnitude more than you want in a keyboard.

Even the more docile 100% power, 64mw x 77 keys is 4.9 watts, too much for USB, and at the typically good efficiency of Cree LEDs in spec of 120 lm/w, that's 600 lumens of light. Somewhat more than a 40W incandescent bulb. Not a thing you'd want to be looking at.

If we calm that down to something like 1/10 of that, 0.49 watts (which puts us inside the allowable limit for low-power USB ports)... that's 6.4mw per LED, that happening at 2.0 ma per LED (10% of spec).

The efficiency curve continues to be curved, and so at 10% of power, I would expect ~15% of light. That's 90 lumens of light. Even that, you will want a "dim" option on.

The best way to dim LEDs is reduce their current in the driver. The second-best way is PWM.

Series vs parallel

You propose all-series (stupendous voltage) or all-parallel (high current, poor inter-LED regulation).

You'd want to drive these actively "constant current" (though you might vary current to select brightness, the point is, the driver would seek to a target current, not a target voltage.

Series is simplest, but then, you have a keyboard that can kill you. (6.4ma would definitely get your attention; whether this is dangerous is a health-and-safety question, but US style GFCI protection devices trip on 5ma, so I would say it's of concern.)

So I recommend something in the middle. Have multiple series strings wired in parallel. Since your 77 number is the factor of two prime numbers, 7 and 11, either make them strings of 7 (@22.4V), or strings of 11 (at 35.2V). The LEDs will vary somewhat, so to even out these, I'd add one dropping resistor on each string. The linear resistor plus the very non-linear LEDs will dampen out these differences.

Drive that with a boosting constant-current supply, at 7x or 11x target current (adjusted for brightness if you do that).


LEDs do have a maximum current rating, but it does not mean they must be run at full power all the time. For this application at least two things can be used. Buy better, more efficient LEDs so that they light up brightly enough at lower current, say 1 mA or less. You can also divide the LEDs into multiple groups and multiplex them so that only one group is on at one given time and other groups are off. Sequentially turning on one group at a time at high enough scan rate creates an illusion of all LEDs being lit.


I'm looking at using white 3mm LEDs with a max current of 20 mA and a forward voltage of 3-3.4v.

Don't run them at their max current. That's not good for reliability anyway.

Run them at the minimum current needed for visibility under the conditions you want them visible.

For many of today's LEDs that could be somewhere in the range of 1-5 mA.

77 LEDs at 3 mA is a very reasonable 240 mA or so.

  • \$\begingroup\$ This is interesting. I have lots of questions so I apologize ahead of time. In no particular order, assuming I buy the LEDs I described, How can I test the LEDs to find an acceptable current? Do I need to buy a breadboard or something else? Can I design a schematic before I know my power requirements? How? I’ll link the Datasheet for the LEDs that I’m thinking about using \$\endgroup\$
    – Henri
    Jan 5, 2020 at 5:08
  • \$\begingroup\$ @Henri You don't know for sure until you consider all the design factors. There's no substitute for building such a keyboard (or at least a keypad) and seeing how it goes. As I mention, you need to select keyboard components actually made for being lit; you can't force this upon components not made for lighting. \$\endgroup\$ Jan 5, 2020 at 21:41

Typically these are not done in the typical series or parallel method that simple projects use. When you need a large number of leds and low power, you use one of two (or both) methods.

The first is multiplexing/charlieplexing/scanning. This is also used for addressable leds or displays, to display a picture/video/individual pixel, not just backlights, but the benefit is the same. A matrix setup allows less pins to control more leds, and less power as only a section/segment is turned on at a time. It takes advantage of human vision, ie persistence of vision.

The second is led drivers, which will boost the voltage or current as needed. There are dedicated ICs meant to power and drive led strings, making them more efficient than the typical direct power options. See https://www.digikey.com/en/articles/techzone/2012/nov/trends-in-led-backlighting-and-drivers-for-mobile-devices-and-tvs for some discussion of the various options. enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.