Dipperstein All articles
Deep Dives

The Big Dipper Doesn't Move, But My Tripod Sure Did: A Star Tracker Built Out of Junk Drawer Physics

Dipperstein
The Big Dipper Doesn't Move, But My Tripod Sure Did: A Star Tracker Built Out of Junk Drawer Physics

This site is named after a constellation, so it felt like a matter of time before I did something astronomically stupid. The Big Dipper has been sitting in the masthead for years, pointing at Polaris, doing its job quietly. Meanwhile, I've been pointing cameras at whiteboards. It seemed fair to return the favor.

The premise was simple: build a device that figures out its orientation on Earth by photographing stars. No GPS, no magnetometer, no compass. Just a webcam, some open-source code, and the oldest navigation aid humans ever used. The catch — and there's always a catch — is that everything about this project fights the instincts I've built over twenty years of writing software.

Why Stars Are the Ultimate Orientation Beacon

The math is old enough to feel embarrassing. Stars are so far away that their light arrives essentially parallel, which means from any point on Earth, a given star sits at a predictable angle above the horizon at a predictable time. Find enough stars in an image, match their pattern against a star catalog, and you can solve for exactly where the camera is pointed and how it's rolled. Sailors have done this with a sextant and trig tables since before the Revolutionary War. I have a Raspberry Pi and NumPy. I figured I'd be done by the weekend.

The core algorithm is called "lost-in-space star identification," which is the most metal name in all of aerospace literature. You detect bright spots in the image, compute the angular distances between pairs of stars, and search a catalog for a triangle with matching sides. Three stars, three distances, one unique answer. From there, solving the attitude is just a least-squares problem that any first-year robotics student could do, and I am not a first-year robotics student, so I did it worse but eventually.

The Hardware Is a Lie Detector

Here's the part no amount of software experience prepares you for: physical reality does not have a stack trace.

My first iteration was a webcam zip-tied to a scrap of plywood. The images were garbage. Stars that should have been crisp points of light were smeared into dashes, like the sky was redacting itself. My first instinct was to blame the code. It took me two full nights of tweaking detection thresholds before I accepted the truth: the camera was moving during the exposure. The Earth rotates 15 arcseconds per second, but so does a webcam on a floppy mount when a raccoon walks within thirty feet of it.

I rebuilt the mount in 3D-printed ABS with a heavy steel base plate, and the stars snapped into focus. Every bug after that had a physical explanation hiding underneath the software one:

In software, when something is intermittent, I suspect a race condition. In hardware, when something is intermittent, it's usually weather, thermal expansion, or wildlife. The debugging loop is measured in nights, not builds. You get one test run per day, and it starts after 10 PM, and your neighbors start asking questions.

The Night It Worked

The first successful fix came on a cold, brutally clear night in October. I pointed the rig at a random patch of sky, hit capture, and ran the pipeline. Nineteen stars detected. Catalog matched in 40 milliseconds. The output said I was pointed at a patch of sky near Vega, at a roll angle of 37 degrees, from a latitude of 42.3 degrees north.

I checked. That is, to within about a tenth of a degree, exactly where I was standing and exactly where I was pointing. A machine I built, holding parts that cost less than a nice dinner, had looked at the sky and figured out where it was on Earth. I sat in a folding chair in my backyard grinning at nothing for a solid minute. My wife watched from the porch and asked if the code worked. I said the stars worked. She went back inside.

Total Damage Report

The full bill: a used webcam ($12), 3D printing filament and hardware ($20), a wide-angle lens scavenged from a security camera ($15), and roughly six weekends of my life. The software side — detection, calibration, catalog matching, attitude solving — came to about 600 lines of Python, most of it borrowed concepts from open-source astrophotography tools and papers written by CubeSat teams who do this for real.

The real cost was the education. I learned why the Big Dipper has been the reliable one all along. The stars don't drift, don't crash, and don't need release notes. Every failure in this project was mine: a wobbly mount, an uncalibrated lens, an algorithm that assumed the sky would cooperate. It cooperated the whole time. I just had to build something worthy of the signal — and stop blaming the universe for my raccoon problem.

All Articles

Related Articles

The Kettle, the Ladle, and the Compiler: A Soaking-Hot Tour of Type Strictness

The Kettle, the Ladle, and the Compiler: A Soaking-Hot Tour of Type Strictness

My Well Pump Is the Worst Database I've Ever Administered

My Well Pump Is the Worst Database I've Ever Administered

Burying a Library With Dignity: Confessions of an Open-Source Undertaker

Burying a Library With Dignity: Confessions of an Open-Source Undertaker