On the Internet you can find plenty of dirty cheap DC-DC buck converter modules like the following:
which is based on an LM2596-ADJ SMPS IC and follows the schematic in the application notes of the manufacturer:
On the other hand, switching constant current LED driver modules are quite more expensive, on average.
Therefore I thought that would be nice, from an hobbyists' POV, hacking that module to convert it into a constant current switch-mode LED driver. Although I don't expect it to be an optimized design, if it works it should deliver much better efficiency and flexibility than a CC linear driver.
The hack I'd like to do came to my mind looking at the internal schematic of that chip; here is the fixed voltage version, which embeds R1 and R2. On the real module R1 and R2 are external, implemented as a trimpot (Note: the image below was excerpted from the 2013 version of the datasheet, which is no longer available on TI site):
That R1-R2 voltage divider samples a portion of the regulated output and feeds it back to the FB (feedback) pin of the IC, which is internally connected to a classic error amplifier, which compares it to a 1.235V reference. So, at least in theory, I thought, if I sampled the current in the load with a low-side resistor and fed that voltage drop into the FB pin, with a suitable choice of the sampling resistor, maybe the circuit would work as a CC driver. For example, with a 10ohm resistor, I could get a 123.5mA output current.
Is my reasoning correct? Would that design work? Could there be problems such as possible oscillations due to the modification of the feedback path topology? Any comment or advice is welcome!
Note: I'd like the hack to be simple and cheap. Adding more active circuitry, like additional opamps, would defeat my initial goal. Anyway, I still value meaningful design advice, even if it doesn't fit my bill.