This sunrise clock calculates the position of the sun at a given time for a specified (static) day of the year.
From this position the colour of the sky is calculated using Perez method to give CIE Yxy values. These are converted to CIE XYZ values and thence to RGB using the CIE methodology.
The unitary RGB values are then constrained to the colour gamut and normalised. Finally the values are scaled to output luminosity for a 1.8 gamma based on a cosine function running from -6deg (civic twighlight) to max angle (midday).
The values are calculated for three azimuths, with two panels facing the sun (yellow / orange from turbidity filtering) and one panel being the opposite horizon (blues from Raleigh scattering)
This is my first project using AVR C++ rather than Arduino coding so likely many areas that could be improved. Where possible i've brocken out to libraries for the various functions, which should help re-use in other projects. Working initial code is hosted on github, see links
After looking for various options for encasing the circuit I found an old sun-in-a-jar that had expired which will fit the LCD and encoder in. But looking at a more versatile solution I've re-designed to use a 0.9" OLED screen so the whole control board fits in the neck of a standard USA Ball / Mason jar, with an acrylic disc in place of the lid plate.
To get the matte diffusion appearance, the plan is to spray the inside with frosted glass spray, and to place the LED board inside a sandpapered plastic tube.