Author Topic: Adding LEDs to PCB with holes but no leads for LEDs  (Read 2425 times)

0 Members and 1 Guest are viewing this topic.

Offline PandaSPUR

  • Thread Starter
  • Posts: 157
Adding LEDs to PCB with holes but no leads for LEDs
« on: Fri, 01 August 2014, 12:30:55 »
As per the title, how would I do this?

I'm asking because I want to add LEDs to my Smallfry 40% KB kit but JD confirmed that the JD40 PCB is not wired for backlight LEDs at all.
But the PCB does have holes for the LED leads.

I want to do the LEDs with SIP sockets if possible. But I also dont quite understand the whole resistor situation. Can I set it up to just have one resistor which I need to switch out?
Home:
Das Keyboard - MX Browns - Vortex Grey Side-Printed PBT Caps
Work:
KBT Pure - iKBC Aluminum Case - MX Reds
Vortex Poker II - Frosty on Lime Acrylic Case - MX Clears

Offline engicoder

  • Posts: 721
  • Location: North Carolina
Re: Adding LEDs to PCB with holes but no leads for LEDs
« Reply #1 on: Fri, 01 August 2014, 13:05:57 »
LED's vary slightly in actual values such as forward voltage due to manufacturing. If they are connected to a single resistor, a single diode (LED) with the lowest forward voltage may start conducting before all others. This will result in that LED drawing much more current than the rest and you will have one bright LED and a bunch of dim ones.

   

Offline PandaSPUR

  • Thread Starter
  • Posts: 157
Re: Adding LEDs to PCB with holes but no leads for LEDs
« Reply #2 on: Fri, 01 August 2014, 14:43:23 »
So I'll have to have an individual resistor for each LED then.

How about wiring all of the LEDs together?

All parallel, all series, or groups of parallel in series?
Home:
Das Keyboard - MX Browns - Vortex Grey Side-Printed PBT Caps
Work:
KBT Pure - iKBC Aluminum Case - MX Reds
Vortex Poker II - Frosty on Lime Acrylic Case - MX Clears

Offline engicoder

  • Posts: 721
  • Location: North Carolina
Re: Adding LEDs to PCB with holes but no leads for LEDs
« Reply #3 on: Sat, 02 August 2014, 15:35:36 »
For the most part they will all be parallel. Depending on the voltage you have available, you maybe able to save a few resistors by putting a number of LEDs in series sharing a resistor. This will also reduce your overall current consumption. Assuming you are using 5V, you could put two LEDs in series followed by a resistor. Then you could put this set of 3 in parallel to make up the total number. In this case remember to size your resistor based on the voltage after subtracting the voltage drop for the two LEDs.

Small ASCII drawing for the 2 LED case: L = LED, R= Resistor

 
5V ------+-----+-----+---- ...  ---+-----+
         L     L     L     ...     L     L
         L     L     L     ...     L     L
         R     R     R     ...     R     R
GND -----+-----+-----+---- ...  ---+------+             


 
« Last Edit: Sat, 02 August 2014, 15:38:29 by engicoder »
   

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: Adding LEDs to PCB with holes but no leads for LEDs
« Reply #4 on: Sat, 02 August 2014, 17:52:28 »
The above is a great idea and will work for LEDs under 2.5Vf (Vf is the forward voltage drop of the LED.) So they won't work with blue or white.

TG3 uses this method for the BL82.

Offline PandaSPUR

  • Thread Starter
  • Posts: 157
Re: Adding LEDs to PCB with holes but no leads for LEDs
« Reply #5 on: Wed, 06 August 2014, 10:26:56 »
I'm a complete newb at this stuff.

So I want to do the SIP socket mod, and plan to use mainly white LEDs.

I guess I should just wire them all in parallel with a resistor each.

