help me calculate R

Discussion in 'General Electronics Chat' started by raffter, Mar 1, 2008.

  1. raffter

    Thread Starter Active Member

    Feb 28, 2008

    kindly check attached... its from robotroom site regarding a current regulated LED tester(figure A is current regulated to 26mA)... now my problem is HOW to REcalculate(R2) series-paralleled LEDS to come up with 30mA per LED?? or is my connections OK?? or do I need -some- sort of -isolation- per string of LEDs....

    • LED.jpg
      File size:
      60.2 KB
  2. Audioguru

    New Member

    Dec 20, 2007
    Simply look in the datasheet for the LM317 to see how to calculate the value of the resistor that sets the total current.

    The LM317 creates 1.25V from its Output pin to its Adj pin.
    The 8 columns of LEDs need 30mA each so their total current is 0.24A.
    Then the resistor is calculated with Ohm's Law. 1.25V/0.24A= 5.2 ohms.

    It is bad practise to connect LEDs in parallel unless their forward voltages are all exactly the same. You might be lucky and their random voltages in series might average their total voltages. You might be unlucky and one column will have all low voltage LEDs and then it will hog all the current and burn out. Then the next lowest voltage column will hog all the current and burn out. Then ...

    Most ordinary LEDs have an absolute max allowed continuous current of 30mA. Yours might be close together which will concentrate their heat and then they might fail.
  3. SgtWookie


    Jul 17, 2007
    Just to expand on what Audioguru said,
    LEDs can vary considerably as to their forward voltage (Vf) at a given current - even in the same batch.
    I recently measured a batch of 80 blue LEDs that came from a reel; presumably from the same batch.
    At 22mA, there was a difference of 0.35v between the lowest and highest readings!

    If you want to be assured of having close to the same brightness all of the time when using LEDs in an automotive system and do so safely, you will have to either:
    1) Provide current regulation for EACH string of LEDs, or
    2) Match/sort LEDs as to their Vf, limit the current through each string of LEDs using a resistor, and provide a regulated voltage supply across all strings.

    Running LEDs at their maximum current rating will shorten their life. Reducing the current by 10% or more will reduce the heat generated and increase life expectancy.

    Vf matching procedure:
    1) Prepare constant current source:
    Use or build a constant current source, set to supply the desired current flow. For an LM317, connect a resistor * (R1) between the output and adj terminals, and your constant current will be sourced from the adj terminal. (See table at bottom for R1 values, )

    2) Measure/record Vf:
    Using your constant current source, measure and record the Vf across each LED individually, using a digital multimeter and a spreadsheet table, such as Excel, Works, or OpenOffice's spreadsheet. Number the LEDs sequentially using a label, and record the sequence number with the Vf. In the spreadsheet, use column "A" for the Vf, and column "B" for the sequence number.

    3) Sort Vf table:
    After all of the Vf and numbers are recorded in the spreadsheet, save it and then sort the table ASCENDING (low to high) by the Vf column (make sure you have the sequence number column selected as well, or you won't know what Vf goes to which LED!)

    Now that your table of Vf's is sorted, you'll see that the first few are much lower than the average voltage, and the last few are much higher than average. You may wish to set those aside for another project.

    Now it's time to match them up. We can do this by sorting sections of the spreadsheet table.

    4) Re-sort/match LEDs:
    Divide the sheet by the number of LEDs you will have in each string. Sort the first section in DESCENDING order by Vf (remember to select the sequence # column too).
    Let's say you had 80 LEDs, and you entered their Vf's in cells A1 through A80, and the sequence #'s in cells B1 through B80, and you were making strings of 4 LEDs.
    Select cells A1 through B20, and sort DECENDING by column A.
    Now to get the sum of the voltage drops:
    In cell C1, enter the formula:
    Then copy that formula to cells C2 through C20. This will show you how well or badly the LEDs matched up. The first 80% or so will be almost exactly the same voltage drop. The last few will differ most significantly from the majority. If the match isn't that good, try sorting cells A21 through B40 DECENDING by column A, and look at the results.

    5) Determine available voltage:
    In automotive electrical systems, the voltage may vary from a low of 11.4 (battery discharged) to a high of 15 (charging a nearly dead battery). You need to look at the lowest expected voltage, and go down from there.

    An LM317 drops a minimum of 1.7V across itself. So, 11.4 - 1.7 = 9.7 Volts that you have available. But, regulation won't be too wonderful running that close, so let's take another 0.7V off, rounding it to 9V.
    If you tie a 220 Ohm resistor from the out to adj terminals, and a combination of resistors measuring 1,364 Ohms from the adj terminal to ground, you'll get very close to 9V out. Here are some resistor values you can use in parallel to be close:
    1,360.748 = 1K6 + 9K1
    1,362.162 = 1K8 + 5K6
    1,363.636 = 1K5 + 15K
    1,365.079 = 2K0 + 4K3
    1,365.517 = 2K2 + 3K6
    1,371.429 = 1K5 + 16K
    1,379.310 = 1K6 + 10K
    1,384.615 = 1K5 + 18K

    (1K6 = 1.6k Ohms, 9K1 = 9.1k Ohms, etc.)

    6) Determine limiting resistor:
    Look at your spreadsheet table in column C to determine the range of total Vf's that you have. Take the minimum Vf, and subtract it from your available voltage (in this case, 9v). Let's say your minimum Vf was 5.74:
    9V - Vf = remainder
    9 - 5.74 = 3.26 Volts

    You've decided you want to "play it safe" and instead of running your LEDs at maximum current, you're opting for a 10% reduction to 27mA. So, you need 27mA with a 3.26V drop.
    Ohm's Law:
    R = E / I
    R = 3.26 / 0.027
    R = 120.7
    Round it off to the nearest value, and we have 120 Ohms. (it's safer to round up, but we've already rounded down.)
    If you use 120 Ohm 1% resistors, you will be good to go.

    * Partial table of values for Iout(A) vs R1(Ohms):
    Code ( (Unknown Language)):
    1.  Iout     R1
    2. 0.030   40.000
    3. 0.029   41.379
    4. 0.028   42.857
    5. 0.027   44.444
    6. 0.026   46.154
    7. 0.025   48.000
    8. 0.024   50.000
    9. 0.023   52.174
    10. 0.022   54.545
    11. 0.021   57.143
    12. 0.020   60.000
    13. 0.019   63.158
    14. 0.018   66.667
    15. 0.017   70.588
    16. 0.016   75.000
    17. 0.015   80.000
    18. 0.014   85.714
    19. 0.013   92.308
    20. 0.012   100.000
    21. 0.011   109.091
    22. 0.010   120.000
  4. raffter

    Thread Starter Active Member

    Feb 28, 2008
    thanks for the informative bits..guys!! :)

    I have just used 10R for R2(for now)... got same batch of RED LEDs...have not made readings for its min-max Vfs, was in a hurry to make a tail "STOP" light... its just for intermitent <braking> use so I guess it will last long..

    thanks!! :D
  5. SgtWookie


    Jul 17, 2007
    Ack! :eek:
    With a 10R (10 Ohm) resistor for R2, you will be allowing 120mA to flow through the array of LEDs. Without having matched them up, it's hard to say how long they'll last, or which LEDs are getting the lion's share of the current. (Hint: the brighter strings are getting more!)

    Well, LEDs are cheap, and you at least have a temporary solution. When you have some time, re-visit this and re-do your lights.

    BTW, I don't know where you are - but in the USA, taillights are not actually pure red; they are red-orange. You need to use a specific color of LEDs to be legal, and you also have to use LEDs that are wide angle (70 to 100 degrees). Otherwise, people behind you may not see your taillights.
  6. raffter

    Thread Starter Active Member

    Feb 28, 2008
    oh... But I tried a small experiment using 47R and a SINGLE STRING of 4 LEDs...its OK.. I paralleled another set of 4 LEDs in series, brightness dims up a bit... so I figured if I lower the value of the resistor, I may STILL achieve same level of brightness like that if a SINGLE STRING of LEDs.. does this make sense??

    well thats what I did... 10R to compensate for 8 paralleled LED strings... thats why I asked HOW to REcalculate paralleled (series connected) LEDs.. :)

    so anyways, whats best to do here?? change to higher value resistor?
  7. thingmaker3

    Retired Moderator

    May 16, 2005
    The four LEDs in parallel were more dim because each individual LED had less current flowing through it. In series, the current through each LED was Vapp - 3*LEDdrop / R, whereas in parallel the current through each LED was (Vapp - LEDdrop / R) /4.

    To answer your original question, the voltage across R2 is 1.25V. (That's just how LM317s work.) Current through that resistor will therefore be 1.25/R2.
  8. raffter

    Thread Starter Active Member

    Feb 28, 2008
    Argghh... my mind aint workin now... so IF I used 10R, then how much current passes to EACH LED?
  9. SgtWookie


    Jul 17, 2007
    OK, you have 8 strings of LEDs.
    IF they were matched (as in the procedure I gave above) then each string would be getting 1/8 of 120mA, or 15mA. However, since they are not matched, one string might be getting 20 or 25mA, and the other strings much less.

    As far as what resistor to use to get what current through the LM317, here's more of that partial chart:
    Code ( (Unknown Language)):
    1. Iout    Ohms  
    2. 0.250   4.800
    3. 0.240   5.000
    4. 0.225   5.333
    5. 0.200   6.000
    6. 0.190   6.316
    7. 0.180   6.667
    8. 0.170   7.059
    9. 0.160   7.500
    10. 0.150   8.000
    11. 0.140   8.571
    12. 0.130   9.231
    13. 0.120   10.000
    But since you did not match your LEDs, you should first determine which string of LEDs is getting the most current. Use a meter set to the 200mA range, and measure each string until you find it, and then slowly decrease R2 until the current through the highest-current string is 10% less than the maximum current specified (27mA).

    Either that, or put a 100 Ohm resistor in series with each string, and use a 6 Ohm 1% tolerance 1/2 Watt resistor for R2 to get approximately 25mA through each string. Each 100 Ohm resistor will drop 2.5v at 25mA, or 1 volt per 40 Ohms. This may be excessive, but I don't know what the Vf is on your LEDs (nor do you!) Try measuring the voltage drop across the LM317 (input to the ADJ terminal) - then subtract 0.45 from your reading. If the voltage remaining is at least 2.5v, use 100 Ohm resistors in series with each string. If less, then multiply each volt by 40 Ohms, and use the result of that. For example, if you measure 2.1v, subtract 0.45 = 1.65, x 40 = 66 Ohms. In this case, you would want to use the next smaller standard resistor value, or 51 Ohms.

    Make sense?
  10. raffter

    Thread Starter Active Member

    Feb 28, 2008
    OK thanks SgtWookie... got it!!

    Now thats the answer I was looking for :)

    so thats the way...e.g. 120mA/divided by # of paralleled string of LEDs...:rolleyes:
  11. SgtWookie


    Jul 17, 2007
    Keep in mind that you don't want to run the LED's at their maximum rated current.

    This becomes even more important when you're running them in parallel, and particularly so if they are not matched.

    When the "weakest link" (ie: most likely the string carrying the most current) fails, the remaining strings will be forced to divvy up the remaining current; so instead of 1/8 of the current, they'll be sharing 1/7 of the load - but as before, since they're not matched, it won't be an equal share.

    200mA / 8 = 25mA per string; if one string blows, you wind up with 28.6mA/string, until the next string blows. Then you're over spec.

    If you add the load resistors to each string, that will help a great deal to even things out.
  12. raffter

    Thread Starter Active Member

    Feb 28, 2008
    0 it!! :D but LEDs are CHEAP and they<circuit> are just "used" only for "braking" so they proly last for a long time..has been done on a protoboard AND may take time inserting some more resistors to it... BUT if one string DOES give up<in less than a year>, then I will do the necessary "per string" thingie... thanks for the time and knowledge :)