Home      Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science

19 December 2010
Author: Giorgos Lazaridis

Some time ago, i made an LED fade out dimmer for my Men Of War game console. The circuit was ridiculously easy, using only one transistor and a couple more passive components. Now, i tried to make a similar circuit, but with a Fade-In Fade-Out cycle (the previous had only fade-out). So, here are some very interesting observations that i made while i was designing the circuit.

A very simple Circuit with a slight flaw

Here is the first circuit schematic that i designed, and i tried to keep it as simple as possible:

Similar to the LED fade out dimmer, multiple LEDs can be connected in parallel with one resister per node. Again, you need to take into account the maximum ratings of the transistor before connecting a million LEDs.

The circuit on a breadboard for test

The operation is as follows. When the pushbutton is pressed, the capacitor starts to charge through R1. For now, we will not take into account R2, which is at least 7 times larger than R1. While the voltage across the capacitor raises, the same happens to the base of the transistor as well. Gradually, the voltage across the LEDs is raised. When this value reaches the lower LED forward voltage, the LEDs will turn on very dim. But the capacitor's voltage still increases, and the same happens to the voltage across the LEDs, and so the fade in slowly.

The opposite will happen when he button is released. The capacitor will now start to discharge through the parallel resistor R2. The LEDs will fade out slowly, until they are completely turned off.

This circuit is ideal for applications that simplicity is needed. Yet there are some things that you need to take into consideration. First of all, the R1 and R2 resistors perform a voltage divider. If you try to reduce the fade-in time by increasing the R1 value, this will have a negative impact on the total voltage that can be delivered to the capacitor. A reduced capacitor voltage means reduced base voltage on the transistor, and in turn this means reduced LED voltage. Same will happen if you try to reduce the discharge time by reducing R2.

What this means, is that you can only make small changes to one of the R1-R2 resistors at a time. It is wise to keep R2 at lest 7 times larger than R1. You can experiment with the fade-in-out times also by increasing or decreasing the capacitor's value. In general, this circuit is not very easy to change the times.

But the major disadvantage of this, is the turn-on time. If the capacitor is completely discharged and you give power to the circuit, it will take some time before the LEDs start to fade in. This time depends on the C1 and R1 values. Greater RC, means more time. The values that i have chosen makes a delay of approximately 3 seconds. Which means that, if i power the circuit, the LEDs will start to fade in after 3 seconds. Why is that? It has to do with the LED minimum forward voltage. They will not light until this voltage is reached. If this is not a problem to you, then this is the proper circuit for your application.

Like many other circuits, it can operate in different voltages, but you will have to experiment yourself to find the proper R1 R2 and C values.

Bill Of Materials
 Resistors R1 Resistor 4.7 KOhm 1/4 Watt 5% Carbon Film R2 Resistor 33 KOhm 1/4 Watt 5% Carbon Film R3 Resistor 47 Ohm 1/4 Watt 5% Carbon Film Capacitors C1 Electrolytic Capacitor 470 uF 25 Volts Transistors Q1 BC548 Switching and Applications NPN Epitaxial Transistor Semiconductors LED1-3 LED 3mm white high brightness

To solve the problems - Circuit #2

To solve the above "problems", i introduced a PNP discharging transistor to the circuit and a potentiometer to provide a constant base stand-by voltage to the first transistor:

This circuit is a little bit more complicated. Lets see how it works. And first of all, what this R2 potentiometer does. This small potentiometer is connected as a voltage divider, the output of which is driven (through a diode) to the base of the transistor. By adjusting this potentiometer, you actually change the bias of the transistor, or should i say the stand-by voltage of the base (and of course the capacitor that is connected). The fact that the potentiometer is small (500+100 (R1) max resistance) means that the RC time constant is very small. The maximum time that the capacitor will take to be charged at the stand-by voltage, is theoretically R x C = 600 x 470 x 10-6 = 0.282 seconds = 282 mSec, a quoter of a second. The usual value of the potentiometer will be somewhere in the middle, so the usual RC time constant will be about 165 mSec. So, when you power the circuit, the capacitor will be charged to this voltage within a sixth of a second.

