Skip to content

πŸ›°οΈ Real-time telemetry and video streaming system for a model satellite, built with a Raspberry Pi Zero 2W, Python, and WebSockets. Features multi-sensor data fusion (BMP390, BNO055, RP2040), state management, and a web dashboard. Designed for the Teknofest 2024 competition.

License

Notifications You must be signed in to change notification settings

whoisjayd/teknofest-model-satellite-telemetry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Model Satellite Telemetry and Camera Streaming System

visitor badge MIT License Python Raspberry Pi Flask WebSocket Camera Status Teknofest

This project is the backend for a GUI developed for the Model Satellite Competition at Teknofest 2024. It provides a robust telemetry system for collecting and transmitting sensor data from a Raspberry Pi-based model satellite, along with live video streaming using a Raspberry Pi Camera Module. The system supports multiple sensors (pressure, temperature, orientation, GPS), a mechanical filter servo, and WebSocket communication for real-time data transmission. It was designed to meet the requirements of the Teknofest 2024 competition, ensuring reliable data logging, state management, and video feed for mission monitoring.

Table of Contents

Features

  • Sensor Data Collection:
    • BMP390 for pressure and altitude
    • TMP117 for temperature
    • BNO055 for orientation (roll, pitch, yaw)
    • RP2040 for secondary pressure, GPS, and battery voltage
  • State Management: Tracks satellite states (Ready to Flight, Ascent, Descent, Release, Recovery) with alarm codes.
  • WebSocket Servers: Real-time data transmission and command reception on ports 9001–9004.
  • Flask Server: Serves media files, telemetry logs, and a dashboard (port 5000).
  • Camera Streaming: Live MJPEG video feed from Raspberry Pi Camera Module (port 8000).
  • Data Logging: Stores telemetry data in CSV files with backup functionality.
  • Concurrency: Uses threading and asyncio for non-blocking operation of sensors, servers, and camera.
  • Test Mode: Supports simulated sensor data for development and testing.

Project Structure

model-satellite-telemetry/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ config.py          # Configuration settings
β”‚   β”œβ”€β”€ utils.py           # Utility functions (logging, CSV)
β”‚   β”œβ”€β”€ sensors.py         # Sensor classes
β”‚   β”œβ”€β”€ server.py          # Flask and WebSocket servers
β”‚   β”œβ”€β”€ camera.py          # Camera streaming logic
β”‚   └── main.py            # Main execution logic
β”œβ”€β”€ templates/
β”‚   └── index.html         # HTML dashboard with Tailwind CSS
β”œβ”€β”€ install_setup_libraries.sh # Bash script for dependency installation
β”œβ”€β”€ README.md              # Project documentation
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ LICENSE                # MIT License
└── .gitignore             # Git ignore file

Hardware Requirements

Software Requirements

  • Raspberry Pi OS: Latest version (Bookworm recommended)
  • Python: 3.9 or later
  • pigpio Daemon: For servo control
  • Dependencies: Listed in requirements.txt

Installation

  1. Set Up Raspberry Pi:

    • Flash Raspberry Pi OS to an SD card using Raspberry Pi Imager.
    • Boot the Raspberry Pi and configure Wi-Fi, SSH, and I2C via raspi-config.
    • Enable the camera module: sudo raspi-config β†’ Interface Options β†’ Camera β†’ Enable.
  2. Install pigpio:

    sudo apt update
    sudo apt install pigpio
    sudo systemctl enable pigpiod
    sudo systemctl start pigpiod
  3. Clone the Repository:

    git clone https://github.com/WhoIsJayD/teknofest-model-satellite-telemetry.git
    cd teknofest-model-satellite-telemetry
  4. Set Up Virtual Environment:

    python3 -m venv venv
    source venv/bin/activate
  5. Install Dependencies:

    • Option 1: Use the provided Bash script to automate dependency installation:
      chmod +x install_setup_libraries.sh
      ./install_setup_libraries.sh
    • Option 2: Install manually:
      pip install -r requirements.txt
  6. Connect Hardware:

    • Connect sensors to I2C pins (SCL, SDA).
    • Connect RP2040 to serial port (/dev/serial0).
    • Connect Parallax Feedback 360Β° Servo to GPIO pins 13 (control) and 6 (feedback).
    • Connect buzzer to GPIO pin 5.
    • Attach the Raspberry Pi Camera Module.
  7. Configure Permissions:

    sudo mkdir -p /home/dyaus/335592_BlackBox_RPI
    sudo mkdir -p /var/www/335592_Flight/media
    sudo chown -R pi:pi /home/dyaus /var/www
    sudo chmod -R 755 /home/dyaus /var/www
  8. Alternative Video Feed Options:

Usage

  1. Run the System:

    source venv/bin/activate
    python src/main.py
    • Sensors start collecting data if packet_count.txt exists.
    • WebSocket servers run on ports 9001–9004.
    • Flask server runs on http://[RPi-IP]:5000.
    • Camera streaming runs on http://[RPi-IP]:8000/stream.mjpg.
  2. Stop the System:

    • Press Ctrl+C to gracefully shut down sensors, camera, and servers.

Accessing the System

  • Dashboard: http://[RPi-IP]:5000
    • Displays live camera feed and media files using a responsive Tailwind CSS interface.
  • Camera Feed: http://[RPi-IP]:8000/stream.mjpg
  • Telemetry Logs: http://[RPi-IP]:5000/telemetry.log
  • CSV Data: http://[RPi-IP]:5000/telemetry.csv
  • Packet Count: http://[RPi-IP]:5000/packet_count
  • WebSocket Endpoints:
    • IoT Data: ws://[RPi-IP]:9001
    • Mech Filter: ws://[RPi-IP]:9002
    • Data Transmitter: ws://[RPi-IP]:9003
    • Command Receiver: ws://[RPi-IP]:9004 (send start or stop)

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature-name.
  3. Commit changes: git commit -m "Add feature".
  4. Push to the branch: git push origin feature-name.
  5. Open a pull request.

License

This project is licensed under the MIT License with an additional requirement to acknowledge the source when using the code or its parts. See LICENSE for details.

Links to Frameworks and Boards

Thank You

Thank you to the Teknofest 2024 organizers for providing an incredible platform to showcase innovation. Gratitude to my team for their collaboration and to the open-source community for the tools that made this project possible. Special thanks to my mentors and teammates for their guidance and support throughout the competition.


Developed by Jaydeep Solanki as part of the Teknofest 2024 Model Satellite Competition.

About

πŸ›°οΈ Real-time telemetry and video streaming system for a model satellite, built with a Raspberry Pi Zero 2W, Python, and WebSockets. Features multi-sensor data fusion (BMP390, BNO055, RP2040), state management, and a web dashboard. Designed for the Teknofest 2024 competition.

Topics

Resources

License

Stars

Watchers

Forks