Space & AstronomyRecruit

ISS Overhead Alert: Know When the Space Station Flies By

Calculate International Space Station passes for your location and light an LED when it is above the horizon.

LevelRecruit
Time45 min
Est. cost~$48
Steps5

The ISS orbits Earth about every 90 minutes and is often visible to the naked eye. The Skyfield library predicts its position from public orbital data (TLEs).

Video tutorial

▶ RaspberryConnectWatch on YouTube ↗

Video by RaspberryConnect, embedded from YouTube. The written steps below are our own and match the parts list.

Mission steps

  1. Install Skyfield

    pip install skyfield in a venv.

  2. Download orbital data

    The script fetches the latest ISS TLE from CelesTrak and refreshes it daily.

  3. Set your location

    Enter your latitude and longitude.

  4. Light the LED

    An LED on GPIO17 lights while the ISS is above 10° elevation.

  5. Go outside

    Visible passes happen near dawn or dusk when the station is sunlit and your sky is dark.

Code

import time
from skyfield.api import load, wgs84
from gpiozero import LED

led = LED(17)
ts = load.timescale()
URL = 'https://celestrak.org/NORAD/elements/gp.php?CATNR=25544&FORMAT=tle'
here = wgs84.latlon(27.27, -80.35)      # your latitude, longitude

def iss():
    return load.tle_file(URL, reload=True, filename='iss.tle')[0]

sat, fetched = iss(), time.time()
while True:
    if time.time() - fetched > 86400:
        sat, fetched = iss(), time.time()
    alt, az, dist = (sat - here).at(ts.now()).altaz()
    led.value = alt.degrees > 10
    print('ISS elevation %.1f deg, azimuth %.0f deg' % (alt.degrees, az.degrees))
    time.sleep(10)

Tip: test every script on the bench before installing it in a moving machine.

Questions

Can it track other satellites?

Yes. Change CATNR to any satellite's NORAD catalog number, such as Hubble (20580).