Git Product home page Git Product logo

Comments (6)

marcelstoer avatar marcelstoer commented on June 11, 2024

Which demo sketch are you using?

from esp8266-weather-station.

ZioJames avatar ZioJames commented on June 11, 2024

Hi Marcel, thanks for your reply. Demo? What do you mean?

from esp8266-weather-station.

marcelstoer avatar marcelstoer commented on June 11, 2024

I'm simply wondering what your sketch is and whether you use the simple Astronomy class or the more elaborate SunMoonCalc class. There are examples for both: https://github.com/ThingPulse/esp8266-weather-station/blob/master/examples/AstronomyDemo/AstronomyDemo.ino, https://github.com/ThingPulse/esp8266-weather-station/blob/master/examples/SunMoonCalcDemo/SunMoonCalcDemo.ino

from esp8266-weather-station.

ZioJames avatar ZioJames commented on June 11, 2024

Okay, it's clear now. My sketch is based on Astronomy class. Just a copy & paste of the demo code:

Astronomy *astronomy = new Astronomy();
moonData = astronomy->calculateMoonData(now);
moonData.phase = astronomy->calculateMoonPhase(now);
delete astronomy;
astronomy = nullptr;

Then moonData.illumination and moonData.phase are used to estimate the moon age:

float lunarMonth = 29.53;
gfx.drawString(235, 276, String(moonData.phase <= 4 ? lunarMonth * moonData.illumination / 2.0 : lunarMonth - moonData.illumination * lunarMonth / 2.0, 1) + "d");

The divergence seems to be more accentuated at the very beginning of lunar cycle (New Moon). Today October 18th, at almost half cycle, code returns Waxing Gibbous moon, with 97% illumination and 14,4 days age, which is pretty much exact. "Real" values are very close: 96% and 12,76 days age.

A better approximation (i.e. 29.53059...) of lunar month duration should not have any effect... right?
Many thanks in advance for your suggestions.

from esp8266-weather-station.

marcelstoer avatar marcelstoer commented on June 11, 2024

Maybe try the SunMoonCalc class instead as it's more elaborate. However, as disclosed in that class and in https://github.com/ThingPulse/esp8266-weather-station/blob/master/src/Astronomy.cpp all of those algorithms are not ours. We only ported existing code to Arduino/ESP8266. However, I just realized some links to the original sources are now void. Maybe we should replace them with Archive links like these https://web.archive.org/web/20210429120530/https://www.voidware.com/moon_phase.htm.

A better approximation (i.e. 29.53059...) of lunar month duration should not have any effect... right?

I don't think that's what you really meant šŸ˜œ It should have an effect - more accurate results - otherwise improving it would be pointless, no?

Feel free to propose changes if you can confirm that they yield more accurate results, thanks.

from esp8266-weather-station.

stale avatar stale commented on June 11, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from esp8266-weather-station.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.