Lesson 5: Day vs Night

The ISS orbits the Earth every 90 minutes, experiencing 16 sunrises and sunsets every day. To take good photos, we must know if we are in sunlight.

Session Goals
  • Use the astro_pi_orbit library.
  • Determine the Location of the ISS.
  • Check if the ISS is in Sunlight or Darkness.
  • Use Conditionals to make decisions based on orbit status.

The Mission Task

We need to write a program that checks the lighting conditions before attempting to take a photo. Taking photos in the dark wastes storage space and power.

Key Concepts

Orbital Period
The ISS travels at 28,000 km/h and completes one orbit every ~90 minutes.
Terminator Line
The moving line that separates the illuminated day side and the dark night side of the Earth.
Boolean Logic
Using True/False values to control program flow. if sunlit: runs code only when it is day.

Astro Pi Orbit

Provides information about the ISS orbit and position.

from astro_pi_orbit import ISS
UsageDescription
iss = ISS()Initialize the ISS interface.
iss.get_position()Returns the current latitude and longitude.
iss.get_status()Returns a dictionary with orbital info (sunlit, eclipse, etc).

Time

Standard Python library for time-related functions.

import time
UsageDescription
time.sleep(seconds)Pauses execution for the specified number of seconds.

Mission Control Interface

Output Terminal
Ready to execute...