Project in progress
Advanced Model Rocket!!!!!!

Advanced Model Rocket!!!!!! © GPL3+

Fully autonomous rocket!

  • 3,526 views
  • 1 comment
  • 25 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

About this project

Hey Everyone!!! My project is focused on making a fully autonomous heavy lift rocket based around the arduino IDE. The rocket I built is called the Horizon and has 4 carbon fiber fins, a avionics bay to hold the electronics, and a advanced parachute ejection system. The rocket looks at its sensors and when its time to launch it will lift-off. The entire rocket is controlled by a pcb I manufactured called Gamma. It has a Teensy 3.5 microcontroller with high-speed data logging and pressure readings to get altitude measurements. And of course it wouldn't be a rocket without a buzzer and a RGB LED!

Launch Video!!!!!!

Ejection Tests!

Recap of 2017-2019!

Channel Trailer 2019

Code

Omega_Soft_1.01.inoC/C++
// Delta 2020//

#include <Servo.h>
#include <Wire.h>

//gyro info

#define MPU6050_ADDR         0x68
#define MPU6050_SMPLRT_DIV   0x19
#define MPU6050_CONFIG       0x1a
#define MPU6050_GYRO_CONFIG  0x1b
#define MPU6050_ACCEL_CONFIG 0x1c
//#define MPU6050_WHO_AM_I     0x75
#define MPU6050_PWR_MGMT_1   0x6b
//#define MPU6050_TEMP_H       0x41
//#define MPU6050_TEMP_L       0x42

#define G 9.81
int G_offset = 1;

float gyroXoffset = 0;
float gyroYoffset = 0;
float gyroZoffset = 0;

float accXoffset = 0;
float accYoffset = 0;
float accZoffset = 0;

float angleGyroX = 0;
float angleGyroY = 0;
float angleGyroZ = 0;

float accX = 0;
float accY = 0;
float accZ = 0;

float temp;

int16_t rawAccX;
int16_t rawAccY ;
int16_t rawAccZ ;

int16_t rawGyroX ;
int16_t rawGyroY ;
int16_t rawGyroZ;

unsigned long preInterval;
float interval;

float xinter = 0;
float yinter = 0;

float xpre_error = 0;
float ypre_error = 0;

#define xoff 0
#define yoff 0

#define xtarget 0
#define ytarget 0

#define servoMax 130
#define servoMin 50

int xpos = 90;
int ypos = 90;

Servo x_servo;
Servo y_servo;


float Kpx = 1;
float Kix = 1;
float Kdx = 1;

float Kpy = 1;
float Kiy = 1;
float Kdy = 1;

bool launch = false;
bool abort = false;


void setup()
{
  Serial.begin(9600);
  MPU_begin();
  x_servo.attach(9);
  y_servo.attach(10);

  x_servo.write(xpos + xoff);
  y_servo.write(ypos + yoff);
  delay(1000);
  wiggle(200, 40);
  delay(3000);
  MPU_calabrate();
}



void loop()
{
  MPU_update();
  dump();
  if (true)//t_axl(accX , accY , accZ) >   G + G_offset
  {
    launch = true;
    while (true)//t_axl(accX , accY , accZ) > G + G_offset
    {
      MPU_update();
 
      int xerror = xtarget - angleGyroX;
      int yerror = ytarget - angleGyroZ;

      xinter = xinter + xerror * interval;
      yinter = yinter + yerror * interval;
      
      xinter = constrain(xinter , -20 , 20);
      yinter = constrain(yinter , -20 , 20);

      int xderri = xerror - xpre_error;
      int yderri = yerror - ypre_error;

      xpre_error = xerror;
      ypre_error = yerror;

      xpos = 90 + (Kpx * xerror + Kix * xinter + Kdx * xderri);
      ypos = 90 + (Kpy * yerror + Kiy * yinter + Kdy * yderri);

      xpos = xpos + xoff;
      ypos = ypos + yoff;

      xpos = constrain(xpos,servoMin,servoMax);
      ypos = constrain(ypos,servoMin,servoMax);

      x_servo.write(xpos);
      y_servo.write(ypos);
      dump();
      delay(10);
    }
  }
  delay(100);
}






void wiggle(int del , byte shift)
{
  x_servo.write(xpos + xoff + shift);
  y_servo.write(ypos + yoff);
  delay(del);
  x_servo.write(xpos + xoff - shift);
  y_servo.write(ypos + yoff);
  delay(del);
  x_servo.write(xpos + xoff);
  y_servo.write(ypos + yoff);
  delay(del);
  x_servo.write(xpos + xoff);
  y_servo.write(ypos + yoff + shift);
  delay(del);
  x_servo.write(xpos + xoff);
  y_servo.write(ypos + yoff - shift);
  delay(del);
  x_servo.write(xpos + xoff);
  y_servo.write(ypos + yoff);
}



