Skip to content

Repository files navigation

AstroSentinel

AstroSentinel is an Android application that allows users to browse satellites, view them on a 3D map, and interact with an AI chatbot specialized in satellites and space.

The project combines Kotlin (Jetpack Compose) for the mobile app, FastAPI + Python for backend proxy, Ollama for local LLM model, and Cesium + satellite.js for satellite orbit visualization.


Preview

333-ezgif com-video-to-gif-converter


Features

  • Satellite List
    Displays satellites fetched from CelesTrak.
    Each item shows its name, type, and approximate next pass time above the observer’s location (requires location permission; defaults to Warsaw if denied).

  • Satellite Details
    Displays parsed TLE data (Two-Line Element Set) including orbital parameters (e.g., inclination, eccentricity, mean motion).
    Derived metrics such as orbital period are calculated directly in the app.

  • 3D Map
    Interactive globe powered by Cesium.js and satellite.js, showing satellite orbits in real-time.
    Clicking a satellite displays its name.

  • Space Chat (AI)
    A chatbot that answers questions about satellites and orbital mechanics.
    Uses Ollama (local LLM server) with the mistral:latest model.
    The Android app talks to a small Python proxy (FastAPI), which converts JSON messages into prompts for Ollama.


Architecture

  • Frontend (Android App):

    • Kotlin + Jetpack Compose
    • UI Screens: SatelliteListScreen, SatelliteDetailsScreen, MapAllScreen, AskAIScreen
    • Location via FusedLocationProvider API
  • Backend (Python Proxy):

    • FastAPI REST server
    • /tle - proxy for CelesTrak (downloads TLE data)
    • /chat - proxy for Ollama (converts JSON -> prompt -> JSON response)
  • Visualization:

    • Cesium.js (3D Earth)
    • satellite.js (satellite propagation from TLE)
    • Cesium Ion (requires free API token)

How Next-Pass Calculation Works

The next visible pass time is estimated inside the class:

com.example.astrosentinel.util.PassPredictor

It works by:

  1. Extracting mean motion from TLE (revolutions per day).
    Formula:
    (1440 = minutes per day)

  2. Calculating satellite’s epoch phase based on TLE epoch + longitude offset.

  3. Comparing it with the current system time (Instant.now()) to find the next crossing.

This is a simplified predictor – not exact like SGP4, but sufficient for approximate "when will the satellite pass near me" info.

Sources:

  • NASA/NORAD TLE format
  • satellite.js – reference implementation for orbit propagation
  • My own calculation based on mean motion and modular arithmetic on orbital phases

Requirements

  • Python 3.11+
  • Android Studio Hedgehog (2023.1.1) or newer
  • Ollama installed locally

Installation

1. Clone the Repository

git clone https://github.com/wiktoriachojnacka/AstroSentinel.git
cd AstroSentinel

2. Python Backend

Create a virtual environment and install dependencies:

py -3.11 -m venv .venv
.venv\Scripts\activate   # Windows
# source .venv/bin/activate   # Linux/Mac

pip install -r requirements.txt

Run the proxy server:

py -3.11 -m uvicorn main:app --host 127.0.0.1 --port 8788

3. Ollama (AI Models)

1.Install Ollama : https://ollama.com/ 2.Pull and run the model:

ollama pull mistral:latest
ollama run mistral

4. Android App

  1. Open the project in Android Studio
  2. Run on emulator (Pixel 7 API 34)
  3. Ensure backend is running (http://127.0.0.1:8788)

5. Cesium Token

Register at cesium.com, generate a free token, and paste it in: app/src/main/assets/cesium/index.html

Cesium.Ion.defaultAccessToken = "YOUR_TOKEN_HERE";

How to Run the Project

  1. Start python proxy:
py -3.11 -m uvicorn main:app --reload --port 8788
  1. Start Ollama:
ollama run mistral
  1. Run AstroSentinel App in AndroidStudio

References & Sources

LE format official descryption NASA/NORAD: https://celestrak.org/NORAD/documentation/tle-fmt.php

Library satellite.js – counting satelites position: https://github.com/shashwatak/satellite-js

Cesium.js 3D visualization: https://cesium.com/platform/cesiumjs/

FusedLocationProvider – Android docs: https://developer.android.com/training/location

Ollama API doc: https://github.com/ollama/ollama/blob/main/docs/api.md download - https://ollama.com/

FastAPI REST framework: https://fastapi.tiangolo.com/


Author

Wiktoria Chojnacka

About

Application to browse satellites, view them on a 3D map and interact with AI chatbot

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages