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.

  • Kairos@lemmy.today
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    1 年前

    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
    link
    fedilink
    arrow-up
    4
    ·
    1 年前

    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.

  • m-p{3}@lemmy.ca
    link
    fedilink
    arrow-up
    4
    ·
    1 年前

    In order to calculate an accurate sunrise and sunset time, you need the following variables to be known.

    • The current day
    • The current time (if you want to know the time delta for when it rises and sets)
    • The current location

    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.

  • NalosLayor@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    3
    ·
    1 年前

    I did this years ago for my % of daylight remaining clock with an arduino. It appears that I never published it. If you find yourself still stuck ping me and I can did you the code.