void MPU_begin() {
  writeMPU(MPU6050_SMPLRT_DIV, 0x00);
  writeMPU(MPU6050_CONFIG, 0x00);
  writeMPU(MPU6050_GYRO_CONFIG, 0x08);
  writeMPU(MPU6050_ACCEL_CONFIG, 0x10);
  writeMPU(MPU6050_PWR_MGMT_1, 0x01);
  MPU_update();
  preInterval = millis();
}



float t_axl(float x , float y , float z)
{
  float total = sqrt(sq(x) + sq(y) + sq(z));
  return total;
}

void MPU_update() {
  Wire.beginTransmission(MPU6050_ADDR);
  Wire.write(0x3B);
  Wire.endTransmission(false);
  Wire.requestFrom((int)MPU6050_ADDR, 14);

  rawAccX = Wire.read() << 8 | Wire.read();
  rawAccY = Wire.read() << 8 | Wire.read();
  rawAccZ = Wire.read() << 8 | Wire.read();
  int16_t rawTemp = Wire.read() << 8 | Wire.read();
  rawGyroX = Wire.read() << 8 | Wire.read();
  rawGyroY = Wire.read() << 8 | Wire.read();
  rawGyroZ = Wire.read() << 8 | Wire.read();

  temp = (rawTemp + 12412.0) / 340.0;

  accX = (((float)rawAccX) / 4096.0) * G;
  accY = (((float)rawAccY) / 4096.0) * G;
  accZ = (((float)rawAccZ) / 4096.0) * G;

  float gyroX = ((float)rawGyroX) / 65.5;
  float gyroY = ((float)rawGyroY) / 65.5;
  float gyroZ = ((float)rawGyroZ) / 65.5;

  gyroX = gyroX - gyroXoffset;
  gyroY = gyroY - gyroYoffset;
  gyroZ = gyroZ - gyroZoffset;

  accX = accX - accXoffset;
  accY = accY - accYoffset;
  accZ = accZ - accZoffset;

  interval = (millis() - preInterval) * 0.001;

  angleGyroX += gyroX * interval;
  angleGyroY += gyroY * interval;
  angleGyroZ += gyroZ * interval;

  preInterval = millis();
}


void writeMPU(byte reg, byte data) {
  Wire.beginTransmission(MPU6050_ADDR);
  Wire.write(reg);
  Wire.write(data);
  Wire.endTransmission();
}


void MPU_calabrate()
{

  float ax = 0;
  float ay = 0;
  float az = 0;

  float gx = 0;
  float gy = 0;
  float gz = 0;

  int rez = 300;

  for (int i = 0; i <= rez ; i++)
  {
    MPU_update();
    dump();
    ax = ax + (((float)rawAccX) / 4096.0) * G;
    ay = ay + (((float)rawAccY) / 4096.0) * G;
    az = az + (((float)rawAccZ) / 4096.0) * G;

    gx = gx + ((float)rawGyroX) / 65.5;
    gy = gy + ((float)rawGyroY) / 65.5;
    gz = gz + ((float)rawGyroZ) / 65.5;
    delay(10);
  }
  gyroXoffset = gx / rez;
  gyroYoffset = gy / rez;
  gyroZoffset = gz / rez;

  accXoffset = ax / rez;
  accYoffset = ay / rez;
  accZoffset = az / rez;

  angleGyroX = 0;
  angleGyroY = 0;
  angleGyroZ = 0;
}




void dump()
{
  Serial.print("Id: ");
  Serial.print(launch);
  Serial.print(" sx: ");
  Serial.print(xpos);
  Serial.print(" sy: ");
  Serial.print(ypos);
  Serial.print(" gx: ");
  Serial.print(angleGyroX);
  Serial.print(" gy: ");
  Serial.print(angleGyroY);
  Serial.print(" gz: ");
  Serial.print(angleGyroZ);
  Serial.print(" ax: ");
  Serial.print(accX);
  Serial.print(" ay: ");
  Serial.print(accY);
  Serial.print(" az: ");
  Serial.println(accZ);
  
}

Schematics

Gamma Nano Flight Computer
Gamma nano flight computer l9t2tbcsvj

Comments

Similar projects you might like

Advanced Rocket Launch Pad

Project in progress by Cole Purtzer

  • 3,550 views
  • 3 comments
  • 19 respects

Solid Rocket Motor

Project in progress by Cole Purtzer

  • 2,046 views
  • 1 comment
  • 14 respects

Delta Thrust Vector Control Rocket Guidance System

Project in progress by UniverseRobotics

  • 3,326 views
  • 6 comments
  • 24 respects

Electronics of a hybrid rocket

Project in progress by Chrisy | Variint

  • 784 views
  • 0 comments
  • 4 respects

Hybrid Rocket Engine

Project in progress by UniverseRobotics

  • 4,013 views
  • 0 comments
  • 22 respects

Rocket Auto Abort System!

Project in progress by Cole Purtzer

  • 3,154 views
  • 0 comments
  • 13 respects
Add projectSign up / Login