Advanced flight controller firmware for model rockets and CanSat missions
- Overview
- Features
- Hardware Requirements
- System Architecture
- Installation
- Configuration
- Flight Data
- Contributing
- License
- Safety Notice
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.
| 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 |
- π― 4-Fin Active Stabilization - LQR-based attitude control
- π Real-time Sensor Fusion - 9-DOF IMU data processing
- π Dual Deployment System - CanSat + Parachute release
- π‘ MPU9250 - 9-axis IMU (accelerometer, gyroscope, magnetometer)
- π‘οΈ BMP388 - High-precision barometric altimeter
- π°οΈ NEO-M8N - GPS module for position tracking
- π» XBee Telemetry - Real-time wireless data transmission
- π‘ LoRa Support - Long-range communication option
- πΎ SD Card Logging - High-speed data recording
- πͺ Automated Deployment - Altitude-based parachute deployment
- β‘ Graceful Degradation - Continues operation if components fail
- π Comprehensive Logging - Flight data for post-flight analysis
- STM32H7A3ZIQ or compatible STM32H7 series
| Component | Model | Interface |
|---|---|---|
| IMU | MPU9250 | I2C (0x69) |
| Altimeter | BMP388 | SPI1 |
| GPS | NEO-M8N | USART2 (38400 baud) |
| Component | Model | Interface |
|---|---|---|
| Telemetry | XBee Pro | USART6 (115200 baud) |
| LoRa | SX1278 | SPI (optional) |
| Component | Model | Interface |
|---|---|---|
| Fin Servos (4x) | Feetech SCServo | Half-duplex UART |
| Deployment Servos (2x) | Feetech SCServo | Half-duplex UART |
- MicroSD Card (FAT32, Class 10 recommended)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 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) β β
β ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Arduino IDE 2.0+ or PlatformIO
- STM32 board support package
- Required libraries (see below)
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)
-
Clone the repository
git clone https://github.com/Mohit1053/predicones.git cd predicones -
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
-
Install required libraries
- Sketch β Include Library β Manage Libraries
- Search and install each required library
-
Select board and port
- Tools β Board β STM32 Boards β Select your STM32H7 variant
- Tools β Port β Select appropriate COM port
-
Upload firmware
- Open
Fins_Deployment_SD_Integrated.ino - Click Upload
- Open
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};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; // metersThe system logs comprehensive flight data to the SD card:
timestamp,altitude,velocity,ax,ay,az,gx,gy,gz,lat,lon,servo1,servo2,servo3,servo4,stateFLIGHT_DATA.CSV- Example flight dataFLIGHT_DATA_1.CSV- Additional flight recording
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
Contributions are welcome! Please read our Contributing Guidelines first.
- Fork the repository
- Create a feature branch (
git checkout -b feature/improvement) - Commit changes (
git commit -m 'feat: add new feature') - Push to branch (
git push origin feature/improvement) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
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
Predicones Flight Controller
- GitHub: @Mohit1053
- STM32duino community
- Adafruit for sensor libraries
- Feetech for servo documentation
- Model rocketry community
Made with β€οΈ for the rocketry community