All About Circuits Forum  

Go Back   All About Circuits Forum > Blogs > Bill's Index

This is my index page, where I will point to blog sites and forum posts I think are of special interest to anyone here on AAC (All About Circuits).

Bill's Index (blog, this page)
Introduction and PaintCAD (blog)
Some Tutorial Videos (thread, nicely done)
My Articles:
...ElectroStatic Discharge (AAC book)
...Creating a Virtual Power Supply Ground
...LEDs, 555s, Flashers, and Light Chasers (forum edition)
...LEDs, 555s, Flashers, and Light Chasers (blog, current edition)
...The 555 Projects (blog)
My Current Projects (blog)
Bill's Albums
Alternate Math Symbols
How to Display Attachments Full Size
BB Code List
555 Servo Controller
High Speed Op Amp Query
How to link text to a website
Arduino Microcontroller
555 Research Sources

Interesting websites outside AAC
The Battery University
Bill Bowden's Hobby Circuits Excellent site!
Sine Wave Oscillators A PDF abstract by TI
Rate this Entry

LEDs, 555s, PWM, Flashers, and Light Chasers Index

Submit "LEDs, 555s, PWM, Flashers, and Light Chasers Index" to Digg Submit "LEDs, 555s, PWM, Flashers, and Light Chasers Index" to del.icio.us Submit "LEDs, 555s, PWM, Flashers, and Light Chasers Index" to StumbleUpon Submit "LEDs, 555s, PWM, Flashers, and Light Chasers Index" to Google
Posted 09-20-2009 at 04:39 AM by Bill_Marsden
Updated 10-10-2009 at 12:04 PM by Bill_Marsden

LEDs, 555s, PWM, Flashers, and Light Chasers

I'm moving this article to blog format to allow me greater flexability in editing. Please, do not comment in the blog, if you do I will delete it. If you want to leave a comment do it here.

One of the most common requests at All About Circuits is various methods of flashing LEDs. I'll try to show most of the techniques used for this purpose that have been covered on this site, explaining how and why along the way.


Index

1....LEDs
2....Current Limiting
3....The LED / Resistor Only Bargraph
4....The 555 Integrated Circuit
5....The 555 and PWM
6....Low Power Applications
7....The Joule Thief
8....From Four, Twenty
9....Light Chasers
10.l.Transistor Drivers
11.l.Making Patterns
l.....Conclusion

Posted in Uncategorized
Views 3758 Comments 12
Total Comments 12

