I had a quick go at getting this to work a few years ago but gave up before anything viable.
Some thoughts, IIRC…
There’s an assumption that all chips are different, so the time would need calibrating. That’s probably correct but may need testing. Calibration could be done by manually starting and stopping the light after 60 seconds. If you’re 1 second out then that’s 1 minute every hour, or ~10 minutes over night, which is fine.
I was having trouble with the timer overflowing after a few minutes. May be down to data types or something - I’m far from an expert in C.
Power consumption may be high, if the MCU needs to stay awake. Might be possible to make it sleep but that’s way out of my capability. Even if not, a couple of mA is a sacrifice I’d be OK with.
The low ramp resolution at low levels is very noticeable. ToyKeeper seems to be improving this, so may not be a problem now. I have a sunrise lamp from Amazon and the ramp up is probably something like 0,5,10,15,…100 lm. Pretty sure we can do better!
I started to implement this using taps for hours and multiples of 10 minutes (well, minutes and 10 seconds when testing. Eg enter sunrise mode and it goes straight to config, tap 6 times, then 3 times for 6 hours 30 minute delay before sunrise starts.
Sunrise would use the last used brightness (maybe this is a bad idea).
Some other things I was considering if I ever got it working:
- having a config for sunrise speed. I think about 20 minutes is common. Could almost use a very quick speed and use the flashlight as a silent kitchen timer
- Alarm option. If you don’t stop the sunrise then after a while it flashes bright, similar to SOS.
I don’t think I have the laptop with the code on any more. Even if I did, it probably wouldn’t help anyone in the state it was in. I think I basically reversed sunset, added a delay and got it to start it a config mode.
If anyone takes this forward then I’d be very interested!