Moon phase calculator with OLED display

moon phase calcuator

This project forms part of the larger Joystick Weather Clock here.

Code can be downloaded from my GitHub page here.

This small project displays the moon phase on an OLED display. Eight phases are shown, with a short description, the days remaining to the next full moon is also displayed. This project uses a real time clock, DS1307, to provide the date and this date is converted into a Julian date. By choosing a date that had a  known full moon, in this case 1st January 1972, the number of days from this starting point until now is easily calculated.

The moon takes 29.53 days to complete the cycle from one full moon to the next, so if we divide the number of days since 1st January 1972 by 29.53 the remainder will be the number of days in this lunar month so far.

The sketch divides the lunar month into eight parts, starting with a full moon then waning gibbous, last quarter, crescent old, new moon, crescent new, first quarter , waxing gibbous and back to a full moon. The number of days to the next full month is also shown.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: