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.
- 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.