Probably grabbing these: http://www.ebay.com/itm/100pcs-2x3x4mm-2x3x4-mm-White-Diffused-Rectangle-LED-Leds-Lamp-Free-Resistors-/321332751221?pt=LH_DefaultDomain_0&hash=item4ad0ecab75
What kind of resistor would I need?

EDIT: found this site: http://www.evilmadscientist.com/2012/resistors-for-leds/
So for a 5V supply from USB, to find the Ohms I need from a resistor, I do (Vpower - Vf)/(LED Current in Amps).
Sound right?

Also, any suggestions on how to combine 40 wires into 1 (which would get soldered to the USB 5V line)?
« Last Edit: Wed, 06 August 2014, 10:40:54 by PandaSPUR »
Home:
Das Keyboard - MX Browns - Vortex Grey Side-Printed PBT Caps
Work:
KBT Pure - iKBC Aluminum Case - MX Reds
Vortex Poker II - Frosty on Lime Acrylic Case - MX Clears

Offline vvp

  • Posts: 887
Re: Adding LEDs to PCB with holes but no leads for LEDs
« Reply #6 on: Thu, 07 August 2014, 04:50:50 »
Probably grabbing these: http://www.ebay.com/itm/100pcs-2x3x4mm-2x3x4-mm-White-Diffused-Rectangle-LED-Leds-Lamp-Free-Resistors-/321332751221?pt=LH_DefaultDomain_0&hash=item4ad0ecab75
So for a 5V supply from USB, to find the Ohms I need from a resistor, I do (Vpower - Vf)/(LED Current in Amps).
Sound right?
Yes. But if you are goint to power this from USB 2.0 then notice that your LED can take 20mA sustained and you want 40 of them. That is 20*40 = 800 mA and 800 mA > (500mA - maxControllerCurrent).
You need to specify the current through one LED as (500mA-maxControllerCurrent)/40 or lower. I'm not sure if they will be still bright enough but if the result will be at least 5mA then probably yes. You must find what max consumption of your controller is. It will be probably below 100mA. That would give you maximum current through one LED at 10mA (which should be enough but depends on each specific LED).
You can look for maximum controller current to the keyboard USB HID descriptor. If they were careful with firmware it will contain something smaller than 500mA ... also if you add LEDs you should modify the USB HID descriptor to contain the new max current rating.
Otherwise you can try to measure the max current with ampere meter which can measure peak values (or a scope). Connect it, try to load keyboard as much as possible and take the biggest current.

Also, any suggestions on how to combine 40 wires into 1 (which would get soldered to the USB 5V line)?
Just connect it to one wire, at different spots of that one wire.

Offline PandaSPUR

  • Thread Starter
  • Posts: 157
Re: Adding LEDs to PCB with holes but no leads for LEDs
« Reply #7 on: Thu, 07 August 2014, 09:42:13 »
Yes. But if you are goint to power this from USB 2.0 then notice that your LED can take 20mA sustained and you want 40 of them. That is 20*40 = 800 mA and 800 mA > (500mA - maxControllerCurrent).
You need to specify the current through one LED as (500mA-maxControllerCurrent)/40 or lower. I'm not sure if they will be still bright enough but if the result will be at least 5mA then probably yes. You must find what max consumption of your controller is. It will be probably below 100mA. That would give you maximum current through one LED at 10mA (which should be enough but depends on each specific LED).
You can look for maximum controller current to the keyboard USB HID descriptor. If they were careful with firmware it will contain something smaller than 500mA ... also if you add LEDs you should modify the USB HID descriptor to contain the new max current rating.
Otherwise you can try to measure the max current with ampere meter which can measure peak values (or a scope). Connect it, try to load keyboard as much as possible and take the biggest current.

I actually didnt think about that...
So how do these larger backlit keyboards get enough power for the LEDs?
Or is the brightness I'm seeing already quite far below 10mA each?

And also, what happens when I plug into a port that has more than 500mA then? :|
I know my desktop and laptop both have special ports with higher power output (meant for charging phones).


Quote
Just connect it to one wire, at different spots of that one wire.

