Help with fading/throbbing LED - more than 1 LED

Discussion in 'The Projects Forum' started by Dmm, Sep 20, 2015.

  1. Dmm

    Thread Starter Member

    Apr 13, 2015
    31
    1
    I have created a working circuit as shown at this link. I use a NE555P timer, 2N4401 transistor (rated for 200 mA,) similar resistors & capacitor. A single LED is connected and fades in and out. The fade is about 3 to 5 seconds long. My breadboard is powered with 6VDC but the final project will eventually use a car battery at 12VDC (not used in a car, just a power source.)

    The LEDs I have are a mix bag from Radio Shack. The package has listed "voltage at 20mA" and they range from about 1.8v to 2.4v. Is this the forward voltage and forward current of the LED?

    If I want to have maybe 8 LEDs (multiple colors if possible in pairs, such as 4 red, 2 green, 2 yellow) connected on this circuit, how would I go about connecting them? Is series or parallel better in my circuit? Then how do I calculate the current limiting resistor at each new LED if adding more LEDs in series or parallel? How do you calculate the current to ensure I stay under then 200mA rating of the transistor? Do you just add up all the forward currents of the LEDs? So in my case with 8 LEDs at 20mA = 160mA? And that doesn't matter if connected in parallel or series?

    A second part to my question, if it isn't too hard or complicated...Can you have a second LED (or set of LEDs) that fades on/off opposite of the first LED? So that when LED #1 is fading on, then LED #2 at the same time is fading off. Or in my example above with 8 LEDs have 4 of them on one strand fading opposite the other 4.
     
  2. dannyf

    Well-Known Member

    Sep 13, 2015
    1,775
    360
    If possible, string them together with a forward voltage sum as close to 12v as possible + a power resistor. Each string is then individually controlled by a transistor, whose bases are tied to the same control signal through individual base resistors.

    Maximum Ic is the least of your concerns here, especially if you do pwm.
     
  3. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,518
    1,247
    Yes, the 1.8 V to 2.4 V numbers are the forward voltage (Vf) ratings of the LEDs. For what you are trying to do, you start with the power supply voltage (6 V or 12 V), and group the LEDs into series strings such that the sum of the Vf's is close to but not greater than the voltage at the emitter of the transistor. You have to consider that the 555 output stage and Q1 are between the LEDs and the battery, so while the battery may be 12 V, the maximum voltage across the LED string is more like 10 V. So as an example, five 1.8 V LEDs equals 9.0 V total Vf. Subtract that from 10 V to get 1.0 V. That is the peak voltage across the current limiting resistor. Use a version of Ohm's Law to calculate the resistor value:
    E = I x R
    R = E / I = 1.0 V / 20 mA = 50 ohms.

    Note: the current limiting resistor must change when the power supply voltage changes, and at 6 V you can not have as many LEDs in a string.

    Now, about that transistor - 200 mA is the max current rating, and you must stay below that. You can have multiple transistors and LED strings connected to the 555 circuit output. Doing so might change the fading speed, but you can compensate for that with a different resistor or capacitor value. You might think you can add multiple LED strings to one transistor as long as the peak current does not exceed 200 mA, but you can not do that. Here's why:

    There is another spec for the transistor, its max power rating. As the circuit is ramping the voltage to the transistor up and down, the voltage across the transistor from collector to emitter, and the current through the transistor, are constantly changing. Because of this, the power dissipated in the transistor is constantly changing according to either one of two laws:

    Watt's Law: P = E x I >> The power dissipated in a device equals the voltage across it times the current through it.
    Joule's Law: P = I^2 x R >> The power dissipated in a device equals the square of the current through it times its resistance.

    A combination of these two laws yields a third variation:

    P = E^2 / R >> The power dissipated in a device equals the square of the voltage across it divided by its resistance.

    To start with, lets assume that the LED string plus its current limiting resistor is just a single resistor. Using Ohm's Law, you can see that a 500 ohm resistor will pass 20 mA at 10.0 V across it, the peak current condition for the LEDs. About half way down the ramp the voltage across the resistor is 6 V and the voltage across the transistor is 6 V (remember that the collector of the transistor is connected to the power supply, not the 555 circuit output, so it is higher). The current through the resistors is:

    P = E^2 / R = (6x6) / 500 = 0.072 W or 72 mW

    Since the same current is flowing through the transistor and the transistor has an equal voltage across it, it's power dissipation also is 72 mW. That's not a lot of power, but a BC547 is a small transistor, and that little plastic package can not handle much power without overheating. The part is rated for 500 mW, but that is the extreme limit with forced air cooling. Most transistors in the TO-92 package should not be pushed beyond 100 mW in "normal" use. So while one transistor is rated to handle the current of multiple LED strings, it can't handle the power. If you had 10 LED strings on one transistor for a peak current of 200 mA, the peak power dissipation would be 1.2 W, more than enough to cause almost instant failure. Because of this I recommend only one LED string per transistor.

    ak
     
  4. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,518
    1,247
    To answer your other question, yes. You can have other LED strings that increase in brightness opposite ones that are decreasing in brightness. If you connect a PNP transistor to the 555 circuit output (where the NPN base is), with the emitter going to GND and the collector tied to an LED string going up to the battery, you will have an equivalent output stage that works in the opposite direction.

    ak
     
  5. Bordodynov

    Active Member

    May 20, 2015
    637
    188
    Your electronic circuit will not work correctly. This happens because the base current of the transistor. If the emitter current of the transistor is equal to Ie the base current Ib = Ie / (beta + 1). Resistor 33k is too big for that!I do not understand your goal. Do you want a smooth change in brightness of LEDs?
     
  6. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,518
    1,247
    Agree, 33K is too high. The circuit has a max possible LED current of 13 mA. At a transistor gain of 100 that is 4.3 V drop across the 33 K. This will decrease significantly the LED brightness. 3.3 K would be better.

    ak
     
  7. dannyf

    Well-Known Member

    Sep 13, 2015
    1,775
    360
    The design is largely correct. The 33k resistor is of the right value for the frequency.

    a minimalist change would be to rewire the transistor's base to pin 3, optionally through a small resistor and call it a day.

    a better design is to put the leds on the collector or the drain.
     
  8. Dmm

    Thread Starter Member

    Apr 13, 2015
    31
    1
    Thank you all for the replies. My first try at re-wire was dannyf's comment about moving the LEDs to the collector side of the transistor. I'm guessing this is because the transistor has a voltage drop across it, so having it between +V and the collector you get a little more voltage across the LED for a brighter LED? Is that correct and the reason for your comment?

    When I re-wired the breadboard, the LED came on, and I burned out the transistor. Saw a little smoke come up, and unplugged the power. The transistor was pretty hot. I forgot to remove my jumper pin from +V to the collector from the old layout. After fixing that and replacing the transistor (same 2N4401) the LED quickly fades on (about 0.25 seconds or so) and glows steady, very bright. I disconnected right away fearing I haven't fixed the issue of burning out my transistor. I double checked everything is connected per the diagram in my original post, except moving the LED and the resistor R3 to between +V and collector. Maybe I'm just not seeing it, but any suggestions?

    [EDIT] I also added a jumper from the emitter to ground for both tries described above.
     
  9. dannyf

    Well-Known Member

    Sep 13, 2015
    1,775
    360
    Post a schematic would be helpful.

    When you move the leds to the collector, you will need a base resistor (assuming that you also take out the resistor on the emitter).

    The reason to move the leds to the collector is to run the transistor in switching mode, rather than linear mode.

    So here is the wiring changes:

    1) wire a base of the transistor to Pin 3 through a resistor -> I would start with 1k for now;
    2) ground the transistor's emitter;
    3) transistor's collector goes to the rail through a resistor + led. The resistor is sized for the desired led current.
     
  10. Dmm

    Thread Starter Member

    Apr 13, 2015
    31
    1
    I'm new to electronics, so the linear vs switching I don't know about. I uploaded my original circuit and the one I just changed. I always have had a resistor between pin 3 and the base. Do I need a resistor between emitter and ground on the new schematic (where the LED/Resistor is on the collector side of the transistor?)

    Original.JPG Move to collector side.JPG
     
  11. dannyf

    Well-Known Member

    Sep 13, 2015
    1,775
    360
    Keep R1/C1 where they are. Unhook the base and wire it to Pin 3 through a 1k resistor.
     
  12. Dmm

    Thread Starter Member

    Apr 13, 2015
    31
    1
    I'm a little confused. I have a resistor between the base and pin 3 already. R1 which is about 33 k-ohm.
     
  13. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,518
    1,247
    The only problem with your original circuit is that the change to multiple LEDs in series changes the requirements for driving the transistor. However, moving the LEDs to the collector is a major change to the circuit function. Now the transistor is acting as a saturated switch, which is why you no longer see the range of brightness. I suggest that you return to you original circuit with some changes.

    While it is tempting to put multiple LEDs in series, that changes the dynamics of how the circuit operates. For a 12 V battery with only one standard LED (2V Vf) and one transistor (0.6 V Vbe), that's a total of 2.6 V. So the range of voltage across the LED and its resistor are 9 - 2.6 = 9.4 V. This creates a large range of current values from dim to bright. However, if you put three LEDs in series, the voltage range across the string decreases from 9.4 V to 5.4 V. In practice it is even less because of changes in the base resistor current, but this is a quickie example. The smaller voltage range means a smaller current range through the LEDs. They still will throb and fade, but not as much.

    So, if you want to keep the same visual effect but increase the number of LEDs, the "right" way is to have one current limiting resistor for each LED and add them in parallel to the original string. Do not have only one resistor with just the LEDs in parallel. Each LED must have its own resistor. This will heat up the transistor, so add the strings one at a time and feel the transistor. In this way the new LEDs will have the same voltage and current ranges as the first one (assuming the same Vf for each LED). Things change a bit when using LEDs with a higher Vf like 2.4 V, but that's a secondary issue that comes later.

    ak
     
  14. Dmm

    Thread Starter Member

    Apr 13, 2015
    31
    1
    I should be able to do some more testing this next week with a more final circuit and multiple strands. My question now, is when I power the final setup from the 12v car battery, what gauge wire should I use? I might have to run 50 to 100 feet away at most, but more than likely in the 30' range. I would probably connect a few of these circuits in parallel, possibly 5 or 6 of them. Each individual circuit running maybe 4 strands of LEDs (2 LEDs each strand.)
     
  15. Dmm

    Thread Starter Member

    Apr 13, 2015
    31
    1
    I went back to muni went back to my original circuit and had it working with 1 LED, and it fades in and out about 8 seconds (4 in and 4 out.). I then added a second LED and resistor in parallel, and they fad in in about 1-2 seconds but then stay on forever. It does not fade. Anyone help me understand why? I expected both LED to fade in out similar to when I had just 1 LED. If I pull one of the LEDs in my circuit, the other one will start fading in and out.

    Edit: If I put LED in series (with 1 resistor 217 ohms) they fade in out. With about 5 seconds off and 2 seconds on.
    Edit 2: R2 on original (just the 1 LED) is 217 ohms as well.
    image.jpg
     
    Last edited: Oct 8, 2015
  16. Dmm

    Thread Starter Member

    Apr 13, 2015
    31
    1
    With the 6v supply I have the effect I want using the 2 LED in series. However when I connect the 12v car battery I get different results. See attached picture. I like the effect when at 6v using 100kohm resistor the LEDs were off 15 seconds and only on for about 8 seconds.

    Now when connected to the 12v the LEDs are barely off and stay on a long time. Anyone help out to get the effect where they are off about 15-20 seconds and fade on/off a short time around 5-10 seconds?

    image.jpg
     
  17. InspectorGadget

    Active Member

    Nov 5, 2010
    211
    42
    AnalogKid had the right idea.

    Many of you missed the point of the circuit. It is an emitter follower. It has nothing to do with current through the 33K resistor, it only has to do with the VOLTAGE at the resistor/capacitor/base node. The voltage on the emitter will follow the base voltage at 0.6V lower. Since the 555 timer chip will threshold between 1/3 and 2/3 supply voltage, you know exactly what the voltage range will be on these nodes.

    The only hidden issue is that you'll need enough gain in the transistor so that it won't draw too much current off the R/C node and change the operation of the 555. So if you add a lot more LEDs and so need to have increased collector current, you may need to go to a Darlington configuration to get the gain you need. And in this case the emitter-followed voltage will be 1.2V lower than the base because of the cascaded base-emitter chain.

    Implicit in all this is that you expand the number of LEDs in parallel, each with their own current-limit resistor. You'll need to experiment with the LEDs to normalize their brightness with each other because in a grab bag you'll have different types with different emission power.

    So ultimately for each one you just need to calculate your LED current-limiting resistor for the desired current range through the LED. You can start out with the standard value and trim it for different LEDs if they're brighter or dimmer.

    But I wouldn't even use 2 LEDs on a resistor. Do each one separately so you have more control over brightness balance.
     
    AnalogKid likes this.
  18. InspectorGadget

    Active Member

    Nov 5, 2010
    211
    42
    By the way, the Digi-Key page threw you off with an incorrect circuit explanation. Their statement: "The first circuit charges a 100u and the transistor amplifies the current entering the 100u and delivers 100 times this value to the LED via the collector-emitter pins" is incorrect.

    The transistor absolutely does NOT amplify the current entering the 100uF capacitor. The transistor's emitter follows the voltage at the capacitor 0.6V lower, and determines the emitter current by virtue of the LED current-limiting resistor. Then, it only draws 1/100th of this emitter current from the base, which will be very small (~200uA) so as to not destabilize the capacitor charge and discharge timing through the 33K resistor.
     
  19. Bordodynov

    Active Member

    May 20, 2015
    637
    188
    I gave an example of composite transistors. I also calculated the power dissipation of the output transistors!
    By the way, I never understood the author wants a smooth change in brightness LEDs (why driving signal in the form of a triangular pulse?). Or enough to turn on and off the LEDs?

    I hope this helps. Mumu.png
     
    Last edited: Oct 9, 2015
  20. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,518
    1,247
    The quick answer is to add 3 more LEDs in series. The additional voltage drop will re-establish the relationship between the voltage at Q1 emitter as a percentage of Vdc and the turn-on voltage for the LED string. The perfect number would be 3.5 LEDs, but obviously you can't do that. If 3 LEDs is not close enough, add a signal diode to the string, something like a 1N914 or 1N4004.

    ak
     
Loading...