Comments

  1. Old Comment
    Bill_Marsden's Avatar
    Chapter 1: LEDs

    To design a flasher to order it is important to understand how these parts work. LEDs are simple enough, but they have been around for a long time, and have changed quite a bit from their first commercial release. The old parts were fairly dim, and couldn't use much current. It is now possible to buy LEDs that will use over an amp and easily outshine most light bulbs. This article will deal with the dim to medium 5mm type of LEDs, since that is the majority simple ICs can easily power.

    LEDs are current devices. This means they operate on current once a minimum voltage is provided. Like conventional diodes, they do not limit this current, another component has to do this. Connect an LED to a power source without a resistor and it will be damaged, probably burned out. Figure 1.1 shows the conventional scheme to light up an LED.


    ..................Figure 1.1

    The forward dropping voltage, or Vf, of an individual LED is very stable. Go below this voltage and the LED stops conducting. This LED is assumed to be 2.5V, pretty standard for a modern red unit. The target current is 20ma. Going though the math (using Ohm's Law) the resistor is 325Ω. Since 330Ω is the nearest standard resistor value 330Ω it is.

    Here is the approximate Vf of most LEDs:

    ......... Older Generation ... Newer Generation
    Current ....... 10ma ................... 20ma
    Red ............ 1.5V .................... 2.5V
    Yellow ........ 2.0V .................... 3.0V
    Green ......... 2.0V .................... 3.0V
    Blue ....................................... 3.5V
    White ..................................... 3.5V

    For the Vf of a specific device you need to refer to the datasheet, and also understand there will be some variation even within a family. Part of the reason LEDs have changed so much is their efficiencies have gone way up. A modern LED at full power can damage your eyes if held directly next to the eyeball with the light shining in. Obviously these are not toys for children. Older LEDs didn't come close to these power levels.

    LEDs can also be chained to share the same current to light more than one LED. Since this current is being used twice the apparent efficiency to light these LEDs is increased. Given that the LEDs can vary their Vf it is a really bad idea to parallel LEDs directly. Figure 1.2 shows a fairly typical example of how to do both for increased lighting.


    .........................Figure 1.2

    The reason it is such a bad idea for parallel LEDs to share their current limiting resistor is normal variations in Vf can cause one leg to draw more current than the other. This can result in the failure of one chain over time, leaving the second chain to absorb all the current. If you have a lot of LEDs in parallel this can lead to a progressive cascade failure, with LEDs popping like corn. You might be able to get by with it, but it is definitely not good design practice.

    Posted 09-28-2009 at 07:20 PM by Bill_Marsden Bill_Marsden is offline
    Updated 10-01-2009 at 09:39 PM by Bill_Marsden
  2. Old Comment
    Bill_Marsden's Avatar
    Chapter 2: Current Limiting

    If you are dealing with a stable power supply a resistor is good enough. Be sure to use a resistor that is twice the wattage (or more) than is actually needed. Wattage equals the voltage squared across the resistor divided by the resistance (P=V²/R). This is because some resistors may shift in their values if baked out, or overly stressed.

    If the LED current is critical and you need precision, or if the power supply is less than stable, as in the case of automobiles, then better might be needed. A car can vary from 12VDC (battery) to 13.7V when running. This may seem like a small change, but it can create a significant current variation in practice.

    The way around this is to use either a constant current source (current regulator) or voltage regulator. Used properly these circuits will stop power supply or LED Vf variations from affecting the design.

    The LM317 is an excellent IC for this use. It comes in a wide variety of transistor packages big and small, is easy to use, inexpensive, and has excellent performance characteristics. It can be a voltage or current regulator. It's only downside is it drops about 3 volts. Figure 2.1 shows the two ways of using it's current regulation mode, Vcc can be 5.5V up to 37V, the LED doesn't change its brightness a bit (though the LM317 will get hot, and possibly burn up if not properly heatsinked for extreme voltage). The TO220 case style is shown because it is one of the most available models, and it dissipates heat extremely well.

    ...
    ............................Figure 2.1.................................................. ..........................Figure 2.2

    In the figure 2.2 the current is kept constant by keeping the voltage constant. This way one regulator IC can handle many more diodes. The LM317 requires 10ma minimum on its feedback leg, so 120Ω for R1 is pretty much a requirement, though lower values can be used (with an increase in current and no improvement in performance). If there is a long length of wire between the output of the LM317 and its load (the LEDs) you should add a 0.1µF and 10µF capacitor to the input and output pins of the LM317 to prevent the regulator from oscillating.

    The 3V drop between the input and output of the LM317 IC can make it unsuitable for some uses. Lets go back to the automotive circuit, where the Vcc can vary between 12VDC and 13.7V. We'll start with this example in Figure 2.3.


    .................................................. ............Figure 2.4

    Each leg the total voltage drop across all three LEDs is 10.8V. If Vcc is 13.7V, then the current through each leg is 19.3ma. These LEDs were rated at 20ma, so the number matches nicely. However, if the voltage goes to 12V the current in each leg drops to 8ma. Quite a difference, and the LEDs will be a lot dimmer. This would be unacceptable.

    If you change the resistors to 56Ω to power the LEDs with 21.4ma at 12V then they would get 51.8ma at 13.7V. Again, this is unacceptable. A regulator is needed. However, remember that the LM317 drops 3V. At 12V it could output 9V, at 13.7 it could output 10.7V. You could remove one of the resistors in the chain, but to use the same number of LEDs the total current would go up by a third.

    Being willing to remove an LED per leg may be the best choice. Sometimes we get so fixated in squeezing every bit of use out of the current the design dependability suffers. It is a personal decision, just be aware when you are skirting this edge.

    The other answer is to go to other designs for the regulator. Here are some I've come up with over time.


    .................................................. ................................................Figure 2.5

    The first two designs, current regulators, work well. The voltage regulator in Figure 2.5 has an insertion drop of 0.6V, and if everything is perfect it will work. However, the zener diode VR1 has a 5% tolerance, which is 11.4 to 12.6V. The outside ranges just won't work, so it would have to be test selected and the LED resistors adjusted. A friend suggested a programmable shunt regulator that might do this job better, a TL431A. It would replace the zener with a precision value.

    A few tenths of a volt can make huge differences in these designs. If the blue LED had a Vf of 3.8V (a real world value) the voltage regulator would not work.

    For the beginners I may have terrified I apologize. Most times you can get by with a simple resistor, LEDs are pretty easy. I covered some pretty advanced ground here, but look at Figures 1.1 and 1.2, understand them, and you'll have what you need to know.

    <Continued in next post>
    Posted 09-29-2009 at 01:23 PM by Bill_Marsden Bill_Marsden is offline
    Updated 10-01-2009 at 09:42 PM by Bill_Marsden
  3. Old Comment
    Bill_Marsden's Avatar
    Chapter 3: The LED / Resistor Only Bargraph

    LEDs tend to drop a constant voltage when they are conducting. It’s not perfect, but it can be used. Take the following schematic in figure 3.1. I’ve included a schematic for a simple variable power supply using transistors and two 9V batteries if you want to experiment with them.


    ..........................Figure 3.1

    As you raise the voltage into the circuit you will see some of the LEDs brighten a little before others. This is due to the variations of the resistors (which are usually ±5%) and the Vf of the LEDs themselves. Ideally they should all come on at the same time.

    So what if this effect was cultivated? By using different values for the resistors, we can use the voltage divider effect to turn the LEDs on at different voltages. Once an LED turns on it will stay at the same voltage, and it’s matching resistor will not increase its current as the input voltage (Vin) continues to rise. The remaining current will be routed through LED, causing the LED to get brighter. Figure 3.2 shows how this would work. You’ll note there is an approximate 10% spread between a resistor and the next resistance down.


    .........Figure 3.2

    Analyzing what voltages will cause which LEDs to light can be tedious, but is predictable. You have to analyze the circuit from scratch every time an LED turns on, and it is critical the Vf used in the calculations match the LEDs. Small errors accumulate in this design. Start by looking at the main current limiting resistor R1. It doesn’t interact very much with the bargraph, but it does set the total current. Assuming the Vf of the red LEDs is 2.5V, six LEDs work out to be 15V, and the power supply can go to 16.8V with fresh batteries. I chose an arbitrary current of 25ma, figuring 5ma will go to the resistors. So to figure R1 use:

    R1 = (16.8V – (6 X 2.5V)) / 25ma = 72Ω ≈ 75Ω
    It = (16.8V – (6 X 2.5V)) / 75Ω = 24ma

    Next you work through the resistor network. Since R7 is the highest value it will drop the most voltage, turning D6 on first. We are assuming the Vf is 2.5V, so that is the voltage we are interested in for R7, the transition between R7 controlling the voltage and D6. This is a classic voltage divider, so plugging the numbers in looks something like:

    Rt = 75Ω + 300Ω + 330Ω + 360Ω + 390Ω + 430Ω + 470Ω = 2,355Ω
    IR7 = 2.5V / 470Ω = 5.32ma
    VD6 = 5.32ma X 2355Ω = 12.5V

    So at 12.5V the first LED turns on. At this point R7 is not figured as a resistance, but as a constant voltage, and is added to where VD6 is calculated. Repeating the procedure to find where D6 turns on:

    Rt = 75Ω + 300Ω + 330Ω + 360Ω + 390Ω + 430Ω = 1,885Ω
    IR6 = 2.5V / 430Ω = 5.81ma
    VD5 = 5.81ma X 1885Ω = 10.95V + 2.5V = 13.5V

    You repeat this procedure for each LED.

    Rt = 75Ω + 300Ω + 330Ω + 360Ω + 390Ω = 1,455Ω
    IR5 = 2.5V / 390Ω = 6.41ma
    VD4 = 6.41ma X 1455Ω = 9.33V + 5.0V = 14.3V

    Rt = 75Ω + 300Ω + 330Ω + 360Ω = 1,055Ω
    IR4 = 2.5V / 360Ω = 6.94ma
    VD3 = 6.94ma X 1055 = 7.33V + 7.5V = 14.8V

    Rt = 75Ω + 300Ω + 330Ω = 695Ω
    IR3 = 2.5V / 330Ω = 7.58ma
    VD2 = 7.58ma X 695Ω = 5.27V + 10V = 15.3V

    Rt = 75Ω + 300Ω = 375Ω
    IR2 = 2.5V / 300Ω = 8.33ma
    VD1 = 8.33ma X 375Ω = 3.13V + 12.5 = 15.6V

    So this bargraph will start at 12.5V and slowly go up and max out around 16V. You’ll note it is not very linear (though this can be tweaked), it isn’t meant to be. This is not meant for an instrument, but a simple display. There are chips that can do much better at this, such as the LM3914. This chip will do precision displays and a wide range of user options with a minimum of fuss. The schematic shown in figure 3.2 on the other hand will smear, one LED starts to light, but before it is fully illuminated the next one starts to light, so the transition is over 2-4 LEDs. The eye is very good at picking this out however.

    While this isn't meant for instrumentation, it has the potential for such. Older LEDs, with their smaller Vf, work much better for this application since each LED is a smaller increment of voltage. Newer isn't always better. You can also improve the predicted values by measuring the real Vf of each LED, and using the real values in the calculations.

    You aren’t limited to a simple bargraph. Since the resistors choose which LEDs light first you can have several LEDs light up at the same time, or use whatever sequence you choose.

    There are other ways to use the fixed Vf of an LED. Someone had a problem where they wanted the LED to go out when the glove box was closed. The catch was they wanted to turn it off when a switch closed (a magnetic reed switch), which is counter intuitive at first glance. Power to this LED would be cut when the key was removed from the ignition, which allowed for this approach.


    ..............................Figure 3.3

    R2 was used to control the wattage used by R1 when S1 is closed. If a simple short was used R1 would go over ½ watts, too much heat in a small space. With the addition of R2 this would go down to an eighth watt. Using a similar resistor divider technique I was attempting to get the voltage under the Vf of the combined diodes.

    Unfortunately the difference between theory and practice caught up with me, but this was fixed by dropping R2 down to 180Ω.

    Posted 09-29-2009 at 01:26 PM by Bill_Marsden Bill_Marsden is offline
    Updated 10-10-2009 at 11:55 AM by Bill_Marsden
  4. Old Comment
    Bill_Marsden's Avatar
    Chapter 4: The 555 Integrated Circuit

    This IC has been around for a long time, over 30 years. The 555 IC could have been designed for LEDs, it is as if they were made for each other. I've written several articles about it, and won't go to the depth I did about the LEDs. Some internals of the 555 IC do need covered, since they relate to LED voltages.

    The 555 has a digital output. It is either switched to the positive voltage (high) or the negative (low). An equivalent drawing of it's output would look something like this:


    .................................................. .......Figure 3.1

    Although Circuit #1 and Circuit #2 look different, they are pretty similar in performance. Generally I prefer circuit #2, but #1 will handle some special LEDs that are a red and green LED in the same package. Alternate between the LEDs fast enough, and it appears yellow. In both cases the 555 output shorts one side or the other, leaving the opposite side to light up with full power. The two internal diodes shown (which are actually two base emitter junctions) generate 1.2V, which swamps the LED Vf it is parallel to.

    So far I have been showing how to light the LEDs at full power, and how to select the resistor for this. An LED will light up with 1ma and be visible, which will work for a lot of indicator applications. Many cases, such as my experiments, I use a 1KΩ for convenience, and don't worry about it. In the above application this would work out to 6.5ma, which works well enough.

    Another issue to be aware of is what the 555 can provide in current. I've already shown it's voltage limitations, but the transistors inside the IC can only provide 200ma before being damaged. There is a general rule in electronics that you should only use half what a component can provide, to make sure the part lasts its expected life. I don't always follow this rule myself, but you need to be aware. The 555 is also rated for 4.5 VDC to 18 VDC, generally this will set the power supply limits of the circuit.

    The 555 is a very open ended ICs, and have a lot more uses than just flashers, but for the purposes of this article we'll concentrate on the flasher applications. Shown in Figure 4.2 are two basic configurations that can be used to flash LEDs.


    .................................................. ...... ............ .........................Figure 4.2

    Oscillator #1 is in the family of Hysteretic Oscillators, which is usually made with op amps. The 555 version adds some its own twists, since the output isn't quite rail to rail (as shown by the two diodes in the first illustration). Its duty cycle is hard to predict, since it is somewhat dependent on power supply voltage. The higher it's power supply voltage, the closer to 50% it becomes. However, for many applications the duty cycle imperfection is hard to see, so it can be used in a large number of applications with good results. You can even put a potentiometer for R1, which allows the flasher to cover a really large range of rates and frequencies.

    Oscillator #2 is straight out of the 555 datasheet. With the addition of a second resistor it overcomes all the problems with oscillator #1, including the 50% duty cycle. For 50% R1 needs to be as low as possible, which is balanced by the fact that at one point R1 is completely across the power supply, thus being one of the components that set the total current draw of the circuit.

    C2 is a bypass capacitor. For a single 555 on a battery you don't really need C2 or any other bypass capacitors, which is why I show it as a "ghost" image. There is an exception to this rule, which will be covered in the following article.

    So what if you need a single LED that is one only 10% of the time? It is simple, use the D1 side for your LED. If you need 90% then use the D2 side for your LED.

    Posted 09-29-2009 at 01:27 PM by Bill_Marsden Bill_Marsden is offline
    Updated 10-10-2009 at 11:54 AM by Bill_Marsden
  5. Old Comment
    Bill_Marsden's Avatar
    Chapter 5: The 555 and PWM

    The 555 has a use that doesn't fall under flasher nor light chaser, but deserves mentioning since it concerns LEDs. That is PWM (Pulse Width Modulation). You could vary the intensity of an LED by varying the current to it, but in many cases this isn't a preferred option, nor is it really linear. PWM allows for truly linear intensity control of a LED.

    Shown below in Figure 5.1 is how PWM works. Basically the intensity of the LED brightness is a direct function of how long the power supply is on versus how long it is off, usually expressed in a percentage. This percentage is a direct indicator of LED intensity.


    .................................................. .Figure 5.1

    Part of the key to how PWM works is speed, the human eye can not perceived changes faster than 30 frames per second (33 Hz), a fact that is used by TV sets the world over. Under this frequency it is possible the on/off of the LED can be seen as a flicker, faster rates than that the average power is seen as a uniform light. The 555 can go much faster, of course, but this sets the minimum.

    One of the key features of PWM is that since it is fundamentally digital very little power is used when the light is low or off. There is also a second advantage, LEDs are not a linear device. The intensity of the LED does not vary proportionally to current, but it does vary proportionally using PWM. This makes it a preferred method for adjusting LED brightness.

    Figure 5.2 shows several ways to make a quick and easy 555 PWM controller. If you will compare this drawing to Figure 4.2 the resemblances will be obvious. The second drawing is almost the same as the Oscillator 2 in Figure 4.2, since this design has PWM inherent in its design.


    .................................................. ...............Figure 4.2

    There are many ways to generate PWM signals, and they have many uses, such as controlling motor speeds or Class D audio amps. LEDs are only one example of how PWM can be used.


    .................................................. .Figure 4.3

    This particular circuit, with minor modification, could be used for a Class D audio amp as well as modulate an LED brightness. It has the added ability to adjust the PWM frequency independently of the PWM percentage, which can be very useful. The LM339 comparator shown absolutely requires a pull up resistor as shown with R7, usually a 10KΩ resistor. Since the max current from a LM339 is 16ma, I've added a transistor driver to reduce its load, and R7 can be tweaked for maximum LED brightness.

    Posted 09-29-2009 at 01:29 PM by Bill_Marsden Bill_Marsden is offline
    Updated 10-10-2009 at 12:05 PM by Bill_Marsden
 
Total Trackbacks 0

Trackbacks

 

All times are GMT. The time now is 07:44 AM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Copyright © 2009, All About Circuits. All Rights Reserved.