Photographing all the planes!

So I put together a system that automatically photographs all of the airplanes that fly over my house. I tweeted about it and things exploded a little on Hacker News. So I thought it could be helpful for folks if I go through some of the details.

This story starts about 4 years ago, when I came across an old networked Pan-Tilt-Zoom (PTZ) camera from Axis. My office at In-Q-Tel overlooked the flight path for National Airport. I already had built a little display using my LED sign that showed the airplane that was currently landing. The sign got this information from the ADS-B information that airplanes broadcast these days. Each broadcast contains the airplanes location, heading and some identifying information. Using a cheap, $25 software defined radio you can receive these broadcasts and track which planes are nearby… or with a good antenna, within a couple hundred miles of you. Of course, the natural thing to do was to see if I could have the camera track the planes as they landed using the information from ADS-B. Since I knew the location of the camera, and was getting the location of the airplane, some geometry would tell me where to point the camera. The network security cameras from Axis are great and have a built-in web server and API. You can pass a bearing and angle to the API, and it will point the camera where ever you want. So I hooked this all together and to my surprise, it actually worked! Well, sort of worked. The camera was old, and the image quality was not that great, but it was taking pictures of the planes passing by. Of course, all good things do not last. The setup looked like a pile of junk. I had it setup in the corner by a window and one day it got cleaned and scrapped.

Fast forward a few years. I switched over to working in IQT Labs and we had a little down time between projects. I proposed the we pick up the project again and we got to tinkering. The resulting project, SkyScan, is a much more refined version of the original vision. It is nicely containerized and uses MQTT to pass messages between the components. We ended up working well enough that we bought a fancy Axis camera with a 30x zoom… which we nicknamed “MegaZoom”! We tested perfected it against aircraft at cruising altitude, as well as ones on approach… and we learned a lot about different ellipsoid projections!

However, I left IQT in the fall and went over to Microsoft. One of the awesome things about working at In-Q-Tel is that you get to Open Source a lot of your work. I recently left to work on Software Defined Radios at Microsoft, but wanted to keep working on this project. I missed getting to see all of the planes that were passing by at 40k feet. It was like having a super power.

So I fired up Ebay and got a used traffic camera off Ebay. It is super ruggedized and designed to live on the top of a pole. There is even heater you can turn on. SkyScan simples saves the photos it captures to disk and I wanted to share them. One of the perks of working at Microsoft, is that you get a $150 Azure credit. This seemed like the perfect excuse for me to up my Azure skills. To process the photos from SkyScan, I setup a series of serverless Azure Functions. One of them pulls in an ML model I built in Azure Custom Vision that spots airplanes and automatically builds thumbnails. Another pulls up information about the aircraft based on the identifier from the ADS-B broadcast. It does this by looking it up in a Cosmos DB I built with data I downloaded from the FAA. 

All of this gets served up using Azure App Services and a simple React frontend. Going with App Services, instead of just a VM turned out to be a great choice. After the site hit the frontpage of HN, it fell over from the traffic. I was able to easily upgrade it from the free tier, to something much more substantial with a single click.

I am honest surprised the whole thing works at all. The camera I am using when fully zoomed in, has a horizontal field of view of around 2 degrees. So there is not much room for error or latency!