Building a Real-Time Aircraft Radar Bot for Telegram

I built a real-time aircraft tracking bot that fires whenever I drop a location pin in Telegram. Here is how it works.

I built a real-time aircraft tracking bot that runs whenever I drop a location pin in Telegram. Here’s how it works and what I learned building it.

The Problem

I live in Wanamassa, right in the middle of the New York/Newark/JFK approach corridor. There’s always something overhead. I wanted a way to instantly see what was up there without opening FlightAware, typing in coordinates, and waiting for a map to load. One tap — get the answer.

How It Works

The stack is simple: Telegram bot + FlightAware AeroAPI + Python + matplotlib, all running on an EC2 instance. When I drop a 📍 location pin in my Telegram chat, the bot:

  1. Receives the coordinates from Telegram
  2. Queries FlightAware AeroAPI for all aircraft within a configurable radius (default 10mi)
  3. Calculates distance, bearing, and compass direction for each contact
  4. Generates a dark-theme radar plot with matplotlib — color-coded by altitude
  5. Sends the image + text summary back instantly
Live aircraft radar over Wanamassa NJ
Live radar sweep — aircraft within 10 miles of my location. Triangles point in the direction of travel, color-coded by altitude: red < 3,000ft, yellow 3,000–15,000ft, blue > 15,000ft.

The Radar Plot

The visualization was the fun part. I wanted something that felt like actual radar — dark background, green range rings, contacts with altitude color coding. matplotlib handles all of it headlessly on the server. Each aircraft marker is a triangle pointing in its heading direction, with labels pushed outward so they don’t overlap.

# Core fetch function
def fetch_aircraft(lat, lon, range_miles=10):
    delta = range_miles * 0.0145
    bbox = f"{lat-delta}+{lon-delta}+{lat+delta}+{lon+delta}"
    url = f"https://aeroapi.flightaware.com/aeroapi/flights/search?query=-latlong+%22{bbox}%22"
    # returns list of aircraft with position, ident, type, route
    ...

What I Track

Living near the coast means interesting traffic. On any given day I might catch:

  • Regional jets on approach to Newark or JFK — Embraer 175s, CRJ-900s
  • FedEx/UPS heavies — B777Fs crossing the Atlantic overnight
  • JetBlue A220s doing the Portland–JFK run
  • Military traffic — RCH/SAM callsigns, KC-135s, occasional Gulfstreams heading to KSCH (Stratton ANG)
  • Piper Twin Comanches and Cirrus SR22s hopping between KBLM and points south

Military Mode

I added a /military command that expands the search to 75 miles and filters for military aircraft by type code (B52, KC135, C17, F22, F35…) and callsign prefix (RCH, SAM, GHOST, RAIDER, BONE…). Most active military missions squawk off ADS-B, but you can still catch tankers and transport flights doing their thing.

The Repo

The whole thing is open sourced as pinpoint-radar on GitHub. It includes the AeroAPI fetch layer, the matplotlib radar renderer, military detection logic, and a full Telegram bot handler. 72 tests, zero hardware required to run them.

If you have an RTL-SDR dongle and want to go deeper, I also built sdr-scanner — a frequency scanner with ASCII waterfall that covers ADS-B at 1090 MHz natively alongside AM, FM, NOAA weather, and marine VHF.

Asbury Park surf cam
Bonus: the bot also checks the Asbury Park surf cam on demand. Small waves today, nobody out.

Next up: wiring in the ISS pass predictor so I get an alert when the station is about to cross overhead at night.

Leave a Reply

Your email address will not be published. Required fields are marked *