Constant current circuit
In the world of electric engineering, everybody knows that when the voltage is raised, the current flow increases proportionally. This is what they call Ohm's law. But transistors make it possible for us to build a circuit that can maintain a constant current flow even if the voltage is increased or decreased.
In this project, we're going to make this constant current circuit using two transistors. The schematic shows you that the current flowing through the LED can be controlled with Q1, and when the voltage becomes higher and the current tends to increase, Q2 detects it and holds down the increases of the Q1 current.
Now, let's see how this circuit works. Change the select switch setting and see if the LED brightness shows any difference between 4.5 V and 9.0 V. It doesn't show any difference.
Of course you know why! Yes, it's because a constant current is supplied to the LED.