Radar for Presto
notes.husk.org · 1 day ago · discuss
With a side of aircraft and flight trackingA couple of weekends ago, I ended up looking on Etsy at little widgets that showed a radar display, centred on a location, showing what was overhead. “These seem nice”, I thought, “but I don’t have the money at the moment to justify one”.What I did have was a Pimoroni Presto, a “desktop companion” with a 4" 480x480 display, powered by a RP2350 microcontroller, with wifi, bluetooth, and sundry other niceties. It’s programmed in MicroPython, which is like the mainstream CPython, but cut down to deal with running on a 150MHz CPU with about 512KB of RAM. (So it’s about the speed of a 1996 PC with the memory of one from 1988.) With Claude’s help, it was satisfyingly quick to get to a proof of concept.ALTHowever, it turned out that making this nicer is a lot of work. It’s all doable, but still, it’s work. For example, adding airports, or a vector coastline - you know, useful ground references (and scale). Or switching to a map mode, which involved redoing the graphics. The data, though, was pretty easy to come by, at least at first.It turns out there’s a real distinction that I’d not quite understood before, between aircraft tracking and flight tracking. The advent of ADS-B - a signal that tells everyone where an aircraft is, used by all scheduled and most other flights - means that there’s no problem finding what is in the air, at least near a place big enough for someone to have invested in about $60 worth of hardware - and SF has plenty of those.What is tricky - especially in the US - is figuring out where the plane is actually going. Callsigns are often used for multiple legs of a single route, so it’s not uncommon to find an departure from SFO being labelled as Fort Lauderdale - Dallas, which was true four hours ago, but not now it’s on its way to O'Hare.That’s a shame, because it’s really interesting knowing where a plane is going, especially when it’s just taken off from Oakland and is curving up and south over the house. It turns out that, when I did finally realise I should look for other people’s code to see if this’d been solved, there was some (very Claude-reading) research results showing that adsbdb is inaccurate on US route lookups over 70% of the time. Ouch.This is probably why, despite the presence of lots of free (both as in speech and beer) data about aircraft movements, FlightRadar24, FlightAware, and Cirium (who run FlightGlobal, which is what Google uses for their flight info boxes) can all still run healthy business charging for accurate flight data.Nonetheless, thanks to a combination of data from two sources - the aforementioned adsbdb and adsb.lol - and a sanity check in the code (“is the plane near a path between the two airports?”) the route info now only shows up if it’s probably useful.If you’re interested in the code, it’s all on my GitHub, in a branch on the presto-experiments repo. If it’s specifically the route part, that’d be in routes.py.