Constant Current Source for LED
This article will explain the way a simple transistor based current source is designed, this will give an idea on how some components can be used in a practical way to make the circuit do some function, the objective is not design but to become familiar with the basic ideas.
In the circuit the LED is used as a reference so to keep it cool a 2.2K is chosen. (20V – 1.6V) / 2.2K = 8.3mA on the high side and when voltage is 10V the current will be 3.8mA min.
You should know that the LED forward drop can change with ambient light as it is photo sensitive and will vary with temperature.
The circuit can be improved by using a zener in place of the LED or better still a temperature compensated reference like LM336.
Operating Current of LM336 is 400uA to 10mA, 20V The max. voltage 20V / 3.3K = 6mA. so within limits. Then you can compute the rest, wire it up to see if your design works.