AME 3623: Project 6: Rate Gyroscopes and Damping Control

At the end of this project, you should be able to:

Component 1: Circuit

Connect a rate gyro to your circuit. We are distributing two different forms of rate gyro (each group will have exactly one). Please use the appropriate instructions below for your gyro.

Short-Stem Sensor

This sensor has short leads that plug directly into your breadboard. The pin-outs for this board are as follows:

Note: when you are setting up your Arduino to read this sensor, keep the AREF pin the same as for the distance sensors (project 5).

Long-Stem Sensor

This sensor takes the following form:

This sensor contains not only a 3-axis rate gyro, but also a 3-axis accelerometer and magnetometer. In the next project, we will use the magnetometer as a compass. Hence, this sensor must be mounted high enough to not "see" magnetic interference from sources embedded in the floor.

The lines are connected as follows:

Don't forget: connect the red line to +3.3V power (anything else could damage the chip).

When mounted, the wires should extend straight up and the board should be horizontal. You have been supplied with a 3D-printed support that should be used to keep the sensor from wobbling.

Did I mention that the red line must only be connected to +3.3V?

Access:

Remember, only connect the red wire to +3.3V.

Component 2: Software

Implement the following function:

Copy the following function from project 1:

Copy the following function from project 2: Copy the following functions from project 3:

Structure the rest of your code as follows (we will talk about what this means in class):

// Global flag       
volatile uint8_t flag_timing = 0;

// Interrupt service routine: called every time
//  the timer 0 counter transitions from 0xFF to 0.
//  Period of flag_timing is 3 * 256 * 1024 / 16000000 = 49.152 ms
       
ISR(TIMER0_OVF_vect) {
       static uint8_t count = 0;  // Set to zero at beginning of program only
       if(++count == 3){
          // Set the flag to indicate that the period has passed
          flag_timing = 1;
          count = 0;
       }
};
       

int main(void) {
       int16_t counter = 0;
       int16_t rotation_rate;
       
       #APPROPRIATE VARIABLE DECLARATIONS HERE#
       
       #APPROPRIATE INITIALIZATIONS HERE, INCLUDING YOUR FILE POINTER#

       timer0_config(TIMER0_PRE_1024);   // Prescale by 1024
       sei();  // Enable global interrupts

       // Begin to lift off the ground
       set_lift_motor_direction(HOVER);

       #RAMP UP LIFT THRUST TO HOVER.  STOP RAMPING AS SOON AS THE
            CRAFT BEGINS TO ROTATE AT AN INTERESTING RATE (this must
            be sensor-based#

       timer0_enable();  // Enable the timer 0 overflow interrupt
       // Loop for ~30 seconds 
       while(counter < 20*30) {
       
           rotation_rate = read_rotation_rate();

           // Display
           #APPROPRIATE CODE FOR DISPLAYING ROTATION RATE WITH YOUR 10 LEDS#

           // Control
           derivative_control(rotation_rate);
           
           // Increment time
           ++counter;

           if(flag_timing) {
               // Error condition: your while body is taking too much
               //  time.
               #Indicate this with an LED display of some form#
           }

           // Wait for the flag to be set (happens once every ~50 ms)
           while(flag_timing == 0) {};

           // Clear the flag for next time.
           flag_timing = 0;
       }

      #RAMP DOWN LIFT THRUST TO ZERO#
       
      while(1){};   // Spin forever
}


Component 3: Hovercraft Layout

The hovercraft will work best when its center of mass is at the center of the Frisbee. Adjust the positions of your batteries and breadboard to achieve this.

Note that steering of the craft will work best if the lateral fans are placed a little ahead of the middle fan (too far forward and the craft will steer in a sluggish way; behind the middle fan and the craft will be unstable).

Component 4: Testing


What to Hand In

All components of the project are due by Thursday, April 7th at 9:00 am.

Grading

Personal programming credit: Group grade distribution:

Group Grading Rubric

Grades for individuals will be based on the group grade, but weighted by the assessed contributions of the group members to the non-personal programming items.

References


andrewhfagg -- gmail.com

Last modified: Sun Apr 17 16:02:54 2016