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.
- Features
- Project Structure
- Hardware Requirements
- Software Requirements
- Installation
- Usage
- Accessing the System
- Contributing
- License
- Links to Frameworks and Boards
- Thank You
- 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.
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
- Raspberry Pi: Raspberry Pi Zero 2W
- Raspberry Pi Camera Module: For video streaming
- Sensors:
- BMP390 Pressure Sensor (Adafruit BMP390)
- TMP117 Temperature Sensor (Adafruit TMP117)
- BNO055 Orientation Sensor (Adafruit BNO055)
- DS3231 RTC (Adafruit DS3231)
- RP2040 Microcontroller: For secondary sensor data
- Servo Motor: For mechanical filter control
- Buzzer: Connected to GPIO pin 5
- SD Card: 16GB or larger with Raspberry Pi OS
- Power Supply: Stable 5V supply for Raspberry Pi and peripherals
- Raspberry Pi OS: Latest version (Bookworm recommended)
- Python: 3.9 or later
- pigpio Daemon: For servo control
- Dependencies: Listed in
requirements.txt
-
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.
-
Install pigpio:
sudo apt update sudo apt install pigpio sudo systemctl enable pigpiod sudo systemctl start pigpiod -
Clone the Repository:
git clone https://github.com/WhoIsJayD/teknofest-model-satellite-telemetry.git cd teknofest-model-satellite-telemetry -
Set Up Virtual Environment:
python3 -m venv venv source venv/bin/activate -
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
- Option 1: Use the provided Bash script to automate dependency installation:
-
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.
-
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
-
Alternative Video Feed Options:
- For additional video streaming solutions, consider:
-
Run the System:
source venv/bin/activate python src/main.py- Sensors start collecting data if
packet_count.txtexists. - 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.
- Sensors start collecting data if
-
Stop the System:
- Press
Ctrl+Cto gracefully shut down sensors, camera, and servers.
- Press
- 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(sendstartorstop)
- IoT Data:
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name. - Commit changes:
git commit -m "Add feature". - Push to the branch:
git push origin feature-name. - Open a pull request.
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.
- Raspberry Pi Zero 2W: Official Website
- Raspberry Pi Camera Module: Camera Module V2
- Adafruit Sensors:
- Raspberry Pi Pico (RP2040): RP2040
- Servo Motor: Parallax Feedback 360Β° High Speed Servo
- Python Libraries:
- Teknofest: Official Website
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.