The second circuit on a breadboard for test

Now suppose that you press the button. The 12 volts will be delivered to the capacitor through R3-D2, and it will keep on charging with a new time constant, that is R3 x C. But if you notice now, there is no discharging resistor, at least not as long as the button is pressed. Actually, the discharging resistor is the R4, but as long as a positive voltage is supplied to the PNP Q2 transistor, this resistor takes absolutely no part in the circuit. So, the charging of the capacitor (and the LED fade-in) depends only on the capacitor and R3.

Now, suppose that you release the button. The Q2 gets no more positive voltage on its base and is pulled down through the R5. R4 now acts as discharging resistor. The capacitor will be discharged through R4 and Q2. So, the discharging cycle depend only on the capacitor (of course) and R4.

What have we achieved so far:

First of all, the charging and discharging times are independent. You can adjust different fade-in and fade-out time by simply changing the R3 or R4 value. One limitation: Try to keep R3 as low as possible, maximum 1.8K. This way you will ensure that enough current will flow through the LEDs. If you need to further increase the fade-in time, you can increase the capacitor as well. So, the setup of the circuit is a piece of cake.

Most important though is what the potentiometer does. Suppose that the capacitor is fully discharged and you give power to the circuit (the pushbutton is already closed). The fade-in cycle of the LEDs, REGARDLESS the R3-C time constant, will start within less than 125 mSec, because the capacitor will be charged through the potentiometer up to the stand-by voltage! No more delay.

To adjust the potentiometer, you power the circuit WITH the pushbutton OPEN. Then, you adjust the potentiometer so that the LEDs are barely off. That is the idea. This is the stand-by voltage. You can of course do something more artistic: You can adjust the potentiometer so that the LEDs are very dim but NOT off. So, when you power the circuit, the LEDs will be very dim, when you press the button the LED will fade in to maximum brightness, and when you release it they will fade out to the dimmed level they were.

Bill Of Materials
 Resistors R1 Resistor 100 Ohm 1/4 Watt 5% Carbon Film R2 Potentiometer 500 Ohm Linear Rotary 1/2W R3 Resistor 1.5 KOhm 1/4 Watt 5% Carbon Film R4 Resistor 4.7 KOhm 1/4 Watt 5% Carbon Film R5 Resistor 220 KOhm 1/4 Watt 5% Carbon Film R6 Resistor 330 Ohm 1/4 Watt 5% Carbon Film R7 Resistor 47 Ohm 1/4 Watt 5% Carbon Film Capacitors C1 Electrolytic Capacitor 1000 uF 25 Volts Transistors Q1 BC548 Switching and Applications NPN Epitaxial Transistor Q2 BC327 Switching and Amplifier Applications PNP Epitaxial Silicon Transistor Semiconductors D1-2 1N4148 Switching Diode LED1-3 LED 3mm white high brightness

Need more current?

A power transistor driving 36 high brightness LEDs

If you intend to power many LEDs, then you will notice that this BC548 transistor is just not powerful enough to deliver the current you need. So you need to add another amplifying stage with a power transistor. For example, you can use the BD243 like i did. Here is a schematic how to connect this transistor. This schematic can be applied to both circuits shown above, directly at the emitter of the BC548:

Q1 is the BC548 transistor from the previous circuits. T1 is the BD243 power transistor. The above schematic has 15 LEDs (5 lines of 3 LEDs each), but you can add more lines. The limiting resistors i used are 10 Ohms, but this has to do only with the type of LEDs you will use! This resistor may be completely improper for use with other LEDs. Either calculate the resistor you need if you are sure about the specifications of the LEDs, or use different resistors and measure the current drown from each LED line (which should NOT be more than the nominal current of one LED - usually 25 to 30 mA).