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.
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 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.
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.
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 placed a short circuit across the charging terminals before applying power. I think this is most likely to be implemented on the 5V side of the TP4056 because the device can work between 4-8V, although I can't tell what the dropout voltage is and therefore the minimum input which would still allow a 4.25V max cell charge. This could use a voltage divider or a serial connection over one or two wires, which would be helped by the TP4056's common ground pins for battery and supply sides.
Using the ADC to determine rough state of charge in the battery. It could use this to alert the user to charge it as well as perhaps adjusting the driver circuit pulses to maintain brightness.