Thu Dec 16 00:44:50 EST 2010
LED lamp controller
Got a cheap LED lamp. However, this doesn't seem to work too well
from 1.2V rechargables as the voltage drops fast. The LEDs are at
3.5V and the regulator is a 1Ohm resistor.
A nice excuse to build a circuit. For a buck-boost converter the
LED can be used directly as the switching diode. The only problem is
how to measure the current. I don't have low-ohm resistors in stock.
It might also be possible to let the LED go out such that voltage
feedback can be used. If switched fast enough we won't notice.
Depending on the known value of the inductor we can use pulse width
timing to charge it up to a certain max current, then let it discharge
fully in the LED. When the current goes to zero, the voltage suddenly
drops which can initiate a new charge cycle.
Problem with buck-boost in  is the negative voltage. I.e. using a
simple PNP switch, the emittor will be pulled down by the inductor
whenever the current is switched off, so the base needs to be tied to
the emittor through a resistor. Then switching the base from
Vcc/High-Z should work. Problem is that the High-Z voltage on the PIC
pin will be the negative inductor voltage, so the protection diode
kicks in turning the transistor on again.. Not so simple!
Solution might be to add an extra diode, though then the problem is to
make it conduct in the first place.
Need to read more.. Found this. A different topology though.
Starting from such a topology and doodling a bit it seems it's quite
simple if the LED can go out during the inductor charge cycle. I
arrived at two conclusions:
- The buck-boost in  needs a PNP transistor switch. (duh!) That
way the coil end is at a the collector, and it can go negative
without any problems.
- Starting from that PNP schematic, it can be inverted by changing
battery polarity and using a NPN switch.
For 2.2 mH (what I ordered) and a 5V supply it will take 130us to
charge the inductor to 300mA. Discharging it through 3.6V will take
about 180us. It seems that this really doesn't need a closed loop
controller as long as the inductor is fully discharged during the
transistor off time.
Measuring the voltage across the LED is going to cost two resistors.
Then it seems simpler to just use one low-ohm resistor on the
transistor emitter to measure the inductor current directly.