Need help with PWM and LED control

Discussion in 'The Projects Forum' started by cg8798, Oct 18, 2007.

Thread Status:
Not open for further replies.
  1. cg8798

    Thread Starter Member

    Oct 18, 2007
    26
    0
    I'm designing some led tail lights and I need to know about PWM's. I understand that they can control the light output from the led so I need to figure out how it will work with tail lights.

    The details are:
    1. 12v power source (car battery)
    2. Need leds to be on during regular working but become brighter when brakes are hit.
    3. How are PWM's wired?

    If you have any helpful links for controlling leds with a PWM let me know. Thanks!
     
  2. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    It suspect that PWM is a bit of overkill for your application.

    What might serve your purpose just as well is to have a two-state current drive for your LED array that operates in the low level state (state 1) under normal conditions and then can be switched to the high level state (state 2) when the brakes are pressed.

    This will greatly simplify the overall circuitry.

    hgmjr
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    PWM simply means "Pulse Width Modulation". It's a way of regulating current.

    Do you have any light dimmers installed at your place? They work by a form of PWM. The knob controls how wide the pulse of electricity is that's fed to your lights. The shorter the pulse, the dimmer your lights.

    LED specifications are usually given something like; "25 mA @ 2.8 VDC" - it's important to not exceed the specifications, as they will have a short life span if you do. There may also be specifications for peak momentary current, giving a number and either a duty cycle in percentage and/or on time/off time.

    Normally, one controls the brightness of LED's by controlling the amount of current fed to them. This can get complex when you're driving an array of LED's; as you want to ensure that if any of them happen to short out, it doesn't increase the current flow through the rest of them, as that could bring about the sudden demise of the entire array. :eek:

    What are the specifications for the LED's that you're considering using? Do you have a datasheet, or a manufacturer's part number?
     
  4. cg8798

    Thread Starter Member

    Oct 18, 2007
    26
    0
    thanks for the quick replies. Details...just using regular ultra white 5mm leds. 5000mcd, I believe they are 20mA @ 3.3 VDC. I don't know if you want more details about the tails but there are 6 lines of leds. 7,8,9 and 9,10,11. There are two sets of each. That's not that imporant but just wanted to give specs that there will be 108 leds in series of three with 100 ohm resistors. Will the PWM be needed or should i go with something else as hgmjr described. A two-state current drive?
     
  5. Voltboy

    Active Member

    Jan 10, 2007
    197
    0
    I'll say you go with two-state current drive. I did a similar project. A building (with barbecue sticks) and I added alot of LED's to it, about 35, and I had 4 states, off,low,medium,high. I only used different switches, but I guess you'll want to do it electronically.
    Dont get bothered with PWM.
     
  6. cg8798

    Thread Starter Member

    Oct 18, 2007
    26
    0
    ok so where do i find one of these two-state current drive? I've been searching google for an hour now and i haven't come up with any good leads.
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    There's already a problem with your plan. Let's look at the numbers.

    LED's are rated 20mA @ 3.3v. It's critical to not supply more current than they are rated, or they'll have a very bright, very short life.

    Your vehicle's electrical system, when the battery is fully charged, puts out a nominal 12.7v

    Let's figure out what resistor we need for starters.

    three LED's in series will drop 3*3.3v, or 9.9v.

    12.7 - 9.9 = 2.8 volts remaining; we need to make sure that our resistors are going to do the job.

    I = E/R, or Current = Voltage/Resistance (Ohm's Law)
    I = 2.8/100
    I=0.028A = 28mA - oops. We're running at 140% rated current. :eek:

    That's not the end of it; when you start the engine, the alternator kicks in.

    You can get 14 or more volts from the alternator right after starting.

    14 - 9.9 = 4.1
    I = 4.1 / 100
    I = 41mA, or 205% of the LED's rating. LED BBQ, anyone? :D

    The problem right now is you have a varying voltage supply between engine off and engine on. Simply changing the resistor's value for 14v will leave you with dim lighting when you're parked. That's not good either.

    Let's start by regulating the voltage supplied to all of the LED's. Go to National Semiconductor's website, and get the datasheet for LM317's. This is a variable positive voltage regulator IC, available in several packages, including small TO-263 and SOT-223 packages.

    Look at the schematic under "Typical Applications"
    Let's make some substitutions:
    R1 - 220 Ohms
    R2 - 1700 Ohms
    Calculated output voltage: 10.92 (approx)

    So, if you used the output of a regulator wired like in the datasheet, but using those values of resistors, you would have a constant 10.92v supply - right up until your battery ran down under 12.4v (I'm figuring 1.5v drop through the LM317)

    If we're getting 10.92 supplied to our string of LED's needing 20mA @ 9.9v, we still have some current limiting to do.

    10.92 - 9.9 = 1.02v to drop

    I = E / R
    Swapping Ohm's Law around
    R = E / I
    R = 1.02 / 20 mA
    R = 51 Ohms

    OK, so now we know what value resistance to use on each of our strings to get 20 mA through them. That'll be for when the brake lights or turn signal is on. What about the parking/running lights?

    LED's are quite linear in respect to brightness vs applied current. Let's say you want them about 2/3 bright under normal running, and full brightness with the brakes/turn/flashers on.
    20 mA x 2/3 = 13.33 mA (approx)

    R = 1.02 / 13.33 mA
    R = 76.5 (approx)

    So, you need roughly 76 Ohms for standard running, and 51 for brakes/turn/etc.

    It just so happens that if you put a 75 Ohm resistor in parallel with a 160 Ohm resistor, you wind up with just a bit over 51 Ohms. Remember, it's the maximum current that's critical here. As long as we're supplying the LED circuit with no more than 10.92V from the LM317, 51 Ohms in series with three LED's will keep the current at or below 20 mA.

    This still needs some thought, and it's past my bedtime. ;)

    Something else to consider; the LED's will consume far less power than your filament-powered lamps. You'll need to consume about the same amount of power in order to make the turn signal flasher and emergency flasher function normally. You'll need to measure how much current the original bulbs are using in order to select a load resistor to come close to matching it.
     
  8. cg8798

    Thread Starter Member

    Oct 18, 2007
    26
    0
    well that was a lot of information that i'll have to reread a lot. But I wanted to say that the tails do not flash. They are just lights and brakes. No turn signals. I have people on a car forum that have made these and they did not go through everything you just wrote out ha. I know that they ordered regular 5mm leds off ebay, used the resistors that came with them, wired them in series of 3, and just used a PWM to control the brake lights. I'll have to reread and see if i understand any of this.
     
  9. cg8798

    Thread Starter Member

    Oct 18, 2007
    26
    0
    ok so new update is that I'll be using superflux leds. Foward voltage is 2.6 at 70mA. Different then I previously thought. Ledcalc.com is showing me to use a 68 ohm resistor for each series of three. Is that off or what?
     
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, now you're dealing with different spec LED's. I'm sure they'll be a lot brighter than those you were considering previously.

    3 x 2.6 = 7.8 volts dropped by the three LED's
    12.7 - 7.8 = 4.9 volts left
    4.9/70mA = 70 Ohms, which is roughly what you came up with.

    Let's see what happens when the alternator is running:
    14 - 7.8 = 6.2
    6.2/70mA = 88.6 Ohms (approximately)
    Coincidentally, if you're using a 70 Ohm resistor and the alternator is putting out 14v, you'll be putting nearly 88.6 mA through your LED's, or 126.5% their rated current. :eek:
    Additionally, you'll be dissipating nearly 0.55 watts in each resistor, so you'll need to use 1 watt resistors. You MIGHT be able to scrape by with 1/2 watt, but don't be surprised if they run really hot.

    Alternatively, you could use a couple of 1/4w 180 Ohm resistors in parallel for each LED string. Each resistor would dissipate about .21 Watts, the combined resistance would be 90 Ohms, at 14v (alternator running) you would get 68.9mA through each string of LEDs
     
  11. cg8798

    Thread Starter Member

    Oct 18, 2007
    26
    0
    ok so would you recommend going with a bigger resistor for each series? Would that solve the problem? Should I still stick close to 100 ohm resistors with the superflux leds?
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I might've added more info to my last post after you made this post.

    Still haven't solved the problem of "normal" brightness when running lights on, and "high" brightness when brakes applied.

    Do you have a part number and datasheet for your LED's?

    If you really are determined to build a PWM circuit, need more than just the I @ V specs.

    Are these LED's clear, rectangular, with 4-leg PCB mounting and emit red light? If so, I think I have some of them.

    Just tried one for a sample; achieved 70mA @ 2.66v. Holy cow, are these things bright! :eek: Before you try powering one of these things up, I suggest you hold a sheet of typewriter or notebook paper a few inches over the thing to diffuse the light so you don't see spots like I am :rolleyes: I only had it powered up for a few seconds and wasn't looking directly into it.

    Obtained what seemed to be around half-brightness around 30 mA.
     
  13. cg8798

    Thread Starter Member

    Oct 18, 2007
    26
    0
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, that helps a lot!

    The LED's we're dealing with are:
    HPWT-DH00-F4000 (mine)
    HPWT-MD00-F4000 (yours)
    Mine are more towards red-orange, and have a narrower viewing angle (40° vs your 70°)
    Your max intensity is 4.4 compared to mine at 11.0 though (due to the narrower viewing angle.) For brake lights though, wide-angle viewing is a good thing. But straight on, mine will appear much brighter. Therefore, you're going to have to see what works best for you.

    Let me play around with this a bit in the evening - the mower is apart and the grass is getting high... ;)
     
  15. cg8798

    Thread Starter Member

    Oct 18, 2007
    26
    0
    i appreciate all the help SgtWookie. I forgot to ask you. Do you think it would be better putting them in series of 5? There would be one series of 4 tho because of numbering. Do you think it would be better to do more in a series?
     
  16. John Luciani

    Active Member

    Apr 3, 2007
    477
    0
    You are better off with a constant-current sink than a resistor. You can build one
    with an op-amp and transistor or with a TL431 and a transistor.

    Also you should check out the On-Semi NUD4001. There are a number of application
    circuits in the datasheet including automotive.

    From the datasheet ---

    This device is designed to replace discrete solutions for driving
    LEDs in low voltage AC−DC applications 5.0 V, 12 V or 24 V. An
    external resistor allows the circuit designer to set the drive current for
    different LED arrays. This discrete integration technology eliminates
    individual components by combining them into a single package,
    which results in a significant reduction of both system cost and board
    space. The device is a small surface mount package (SO–8).


    Also the applications listed are

    • Portables: For Battery Back−up Applications, also Simple Ni−CAD Battery Charging
    • Industrial: Low Voltage Lighting Applications and Small Appliances
    • Automotive: Tail Lights, Directional Lights, Back−up Light, Dome Light


    (* jcl *)
     
  17. cg8798

    Thread Starter Member

    Oct 18, 2007
    26
    0
    well that idea sounds good too but when I look at the website, I don't know what it all means. Is this supposed to cut out the resistors? Just wire all the leds together and put this before them? What are the pros and cons on this On-Semi NUD4001 idea?
    http://www.onsemi.com/pub/Collateral/NUD4001-D.PDF
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, I'm back.

    Tell me - your running and brakelights; how are they powered? Most used to have ground on the outside of a bayonet-base bulb, with power applied to one of two base contacts for parking or brake/turn intensity.

    Yours may be different.

    Do you have a schematic of your electrical system?
     
  19. Nomad

    Active Member

    Oct 21, 2007
    43
    0
    auto lighting hasn't changed as far as that goes. most still use 1157 bayonett bulbs. others still use the neg ground separate feeds. unless of course its a pos grounded vehicle rare. commercially available led tail lights use sets of leds and different resistors for each feed along with diodes to isolate. want to see this easily stop at an auto parts store or truck stop and look at the 4inch semi tail lights. you may still need a sizable current draw when brakes are applied to signal things like the cruise control. (needs to cut off when brakes are used) they actually package a set of resistors for this at auto parts stores to be used when replacing standard bulbs with pre made led 'bulbs'.
     
  20. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Actually, most vehicle manufacturers have changed over to use 3057/4057 long life or 3056/4056 for single element bulbs. The bases are quite different than the old bayonet base; they're made from a hi-temp plastic with single wires wrapped around to make the connection inside the socket.

    The "old fashioned" way was to run the shell of the bayonet base to ground, and the parking/running and brake/turn signal lines were supplied with 12.7-14v when needed. This may not be the case in all vehicles anymore; they've been getting creative with the wiring.

    I simply want to confirm the wiring to his lights. It would be a shame to build something, and then have it not work at all due to the existing wiring not being as expected.

    Postive grounding pretty much disappeared in the late 60's; the British finally realized that you could get a better spark at the plugs with negative ground. For those early cars with generators, it's pretty simple to change polarity (with the exeption of the radio) - you just have to zap the field winding of the generator to reverse the polarity of the output. But that's beyond the scope of what the OP needs help with. ;)

    John Luciani came up with an interesting IC; but before effort is expended on designing something around it, the connections coming in to the brake/parking lamps should be verified.
     
Loading...
Thread Status:
Not open for further replies.