Skip to content

Mohit1053/rocket-flight-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Predicones - Rocket Flight Controller

Advanced flight controller firmware for model rockets and CanSat missions

License: MIT Platform Arduino


πŸ“‹ Table of Contents


🎯 Overview

Predicones is a comprehensive flight controller firmware designed for model rockets and CanSat missions. Built on the STM32H7 platform, it provides real-time attitude stabilization, GPS tracking, telemetry, and data logging capabilities.

Key Capabilities

Feature Description
LQR Stabilization Linear Quadratic Regulator-based fin control
GPS Tracking Real-time position monitoring with NEO-M8N
Telemetry Wireless data transmission via XBee/LoRa
Data Logging High-speed SD card logging at 50Hz
Deployment System Automated parachute and CanSat deployment
Sensor Fusion MPU9250 IMU + BMP388 altimeter

✨ Features

Flight Control

  • 🎯 4-Fin Active Stabilization - LQR-based attitude control
  • πŸ“Š Real-time Sensor Fusion - 9-DOF IMU data processing
  • πŸ”„ Dual Deployment System - CanSat + Parachute release

Sensors

  • πŸ“‘ MPU9250 - 9-axis IMU (accelerometer, gyroscope, magnetometer)
  • 🌑️ BMP388 - High-precision barometric altimeter
  • πŸ›°οΈ NEO-M8N - GPS module for position tracking

Communication

  • πŸ“» XBee Telemetry - Real-time wireless data transmission
  • πŸ“‘ LoRa Support - Long-range communication option
  • πŸ’Ύ SD Card Logging - High-speed data recording

Safety

  • πŸͺ‚ Automated Deployment - Altitude-based parachute deployment
  • ⚑ Graceful Degradation - Continues operation if components fail
  • πŸ“ Comprehensive Logging - Flight data for post-flight analysis

πŸ”§ Hardware Requirements

Microcontroller

  • STM32H7A3ZIQ or compatible STM32H7 series

Sensors

Component Model Interface
IMU MPU9250 I2C (0x69)
Altimeter BMP388 SPI1
GPS NEO-M8N USART2 (38400 baud)

Communication

Component Model Interface
Telemetry XBee Pro USART6 (115200 baud)
LoRa SX1278 SPI (optional)

Actuators

Component Model Interface
Fin Servos (4x) Feetech SCServo Half-duplex UART
Deployment Servos (2x) Feetech SCServo Half-duplex UART

Storage

  • MicroSD Card (FAT32, Class 10 recommended)

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    STM32H7 Flight Controller                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚  β”‚ MPU9250  β”‚    β”‚  BMP388  β”‚    β”‚ NEO-M8N  β”‚              β”‚
β”‚  β”‚  (IMU)   β”‚    β”‚(Altitude)β”‚    β”‚  (GPS)   β”‚              β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜              β”‚
β”‚       β”‚I2C            β”‚SPI1           β”‚USART2              β”‚
β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                    β”‚
β”‚               β–Ό                                             β”‚
β”‚       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                    β”‚
β”‚       β”‚  LQR Control  β”‚                                    β”‚
β”‚       β”‚    Engine     β”‚                                    β”‚
β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜                                    β”‚
β”‚               β”‚                                             β”‚
β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                 β”‚
β”‚    β–Ό          β–Ό          β–Ό                                 β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”                    β”‚
β”‚ β”‚Servo1β”‚  β”‚Servo2β”‚  β”‚Servo3β”‚  β”‚Servo4β”‚  (Fin Control)     β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜                    β”‚
β”‚                                                             β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”                                         β”‚
β”‚ β”‚Servo5β”‚  β”‚Servo6β”‚  (Deployment)                          β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜                                         β”‚
β”‚                                                             β”‚
β”‚       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”‚
β”‚       β”‚ SD Card  β”‚    β”‚   XBee   β”‚                         β”‚
β”‚       β”‚ (SPI3)   β”‚    β”‚ (USART6) β”‚                         β”‚
β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Installation

Prerequisites

Required Libraries

Install via Arduino Library Manager:

