IanP said:Regardless of the configuration of the LED array, if you need 500mA use the LM317 in it's 'constant current' configuration .. see picture below ..
Resistor's value for 500mA is 2.5Ω (1W) ..
Max. input voltage is <40Vdc ..
It is just easier to rely on repeatable characteristic of this voltage regulator than on an individual properties of FETs ..
For comparison, here is similar (adjustable) MOSFET circuit:
It can be done with PICAXE-08 microcontroller (PIC12F683 with BASIC, 8-pin DIL) + one external transistor ..
Here is 4-20mA circuit:
For 500mA, all what have to be done is to replace current sensing resistor with, say, 0.1Ω, use more powerfull BJT, BD135, for example, and slightly modify software (shouldn't take more than 5mins) ..