Inspiration

Most people in North America and Europe live under skies too bright to see the Milky Way. Light pollution is a real environmental problem. It disrupts nocturnal wildlife, throws off migratory birds, and messes with our circadian rhythms. We wanted to build something that makes that loss feel personal instead of abstract, so instead of just showing a light pollution map, we built something that tells you whether you personally can see stars tonight, and exactly how far you'd need to drive to fix that.

What it does

You enter a location and Midnight gives you a stargazing score out of 100 for tonight, built from cloud cover, moonlight, and light pollution. It breaks the score down so you know what's actually limiting you, finds the best viewing window during tonight's astronomical darkness, estimates a Bortle class for your sky, and ranks real nearby dark sky spots by distance and darkness so you know where to go instead. It also forecasts the next seven nights, checks air quality and haze, flags visible planets and active meteor showers, and lets you download a plan for the night.

How we built it

Everything runs on Python and Streamlit. The astronomy itself, solar and lunar position, coordinate conversion, local sidereal time, moon illumination, astronomical twilight windows, is computed from orbital formulas we implemented ourselves rather than pulled from a library. . Light pollution is modeled using Walker's Law: a city's contribution to sky brightness falls off roughly with population divided by distance to the 2.5 power, summed across nearby population centers and mapped to the Bortle scale on a log scale. Cloud cover and air quality come from Open-Meteo's free APIs. Population data comes from a GeoNames dataset we bundled directly into the repo.

Challenges we ran into

Our original plan used a live OpenStreetMap Overpass query for population data, which led to a host of other issues. So, we built in a fallback that reweights toward cloud cover and moonlight only, so that failure mode has a real answer instead of us scrambling for one later.

Accomplishments that we're proud of

The astronomy is real - Orbital mechanics we implemented and unit tested against known values and a roughly 29.5 day lunar cycle. We're proud that a full moon below the horizon correctly doesn't hurt your score, since that only comes out right if you've modeled the actual physics of altitude and illumination together instead of just tying score to moon phase. We're also proud of the accessibility work. Every chart and map has a written summary of its takeaway, nothing depends on color alone, and the dark site list gives you everything the map does, so the app still works fully with the visuals stripped away.

What we learned

Being upfront about a model's limitations makes it more credible, not less. Walker's Law is a real first order approximation of sky brightness, and saying so plainly is a lot stronger than pretending we had satellite grade data we didn't. We also learned that cutting a flaky live dependency early is worth more than piling on extra features on top of a shaky foundation. Switching our population data from a live API call to a bundled dataset paid off in how reliable the demo became. What's next for Midnight We'd like to swap in a satellite calibrated brightness dataset, the Falchi et al. World Atlas built on VIIRS data, in place of the Walker's Law approximation for better accuracy. Beyond that, multi night trip planning around meteor shower peaks, extending the orbital mechanics to cover planet visibility in more depth, and switching from straight line distance to actual road routing for dark sites, so the drive time estimate is one people can actually rely on.

Built With

Share this project:

Updates

Submission history