Arduino-based Constant Current PSU

So, here goes. I've been stubbornly googling on and off for a while and haven't found exactly what I'm looking for.

I'd like to build an Arduino-controlled constant current PSU. I need to be able to call a function within the code, such as "setCurrent(0.8);" and set the supplied current to 800mA. Simple enough, right? ><

The original way I was planning on doing this was to use a voltage regulator (LM317 comes to mind) and use a bunch of digital potentiometers wired in series-parallel (on the reference pins of the regulator) to give me the desired current setting. However, to get the current set as accurately as I want, I'll need to use something like 36 (20 - 10 - 5 - 1) pots. This is both expensive and complicated.

The maddening thing is, I have a power supply right here that is controllable via serial ("i 0.8\n"). Unfortunately, not only is it a black box - it also can't supply voltage high enough for my purposes. I believe it can supply 3V out at a maximum (I haven't looked at the specs in a while), when I need 5-6V (hence looking to a regulator like the LM317). I took it apart to see if I could glean anything, and ended up having no luck at all. I do have a list of chip part numbers, if anyone cares or thinks it might help. :slight_smile:

I have the code already hammered out for controlling all of those pots, but if there's a simpler solution I'd welcome any wisdom I can get. 36 digital pots feels like giving up and using duct tape.

Code I can do. Electronics... not so much. :~

Here is a basic circuit for a constant-current battery charger:

http://ruggedcircuits.com/html/circuit__8.html

The idea is you have the Arduino measure the current on the fly and adjust the output voltage as necessary. Not exactly the same as a constant-current PSU but might be good enough.

For a constant current driver circuit, consider perhaps LED driver chips. They are basically designed to be constant current drivers, and some are even adjustable on the fly for the brightness (i.e., current) level.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons