BJT LED Current Source
This is a very common LED current source. The LED current is set by R2. The formula is usually 0.7/R2. In this case the current is set to 20mA. 0.7 is the gate voltage of Q2. Q1 turns on the resistor and as the current goes higher it creates a voltage on R2. When that voltage hits the base to emitter voltage on Q2 Q2 turns on and robs Q1 of current to stay on past that current.