Damn. Was hoping there would be a better/cleaner way to do this.
Does no one sell simple PCBs for this purpose?
Home:
Das Keyboard - MX Browns - Vortex Grey Side-Printed PBT Caps
Work:
KBT Pure - iKBC Aluminum Case - MX Reds
Vortex Poker II - Frosty on Lime Acrylic Case - MX Clears

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: Adding LEDs to PCB with holes but no leads for LEDs
« Reply #8 on: Thu, 07 August 2014, 13:28:19 »
1K resistor is enough for almost all LED Vfs to avoid going over USB max current. You might want to go for 1200 Ohms, especially if you are using a red/orange/amber LED or have a lot of switches (or want them to be less bright. even 1mA per LED is VERY bright for a lot of LEDs)

Offline vvp

  • Posts: 887
Re: Adding LEDs to PCB with holes but no leads for LEDs
« Reply #9 on: Thu, 07 August 2014, 17:44:25 »
So how do these larger backlit keyboards get enough power for the LEDs?
Or is the brightness I'm seeing already quite far below 10mA each?
As dorkvader indicated, they probably drive it with 1 or 2 mA only. Though I would not be surprised if they would drive the LEDs using PWM and possibly through an LC filter or maybe some dedicated LED driver. It would save energy. Or the other not so bad solution is to drive them at max peak current in blocks, PWM, interleaved. It saves energy too but not so well. But I do not know. I never had a backlit keyboard and I do not intend to get one.

I have one blue LED on 3dPrinter. It is driven by 7 mA and it is bright but not very bright. I guess it depends what one considers bright, whether you want it bright during sunny day or only dim during night and whether you see the LED directly or only reflections (e.g. because it is below an opaque keycap).
If you do not add some brightness regulator then you may want to experiment before you commit to your LED current so that you do not finish like my friend who put a duct tape over all the LEDs on his notebook because they were dazzling him during evenings.

And also, what happens when I plug into a port that has more than 500mA then? :|
The keyboard controller will misbehave since its voltage will drop below its minimum. I do not think there is any USB port which is not protected against over current so it should not damage hardware. On the other side, my other friend was sending a motherboard for RMA because it got damaged by faulty usb flash key which took too much current. The RMA was accepted.

Damn. Was hoping there would be a better/cleaner way to do this.
Does no one sell simple PCBs for this purpose?
Buy a blank PCB, cut it to a shape you like and dril 41 holes in it. Soldier wires to the holes. But maybe you want to put also the LED resistors on the PCB. In such a case, you need something more complicated.

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: Adding LEDs to PCB with holes but no leads for LEDs
« Reply #10 on: Fri, 08 August 2014, 00:52:14 »
I have one blue LED on 3dPrinter. It is driven by 7 mA and it is bright but not very bright. I guess it depends what one considers bright, whether you want it bright during sunny day or only dim during night and whether you see the LED directly or only reflections (e.g. because it is below an opaque keycap).
It also depends heavily on the LED you purchase. For example, very early LEDs are very dim for the power. Modern ones are brighter, but there is still quite the range (a few orders of magnitude in luminous efficacy at least!) Most of the LEDs available to you will be bright ones, unless you get a dim one at your electronics parts distributor (mouser, farnell, allied, digi-key, etc.) Dimmer ones might be a few pannies cheaper in bulk.

The way to do this (properly) is figure out how many LEDs you need, then determine how much current the board needs without LEDs, then pick your LED colour of choice. Look up in the datasheet the specs and find resistors to match to maximize current through the LED matrix (with a little headroom just in case). Then go back to the datasheet with your current-through-led value and figure out the brightness, determine if this is acceptable or not, and repeat if necessary: it can take a lot of time, especially as you should keep notes and doublecheck.

The other way is to take a resistor value that's "high enough" and use it. Chances are excellent that the LEDs will be bright enough for you, even if it's not the brightest they could be.