I'm specifically looking for small microcontroller implementations for a simple clock project. I want to use a good temperature compensated real time clock and/or network time protocol-only (no sunrise/sunset APIs), to calculate local solar noon, sun rise, and sunset times. Then I want to make my own local time where midnight/bedtime is simply 9 hours before sunrise on any given day. I am in special life circumstances where I have no real use for daily coordinated time. This is a little psychology experiment more than anything else. I'm super rusty on the math.

7 Comments
LodeMike@lemmy.today · 6 pts · 297d
There's algorithms that can get sun and moon (and really any celestial body's) relative position to some place on earth. They don't need internet connections. They just need historical data, a location, and a time. The latter of the two can be gotten from GPS. Something that can process a few thousand floats per second should be enough processing power.
credo@lemmy.world · 4 pts · 298d
Honestly it sounds like home assistant could be useful to you, if you have the time to tinker. Definitely can build rules based on sunset times.
mp3@lemmy.ca · 4 pts · 298d
In order to calculate an accurate sunrise and sunset time, you need the following variables to be known.
Also, we need to consider that NTP sends the time in UTC, and the timezone offset calculation is done by the endpoint.
Even if you know the timezone your in, it still doesn't provide the exact position you need to accurately determine when the sun will rise and set.
ch00f@lemmy.world · 4 pts · 298d
Sensorwatch has a sunset/sunrise face https://github.com/joeycastillo/second-movement/blob/main/lib/sunriset/sunriset.c
If you dig into it, see if you can fix this issue that I created months ago: https://github.com/issues/created?issue=joeycastillo%7Csecond-movement%7C55
Edit: actually, if you're doing this as a psych experiment, just buy a sensor watch and make a custom face for it. It'd be a great way to publish your findings.
NalosLayor@lemmy.blahaj.zone · 3 pts · 298d
Blip6338@lemmy.ca · 3 pts · 298d
If you start living by your own time you should take a look at decimal time too.
nodoze313@lemmy.world · 3 pts · 298d
https://github.com/dmkishi/Dusk2Dawn
j4k3@lemmy.world · 2 pts · 297d
Thanks! This repo's readme leads to gml.noaa.gov/grad/solcalc/calcdetails.html. This then references Astronomical Algorithms by Jean Meeus. That is available from the above linked archive.org page.
This is much closer to the real reason I was asking, as this little clock is intended as a primer for understanding object tracking for both astronomical observations and local rocket launches or transits.