DEV Community

Shilpi Shaw
Shilpi Shaw

Posted on

Noon Stick: find your latitude with a stick, a shadow and a browser

Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass Submission 🌿

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass

What I Built

Noon Stick sends you outside with a stick and a tape measure to find out where on the planet you are standing.

Plant a straight stick in flat ground near solar noon and measure its shadow every few minutes. The shortest shadow is the moment the sun is highest. Its length compared with the stick's height gives the sun's angle, and with the date that gives your latitude, usually within about a degree.

The web app tells you what clock time solar noon will be where you are, takes your measurements, and shows your latitude, how far off you are from the true value, and a to-scale drawing of your stick and shadow. If you also run Gemma locally, it can check a photo of your setup and translate the advice into your own language.

It is for anyone who wants a ten-minute reason to stand in the sun and measure something with their own hands. Nothing needs to be open while you measure: you write numbers on paper, then type them in afterwards.

Demo

Live app, runs entirely in your browser: https://suzzy05.github.io/noon-stick/

Try it without going outside: date 9 Oct 2026, longitude 77.2, time zone 5.5, true latitude 28.61, stick 100, shadows 71.8 70.9 70.2 70.6 71.5, pointing north. It answers 28.78° N, 0.17° off (about 18 km), and calls that good.

Code

GitHub logo suzzy05 / noon-stick

Find your latitude with a stick and the sun. Browser app + optional local Gemma.

Noon Stick

Find your latitude with a stick and the sun. Plant a straight stick near solar noon, measure its shadow every few minutes, and the shortest shadow plus the date gives you how far north or south of the equator you are usually within about a degree.

Made for the Hacktoberfest Open-Source AI Challenge, Week 1: Touch Grass.

Live app: https://suzzy05.github.io/noon-stick/

How it works

At solar noon the sun is at its highest. The stick's height and shadow length give the sun's angle from overhead (atan(shadow / height)). The date gives the sun's declination, the latitude where it is directly overhead that day, computed from the standard low-precision solar position formulas (about 0.01 degree) Your latitude is the declination plus that angle if your shadow points north, or minus it if it points south. The app also works out the clock time of solar noon from your…

The web app is index.html plus noonstick.js (no framework, no build step, no dependencies). The same maths also runs as a terminal tool, shadow.py, and both are checked by the same test cases.

How I Built It

The maths is plain trigonometry written in code. Three pieces:

  • The sun's declination for the date and your longitude, which is the latitude where it is directly overhead that day.
  • The equation of time, so the page can turn your longitude and time zone into a clock time for solar noon.
  • Your latitude: the declination plus atan(shadow / height) if your shadow points north, or minus it if it points south.

Gemma runs locally through Ollama, for two optional jobs. It reads a photo of your setup and flags a leaning stick, a blurry shadow edge or sloping ground, and it translates the advice into another language. The page calls your own localhost, so nothing is sent to a server.

What I learned is what not to give a small model. My first version let gemma3:4b write the coaching and the explanation. For a result under 1° off, it called the measurement "significantly off" while quoting a verdict that said "good", and it explained shadows wrongly, saying the sun is directly overhead at midday and rises higher the further north you go. So now the code writes the verdict and advice from the numbers, the explanation is fixed text I checked, and Gemma only does the two jobs I can check by eye. Translation also needed care: asking for hi made it return the English unchanged, while asking for "Hindi" gave Devanagari. The page notices an unchanged result and says so instead of showing it as a translation.

Testing, and a bug a hand check caught. A shadow computed for a known latitude must return that latitude, so the tests do exactly that, for north and south, in both Python and JavaScript. They also compare against the PyEphem astronomy library: for Delhi on 9 October 2026 the sun's declination at solar noon is -6.29° and it crosses the meridian at 12:08:32 IST. That second check exists because my first version used a simple textbook declination formula that I described as accurate to about half a degree. Working the demo example by hand showed it was about 1° off on that date. My round-trip test could not see it, because it used the same formula on both sides. I replaced it with the standard low-precision solar position formulas (about 0.01°) and added the independent reference values. I also check the sensitivity: for a 100 cm stick with a 70 cm shadow, each centimetre of shadow error moves the answer by about 0.38°. Finally, I loaded the page in headless Edge, filled in the form and read back the result.

What I have not done. I have not tested the Gemma buttons from the web page against a running Ollama (the same calls work from the terminal tool), I have not tried Safari, which blocks pages from calling localhost, and your accuracy will be limited by how precisely you can measure a shadow tip, not by the maths.

Why Does Open Innovation Matter?

It works offline, so you can use it in a field or a schoolyard with no signal. The maths is open and checkable, and Gemma is open weights, so I could run it many times on my own machine at no cost, see exactly where it was unreliable and fence it off. A closed API that I could only call a few times would have made it much harder to find that a confident-sounding model was misjudging my numbers.

Prize Categories

Gemma: Gemma (gemma3:4b, run locally through Ollama) handles photo checking and translation in the app.

Top comments (0)