WHY
I wanted to make this because my son is probably going to shine whatever torch he can find in his eyes and my understanding is that shorter wavelengths in the blue and UV region can damage your eyes if too much enters your eye. As I understand it, most white LEDs rely on a blue LED stimulating phospor which adds in the red/green or yellow frequencies to make us think the light is white. Secondly, blue light isn't going to help him get to sleep if he uses his torch under the duvet to read - not enough melatonin. Added to this is a desire to keep the occasional flash in my eyes at night from ruining any night vision I may have, so I've decided to explore longer wavelengths. In the UK, most streetlights have been sodium lamps (until white LEDs started to replace them) so orange-yellow is a familiar tone and we'll start with that. We can move on to green and perhaps the cyan LEDs used in TritiLED but I think yellow would be a nicer colour if we can only have one wavelength. The thought of combined wavelengths sounds attractive but I'm not keen on the complexity that various LED forward voltages and optimum efficiency currents would introduce.
CONTROL
We'll use a time limit to prevent the supercapacitors being run down if the user doesn't keep the device on. An ATtiny402 is used in V1.3 for it's lovely peripherals and the events system that knits them together.
DRIVING LEDS
I've got a bit better at this since the Beta version, which was a Christmas present to my son two years ago. The logs hold the details of my journey in efficient LED driving.
"BATTERY" LIFE & CHARGING
We're using supercapacitors in V1.3. None of this lithium nonsense. Who can be bothered to wait more than the time it takes to brush your teeth for your torch to charge? Just stick Yapolamp in your nearest USB power pack for blinky goodness in a couple of minutes.
Everything after this point refers to the original project ideas, since superceded in V1.3. Kept here for reference.
CONTROL
So, I want to drive an LED or two from a battery and have a timer to turn it off after a certain period. This will hopefully prevent battery drain if my son forgets to turn the thing to SLEEP mode (as there's not going to be a planned "off" mode). I'm aware that different modes could be achieved with a discreet component circuit but for me, a bare microcontroller with decent low power sleep and watchdog modes is what I'm after. Depending on the eventual feature set, I think an ATtiny85 should suffice and is available in a hand-solderable SMD package.
DRIVING LEDS
Driving LEDs is something I've tried before but not seriously moved beyond resistors to control the current. I've been amazed at how small a current can generate a visible light output but when I discovered @Ted Yapo's #TritiLED project, the care that has gone into eeking out the best photon per coulomb ratio is admirable. If I get stuck using the simple driver design from the V2 TritiLED, I'll go back to current-limiting resistors.
BATTERY LIFE
LED driving efficiency isn't really essential here - I do plan to use a decent 18650 with perhaps 3400mAh and compared to the ON mode, the energy lost in the resistors while minimal (microAmps) current is flowing is negligible. Most of the energy conservation will come from the auto-SLEEP feature that I currently envisage will start a timer when the torch is switched to ON and will modulate the light output after, say, 10 minutes. This alerts the user who then has two minutes to press the control button and reset the ON timer.
CHARGING
Using lithium rechargeable batteries in a "home-made" children's project presents some health risk. I'm going to have to work this one out and if I have to resort to alkaline or NiMH AA batteries in series, then that's an acceptable fall-back. I'd like to crack the (admittedly self-defined) problem of using a TP4056 but requiring a method of assurance that the charger and battery are connected to each other. I.e. I want to make sure someone hasn't...
Read more »
Hi Simon, I just wanted you to be aware that there's a serious failure mode associated with the basic design of the MOSFET/inductor boost circuit. If the MOSFET is held on, the inductor is basically shorted across the battery. This could cause very serious damage to the circuit and surroundings, especially with a high-power battery such as you are using. The MOSFET could get stuck in a conducting state through a number of failure modes, including software errors, software corruption (cosmic rays happen), or if the gate is left floating due to tri-stated uC outputs (even during reset). I discuss one solution to this in a TritiLED log:
https://hackaday.io/project/11864-tritiled/log/62286-safer-tritileds-one-simple-trick-prevents-catastrophic-failure
but this may not work if you also want a high-power mode. Just a heads-up, because I didn't see this at first, and it definitely should be addressed.