What do you do, a few hours before you leave for a few weeks of camping ?
In this case, I was concerned I'd have to spend time in the dark of the 8-hours summer nights.
So I built a torch lamp.
Not your average torch lamp though:
* up to 20h on one charge
* automatic shutdown in case it's left on, still leaving some charge
* 2 push-buttons
* undervolted 3W Luxeon LED for wide-angle lighting
These days it's still working very well, despite some traces of oxydation.
I love my lampounette and here is how to make yours :-)
Note: the heatshrink tube trick is cheap but it might not be NF/CE/UL certifiable...
This was a time when I depended heavily on getting free samples from the manufacturers. So thank you Texas Instruments (TPS3809, REG104 in different packagings and voltage options), Analog Devices, Maxim/Dallas (MAX809), Microchip...
This system is a pretty neat hack and I intended to publish for some years... The time seems to be now :-)
First, let's just consider the REG104. This reference is now obsolete and replace by an improved version, by the way. It's still a great regulator with very low dropout and very low leakage (so it can be left connected to the battery without significan discharge). The very low drop is possible thanks to an internal N-FFET polarised by an internal charge pump. For portable LED lighting, this is great because the battery can still work well close to the LED voltage, in "dropout mode":
Vin / Vbatt between 4.2 and 3.3V : the REG104 is in "regulator mode", dissipating the difference as heat.
Vin / Vbatt at 3.3 and below : the REG104 is fully on, "dropout mode" with the least dissipation (even less dissipation because it's sized for large loads and I draw significantly less).
I could have used an adjustable version to set a specific working point for the LED but I kept the fixed version at 3.3V and experimentally set the series resistance to get a significant light output without much heat. I even soldered a small copper tab for heatsinking of the REG104 but the LED shouldn't get hot. The LED is a leftover from the project described in #Cheap linear LED temperature regulator
Now, consider that the usual pins (Vin, Vout, GND) are supplemented with the "Enable" pin, which is active high. Normally, it's tied to Vin.
If the EN pin is tied to Vout, it could "latch" the state to ON.
But then it is necessary to turn it on or off, so two push-buttons are required, with series resistors of suitable values to override the latch.
In order of priority:
Normally the pin shouldn't be left floating (to prevent spurious turn-ons) so a 1M resistor serves as pull-down.
Once ON, the output should go back to EN, through a 100K resistor, which is 10× stronger than the pull-down and override it.
To turn it ON, a push-button must override the pull-down and the feedback, with a 10× stronger current through a 10K resistor.
To turn is OFF, a push-button short-circuits everything, with no resistor, because the stronger current is about 0.4mA (worst case) through the above 10K. Adding a 1K would not change that much.
Well, I just described a kind of set-reset latch !
I want the battery to be totally disconnected when its voltage is below 2.93V. That's a standard voltage for reset controlling chips, such as MAX809, TPS3809 etc.: 3.3V-10%=2.93V.
If I connect the voltage monitor on the battery side, it will continuously draw some current, even if it is small. It is not desired because it will reduce the shelf storage time.
Ideally, the monitor is on the LED side so it is powered when the LED is on.
It should pull down the EN pin when the voltage drops below 2.93V, but instead of overriding the feedback path of the 100K resistor, the feedback goes through the monitor.
The type of monitor I use has a little delay so you have to push the ON button for 1/2s. It can be seen as a protection agains transients.