An LED is usually a series resistor needed to ensure that the LED does not get too much power. The disadvantage of such a resistor is that the current thus also changes by the LED and the brightness as the voltage changes.
This circuit prevents that, by independent of the voltage, a constant current through the LED.The circuit uses two transistors and two resistors. The circuit can be connected to voltages of from 5 to 24 V.
Constant LED Power Supply Circuit Diagram