- Wire (built-in)
- SPI (built-in)
- Adafruit_Sensor
- Adafruit_BMP3XX
- MPU9250 (hideakitai/MPU9250)
- SCServo
- SdFat
- TinyGPS++ (optional, for GPS parsing)

Setup Steps

  1. Clone the repository

    git clone https://github.com/Mohit1053/predicones.git
    cd predicones
  2. Install STM32 board support

    • In Arduino IDE: File β†’ Preferences β†’ Additional Board URLs
    • Add: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
    • Tools β†’ Board β†’ Boards Manager β†’ Search "STM32" β†’ Install
  3. Install required libraries

    • Sketch β†’ Include Library β†’ Manage Libraries
    • Search and install each required library
  4. Select board and port

    • Tools β†’ Board β†’ STM32 Boards β†’ Select your STM32H7 variant
    • Tools β†’ Port β†’ Select appropriate COM port
  5. Upload firmware

    • Open Fins_Deployment_SD_Integrated.ino
    • Click Upload

βš™οΈ Configuration

Pin Assignments

Edit the following defines in the main sketch if your hardware differs:

// IMU
#define MPU_ADDRESS 0x69

// BMP388 (SPI1)
#define BMP_CS   7
#define BMP_SCK  13
#define BMP_MISO 12
#define BMP_MOSI 11

// SD Card (SPI3)
#define SD_CS_PIN PD14

// Servo IDs
const int SERVO_FIN_IDS[4] = {1, 2, 3, 4};

Flight Parameters

Adjust these values based on your rocket configuration:

// Control gains (LQR)
const float K[4] = {...};  // Tune for your rocket

// Deployment altitudes
const float CANSAT_DEPLOY_ALT = 500.0;  // meters
const float CHUTE_DEPLOY_ALT = 300.0;   // meters

πŸ“Š Flight Data

The system logs comprehensive flight data to the SD card:

Log Format (CSV)

timestamp,altitude,velocity,ax,ay,az,gx,gy,gz,lat,lon,servo1,servo2,servo3,servo4,state

Sample Data Files

  • FLIGHT_DATA.CSV - Example flight data
  • FLIGHT_DATA_1.CSV - Additional flight recording

πŸ“ Project Structure

predicones/
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ workflows/
β”‚   β”‚   └── ci.yml
β”‚   β”œβ”€β”€ ISSUE_TEMPLATE.md
β”‚   └── PULL_REQUEST_TEMPLATE.md
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ Fins_Deployment_SD_Integrated.ino  # Main integrated firmware
β”‚   β”œβ”€β”€ Fins.ino                           # Fin control module
β”‚   β”œβ”€β”€ deployment_GPS_integrated.ino      # Deployment system
β”‚   β”œβ”€β”€ telemetry.ino                      # XBee telemetry
β”‚   β”œβ”€β”€ BMP_final_final.ino               # Altimeter module
β”‚   β”œβ”€β”€ NEO_M8N_working.ino               # GPS module
β”‚   β”œβ”€β”€ SD_card_working.ino               # SD logging module
β”‚   └── LORA_working.ino                  # LoRa communication
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ FLIGHT_DATA.CSV
β”‚   └── FLIGHT_DATA_1.CSV
β”œβ”€β”€ docs/
β”‚   └── wiring-diagram.md
β”œβ”€β”€ .gitignore
β”œβ”€β”€ CHANGELOG.md
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ LICENSE
└── README.md

🀝 Contributing

Contributions are welcome! Please read our Contributing Guidelines first.

Quick Start

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/improvement)
  3. Commit changes (git commit -m 'feat: add new feature')
  4. Push to branch (git push origin feature/improvement)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


⚠️ Safety Notice

IMPORTANT: This is experimental rocket flight controller firmware.

  • Always follow local regulations for model rocketry
  • Test thoroughly on the ground before flight
  • Use appropriate safety measures during launches
  • Never fly near people, buildings, or airports
  • The authors are not responsible for any damage or injury

πŸ‘€ Author

Predicones Flight Controller


πŸ™ Acknowledgments

  • STM32duino community
  • Adafruit for sensor libraries
  • Feetech for servo documentation
  • Model rocketry community

Made with ❀️ for the rocketry community

About

Rocket flight simulation and PID controller implementation

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages