Celestial Programming : Horizontal Sundial

There are many types of sundials, the horizontal sundial is generally the type people think of when they hear the word "sundial". The main dial is level to the ground, and has a wedge or angled stick (called the gnomon) in roughly the center of the dial which casts a shadow for reading the time.

The angle the gnomon makes with the sundial plane is equal to the latitude. The base of the gnomon should start where all of the hour lines converge, and increase in height towards 12 noon. And 12 noon should face North if its in the Northern hemisphere, or South if it's in the Southern hemisphere.

Aligning the sundial can be quite simple. Many people try to use a compass or the North Star, or more complicated methods. I find the easiest method (which is also the most accurate), is to just look up the value of the Equation of Time for the day, and set the clock to the right time.

Computation of the angles for the hour lines is fairly simple, I give two methods below. They both produce the same results, but the first method allows the use of the ATAN2 function to ensure \(\theta\) is in the correct quadrant. The second method is just shorter.

Hour Lines

$$ \begin{align*} x &=\sin H \\ y &=\frac{\cos H}{\sin \phi} \\ \tan \theta &= \frac{x}{y} \\ \\ Alternate: \\ \tan \theta &= \tan H \sin \phi \end{align*} $$
\(\theta \) = Line's angle for given hour
\(H \) = Hour angle of the Sun
\(\phi \) = Latitude