Author Topic: What is a good standard led resistor for all colours?  (Read 3009 times)

0 Members and 1 Guest are viewing this topic.

Offline Blitzschnitzel

  • Thread Starter
  • Posts: 103
What is a good standard led resistor for all colours?
« on: Thu, 28 November 2019, 05:10:17 »
Hi I am designing a board Which has provisions for LED backlighting but wont ship with LEDs. So, what would be a good compromise resistor when you don’t know if users are going to use red or white LEDs or everything in between?

Offline Findecanor

  • Posts: 5040
  • Location: Koriko
Re: What is a good standard led resistor for all colours?
« Reply #1 on: Thu, 28 November 2019, 06:30:58 »
There is no such thing. It depends on your LED driving IC.
🍉

Offline Blitzschnitzel

  • Thread Starter
  • Posts: 103
Re: What is a good standard led resistor for all colours?
« Reply #2 on: Thu, 28 November 2019, 06:48:37 »
I know, that's why I am asking for the best middle ground. My LEDs are switched by a transistor, so the IC shouldn't matter.

Offline Applet

  • Posts: 488
  • Location: Sweden
Re: What is a good standard led resistor for all colours?
« Reply #3 on: Thu, 28 November 2019, 06:57:43 »
What voltage? 5V?

Offline yui

  • Posts: 1082
  • Location: 127.0.0.1 (in azerty)
Re: What is a good standard led resistor for all colours?
« Reply #4 on: Thu, 28 November 2019, 07:03:37 »
well leds need a constant current, so the only real option is a constant current driver else you will either have very dim blue LEDs or very bright (and short lived) red LEDs (all colors but red, orange, yellow and a few greens use blue technology)
if my calculation are not wrong for 10mA red you should go for 320ohm while with blue 10mA you should go for 170ohm so depending on where you want to be on the spectrum of blinding red(170) to dim blue(320) you go in between those values at 5V. or go for a constant current controller.
by the way i have not done those calculation in a long while so you may want to double check
vi vi vi - the roman number of the beast (Plan9 fortune)

Offline Findecanor

  • Posts: 5040
  • Location: Koriko
Re: What is a good standard led resistor for all colours?
« Reply #5 on: Thu, 28 November 2019, 08:15:16 »
I know, that's why I am asking for the best middle ground. My LEDs are switched by a transistor, so the IC shouldn't matter.
A single MOSFET? You would reach the 500mA power budget at ~24 keys unless you are using a capacitor circuit to dampen current draw over time. The USB spec sets an absolute limit, not an average.

well leds need a constant current
No. LEDs are typically run with pulse width modulation. You can control the brightness by varying the duty cycle. Keyboards would be blinding if you ran them at constant current.

Keyboards with individually controlled backlighting have the LEDs in a matrix (just like a keyboard matrix), with only one section lit at a time (just how a keyboard matrix is strobed only one column at a time).
« Last Edit: Thu, 28 November 2019, 08:27:11 by Findecanor »
🍉

Offline yui

  • Posts: 1082
  • Location: 127.0.0.1 (in azerty)
Re: What is a good standard led resistor for all colours?
« Reply #6 on: Thu, 28 November 2019, 09:01:31 »
I know, that's why I am asking for the best middle ground. My LEDs are switched by a transistor, so the IC shouldn't matter.
A single MOSFET? You would reach the 500mA power budget at ~24 keys unless you are using a capacitor circuit to dampen current draw over time. The USB spec sets an absolute limit, not an average.

well leds need a constant current
No. LEDs are typically run with pulse width modulation. You can control the brightness by varying the duty cycle. Keyboards would be blinding if you ran them at constant current.

Keyboards with individually controlled backlighting have the LEDs in a matrix (just like a keyboard matrix), with only one section lit at a time (just how a keyboard matrix is strobed only one column at a time).

When you know what led you will have down the line you use resistors and pwm because as you know the forward voltage of the LED and the voltage of the circuit the resistor + LED act as a constant current drain.
Here we do not know the forward voltage -> so we need constant current, and yes you could cobble a similar effect with pwm and measuring the voltage across either resistor or LED, it would be pretty hard to do so without either the user only using 1 type of LED or having 4 traces per LED.
it is also why i explain the thing with the resistors.
And no one talked mosfet not even a single transistor or high current LED although it is a problem i forgot about low value resistors reds, they will use more current and may trip over-current protection on some PC or fry the motherboards on some macs.
As for the USB limit it is 500mA in usb1, went up to 900mA in usb3 spec and usb-C is 5A so plenty of space even with the minimums (really some usb port provide much more current, 1A ports are pretty common place on USB2 laptops).
I tried to keep things short-ish in my original post, and give a possible solution.
Or an other one is just to do like many manufacturer do and put a random value with pwm and pray nothing goes wrong.
vi vi vi - the roman number of the beast (Plan9 fortune)

Offline Findecanor

  • Posts: 5040
  • Location: Koriko
Re: What is a good standard led resistor for all colours?
« Reply #7 on: Thu, 28 November 2019, 09:23:49 »
As for the USB limit it is 500mA in usb1, went up to 900mA in usb3 spec and usb-C is 5A so plenty of space even with the minimums
A USB C plug does not guarantee 5A: it is the opposite: it is the maximum possible current, and only when using a capable USB C - to USB C cable and a power source that signals that it is capable of providing that much. The device is required to check that the source is able to provide the current before starting to draw that much.

I have yet to see a keyboard that requires USB 3.0 or higher. It would be incompatible with all USB 2.0 host ports and cables.
The typical case for a keyboard with USB C is still to be connected to a host through a cable that has a USB A 2.0 plug on the other end. In this case, it is the cable that tells the device that maximum current draw is limited to 500mA.
« Last Edit: Thu, 28 November 2019, 09:29:49 by Findecanor »
🍉

Offline Applet

  • Posts: 488
  • Location: Sweden
Re: What is a good standard led resistor for all colours?
« Reply #8 on: Thu, 28 November 2019, 10:31:03 »
USB is required to limit current. Current is limited upstream (if you have a downstream port, you also have current limiters) and if too much current is drawn, the port will disable power and then reset. You will not be able to know how much current is available upstream. If there is a crappy bus-powered hub in-between PCB and host, you may be limited to 100mA or such, but as long as you need to enable leds manually (switch or software), the port will reset after pulling too much current, and then you just do not enable leds, if there is not enough power available upstream.

I think the mentioned idea of a constant current source or led driver is a good solution if the boards/design is not already done.

Please correct me if I’m wrong ;D
« Last Edit: Thu, 28 November 2019, 11:31:19 by Applet »

Offline Blitzschnitzel

  • Thread Starter
  • Posts: 103
Re: What is a good standard led resistor for all colours?
« Reply #9 on: Fri, 29 November 2019, 12:32:17 »
Thank you very much all. I thought as many others must stand before the same issue that there would be some kind of a standard. I did some testing and it seems white LEDs are just brighter and not less efficient. 360Ohms is still plenty bright for a keyboard, so I'll go with 360 or 330 Ohms. As this is going to be just a numpad I am not going to worry about the current limit.