Analogue alternating linear LED fader using 2 different approaches
LEDs and closed loop brightness control ? Or using 'ancient' techniques such as current squaring current mirrors ? Let's go analogue for a change ....
Most of the circuits to fade a LED in or out, are digital circuits using a PWM output of a microcontroller. The brightness of the LED is controlled by changing the duty cycle of the PWM signal. Soon you discover that when linearly changing the dutycycle, the LED brighness does not change linear. The brigtness will follow a logarithmic curve, meaning that the intensity changes fast when increasing the dutycycle from 0 to lets say 70% and changes very slow when increasing the dutycycle from lets say 70% to 100%.
The exact same effect is also visible when using a constant current source and increasing the current linear f.e. by charging a capacitor with a constant current.
How come ? Well, LEDs are non-linear devices, just like other diodes and show an exponential relation between forward voltage and forward current when increasing the voltage above the forward voltage drop of the junction.
In Fig2 you can see that the brightness perception of a LED has a logarithmic curve due to the exponential voltage to current relation. When the LED just starts "conducting" the intensity increases fast with increasing current. But once "conducting", the intensity increases slow with increasing current.
To compensate for this effect, we can choose between an open loop approach or a closed loop approach :
Schematics :
The exact same effect is also visible when using a constant current source and increasing the current linear f.e. by charging a capacitor with a constant current.
How come ? Well, LEDs are non-linear devices, just like other diodes and show an exponential relation between forward voltage and forward current when increasing the voltage above the forward voltage drop of the junction.
- See Fig1 for the voltage/current relationship.
- See Fig2 for the brightness perception.
- See Fig3 for the brightness curves resulting from a linear or an exponential (kind of quadratic) changing current.
In Fig2 you can see that the brightness perception of a LED has a logarithmic curve due to the exponential voltage to current relation. When the LED just starts "conducting" the intensity increases fast with increasing current. But once "conducting", the intensity increases slow with increasing current.
To compensate for this effect, we can choose between an open loop approach or a closed loop approach :
- The closed loop approach uses an LDR to measure the LED light intensity. This signal is converted into a current using a current mirror. A linear triangular waveform is used as the source for the fader and is also converted to a current using a current mirror. The measured light current is subtracted from the triangular waveform current. The LED is fed with the resulting current, so the brightness is as linear as the linearity of the LDR.
- In the open loop approach, we need to add a quadratic or exponential growing current so the logarithmic intensity curve is flattened out. This can be done with an anti-log or exponential amplifier using an OPAMP, but i found a simpler circuit that is based on a current mirror and generates a quadratic function using 2 diodes in reference "leg" of the current mirror.
Schematics :
- Schematic1 : approach using LDR to linearise the LED brightness by feeding back the brightness that is converted to a voltage by an LDR. This requires an extra LED to be put in series with the LED that we want to control.
- Schematic2 : approach using a current squaring circuit to linearise the LED brightness by compensating the logaritmic brightness curve with a quadratic function.
- Schematic3 : Combining the 2 approaches leads to a linear alternating LED fader.
Mises à jour de l'auteur