The brain of this project is the XL4001 IC which minimizes external components and provide excellent voltage regulation and current protection. Input voltage range is from 4.5V to 40V and output current up to 2A. Switching frequency is around 150khz+-25Khz for regulation.
The schematic follows the basic application circuit from data sheet, with minor changes to allow an adjustable output voltage.
The current protection is defined by value of RS as follow
On the board shown, used a 0.3ohm resistor to set Iout max at about 500mA.
As seen, the schematic calls for a 4pin header connector while the board shown has only 3 pins. Since the ground for the load must be isolated from common ground of input power (isolated by RS), two pins input and 2 pins output are required. The shown board will need a layout correction.
Anyways, tested with 20Vdc input, output adjustable from 3.3v to 18.5V. However, the max output voltage should not exceed input-3V(input-1.5v as per datasheet).
I also used this same IC for a constant current LED driver with very good results, to be posted in the future.