ISS Locator

Posted by Ruth Selorme on October 26, 2024

Watch the ISS: A Python Project to Track the Space Station

Have you ever looked up at the night sky and wondered if the International Space Station (ISS) might be passing overhead? With this Python project, you can turn that curiosity into action! This project tracks the ISS and sends you an email alert when it's visible from your location during the night. It’s a fun and practical way to explore Python’s capabilities in web requests, datetime handling, and email communication.

Project Overview

The ISS Tracker project uses Python to fetch the current position of the ISS and checks whether it’s visible from your location based on specific conditions. If the ISS is within range and it’s dark outside, you’ll receive an email notification prompting you to look up and catch a glimpse of the space station.

Key Features

    Real-Time ISS Position: The project uses the Open Notify API to get the ISS's current position and determines if it's close to your location.

    Day/Night Check: The script checks whether it’s currently dark at your location by comparing the current time to sunrise and sunset times retrieved from the Sunrise-Sunset API.

    Email Alerts: When the conditions are met, an email is sent to notify you to step outside and view the ISS.

    Regular Checks: The code runs continuously, checking the ISS position every 60 seconds to ensure you don’t miss any opportunities to see the space station.

Step-by-Step Breakdown

1. Setting Up the APIs

The script uses two APIs: Open Notify for ISS position and Sunrise-Sunset for local daylight information. Requests are sent to these APIs to fetch real-time data.

2. Checking ISS Position

The function right_iss_position determines if the ISS is within a specific range of your location (±5 degrees latitude and longitude). This ensures the ISS is visible from where you are.

3. Daylight Check

The function it_is_dark checks if the current time falls within the hours of darkness based on local sunrise and sunset times. It adjusts for the local time zone to ensure accuracy.

4. Sending Email Alerts

If both conditions are met, the script sends an email using SMTP with a simple message alerting you to check out the ISS. Ensure you have valid email credentials and correct SMTP settings for this to work.

5. Continuous Monitoring

The script runs in a loop, checking every 60 seconds to ensure you receive timely notifications. This approach helps you catch the ISS during its brief visibility period.

Python Skills Utilized

    API Requests: Using the requests module to interact with web APIs and retrieve data.

    Date and Time Handling: Using the datetime module to handle and compare time data.

    Email Communication: Sending emails using the smtplib module for notifications.

    Continuous Execution: Implementing a loop with time.sleep to repeatedly check conditions.

Real-World Use Cases

    This project is perfect for space enthusiasts who want to keep track of the ISS and catch a glimpse of it from their own backyard.

    It’s also a great exercise for learning how to integrate various Python libraries and APIs to build practical, real-time applications.

    The email alert feature demonstrates how to use Python for automated notifications, which can be adapted for other types of alerts and reminders.

Conclusion

Tracking the ISS with Python is a fantastic way to combine programming skills with astronomy. Whether you’re an aspiring coder or a stargazing enthusiast, this project offers a hands-on way to explore both. Check out the full code on my GitHub repository and start tracking the ISS today!

Watch the demo video here:

Category: Projects

122 eye svg

1 thumbs up svg

Comments