On Apr 7, 2005 12:16 PM, Peter Johansson wrote: > > I've been pondering adjustable current sources to control LED > brightness over the past few days and my lack of experience with > dynamic analog circuits leaves me with a number of questions. > > The simplest case I can think of (likely too simple) is to put a > capacitor in parallel with the LED/resistor of a typical PWM drive. A > resistor of much smaller value would be used, largely as a shunt to > feed the voltage drop back through an A->D input. The duty cycle of > the PWM output is adjusted to match the desired voltage drop over the > resistor, which can be calculated to the desired current. > With regards to this, Ive seen circuits for this using a comparator, a switching FET, and the shut resistor. The reference voltage goes to the positive feedback on the comparator, the resistor goes between the LED and ground, and the lead of the resistor going to the LED is connected to the negative feedback of the comparator. I would think that this would be a lot simpler to setup than using the PIC. But for adjustability, you could use and DAC to control the reference voltage. Plus that would leave the PIC free to do other things. I have seen this kind of setup used a lot for "chopping" stepper motors. They use this to keep the average coil current the same, but lets them use a higher voltage, which reduces the effects of inductance on the coil. Jonathan -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist