Quoting Peter Todd : > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Wed, Nov 14, 2007 at 10:17:06PM -0500, Spehro Pefhany wrote: >> >Any suggestions for the boost regulator? I've never designed a switch >> >mode regulator circuit before, something simple would be good. >> > >> >If you got any better ideas, do tell! >> >> A really simple current regulator suitable for this purpose would be a >> BJT with base connected to 5V and a fixed emitter resistor. Eg. for >> 15mA, use about 300 ohms. You can switch the base between 5V and 0V >> for the PWM. It will have a slight positive temperature coefficient, >> (dI/dT ~= 0.04%/K) which may or may not compensate for LED brightness >> variations with temperature, but small percentage changes in current are >> generally not very visible. The power dissipated in the resistor is >> 4.3 * Iled; the power dissipated in the transistor is Iled* >> (Vsupply - Vled - 4.3V). > > So essentially the base is set at a fixed voltage, I built it with 3.3V > actually, but anyway if current is zero, there is no voltage drop on the > resistor and the transistor is fully on, with 33ma flowing through the > transistor. > > As the voltage current increases the voltage drop accross the resistor > increases, thereby lowering the effective voltage seen on the base > relative to the emitter. Once the voltage drop gets to 2.6V, the > transistor starts turning off, maintaining a level equilibrium as the > voltage continues to rise. > > V+ > | > LED > | > C > 3.3V---B< > E > | > R > | > GND > > 'Cause I built one, and it seems to do all sorts of weird and wonderfull > things only somewhat related to current limiting... Not sure if I'm > understanding it correctly. It forms a current sink, but the voltage at the collector has to be more than the base (approximately, it can be a bit less in fact, more like 2.6V as you observed since Vce saturates at some tens of mV) for it to work properly. If the condition you are mentioning can exist you might want to add a base resistor of Re * 10 or so to keep the current out of the PIC within reason. The main difference between using Vbe and the above type of circuit is that the unit-to-unit variation and temperature change in Vbe doesn't impact the above type of circuit nearly as much, since the 0.6-0.7V is swamped by the 3.3V voltage, so it's 5x better in performance. The downside is that you waste a bit of power and drop a bit of voltage in the resistor. If you want the best of both worlds you have to put more circuitry in there, such as an op-amp to use a very low value resistor (eg. 100mV drop), but then you might have to worry about response times with the PWM. The transistor won't have any problems with the PWM frequency and the circuit is very simple. Short-circuit proof too, like any constant-current circuit. Say, didn't someone around here mention something about a beer sometime, Peter? Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" s...@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist