The npn Transistor is used to control the current flow through the LED. The resistor Rs can be chosen using the formula below:
ILED = 0.7 V / Rs
Note that this type of current limiter is far from perfect. You actually have to expect base voltages of 0.5...0.9 V, and they will vary greatly with temperature and depend on the exact type of transistor used. Consider this as a mere starting point for digging deeper into the subject of transistor current sources...
For more detail you can refer the below link http://www.physics.unlv.edu/~bill/PHYS483/current_lim.pdf