Wednesday, August 29, 2012

[Mechanical] Initial Design Printed

The initial design was printed on the rapid prototype printer. Already, we know that we have some changes to make such as with the dimesions. The 1.75" x 1.75" outside dimensions have to be modified to fit within the 1.25" constraints. The base contains a square outside to allow maximum area for securing to the backing plate. There is a 1/16" o-ring race around the outside and another around the axle shaft. This will allow the compartments to be sealed off. The five compartments allow for four altitude-based samples to be collected and one baseline sample.





The top has a cutout to allow for one open compartment at a time. The servo will rotate the top disk at the desired altitude allowing the aerogel to collect samples. 




This is how the assembly will look put together.


Tuesday, August 28, 2012

[Programming] main_code 5.0 Beta

/* Requires the SD library from the Adafruit website * SD card attached MOSI - pin 11, MISO - pin 12, CLK - pin 13, CS - pin 10*/
#include <SD.h>
#include <Servo.h>
#include "Wire.h"
#include "Adafruit_BMP085.h"
Adafruit_BMP085 bmp;
Servo myservo;  // create servo object to control a servo
const int chipSelect = 10; //??
File dataFile;
//global varibles
long initialPressure=0;
int counter = 0; //counter for flush
int flushRate = 100; //the rate of flush
//long topP;
//int floors;
//long PPerFloor= (topP-initialPressure)/floors;
//------------------------------------------------------------------------------------------- <setup>
void setup(){ 
 
  //>>>>>>>>>>>>>>>> servo setup
  myservo.attach(9); // servo-pin: pin9
 
  //>>>>>>>>>>>>>>>> pressure sensor setup
   bmp.begin();
  
  //>>>>>>>>>>>>>>>> SD card setup
 
  //----------------------------------  [initialize SD card]
  Serial.begin(57600);  // initialize serial communications: 57600
  while (!Serial) { // wait for serial port to connect. (Needed for Leonardo only) 
    ;
  }
  Serial.println("Initializing SD card..."); // (make sure that the default chip select pin is set to output, even if you don't use it)
  pinMode(SS, OUTPUT);   
  if (!SD.begin(chipSelect)) {  // see if the card is present and can be initialized:
    Serial.println("Card failed, or not present");      
    while (1) ; // if card failed, don't do anything more:
  } 
  Serial.println("card initialized sucessfully!");
 
  //-----------------------------------  [search for the last file and create a new file]
  char filename[] = "LOGGER00.TXT";
  for (uint8_t i = 0; i < 100; i++) {  
    filename[6] = i/10 + '0';  
    filename[7] = i%10 + '0';   
    if (! SD.exists(filename)) { // open a new file if it doesn't exist        
      dataFile = SD.open(filename, FILE_WRITE);    
      break;    
    } 
  }  
  if (! dataFile) {  // check if a new file is found
    Serial.println("couldnt create file"); 
  }
 
  //------------------------------------------------------ [the new file is found]
  delay(500);
  Serial.print("Logging to: "); 
  Serial.println(filename);
 
  //>>>>>>>>>>>>>>>>>> pressure sensor setup
  //------------------------------------------------------- [Calibrate pressure]
  Serial.print("Calibrate Pressure: ");
  for (int j = 0 ; j < 10; j++)
  {
    initialPressure += long(bmp.readPressure());
    delay(50);
  }
  initialPressure = initialPressure / 10;  //Average the initial pressure
  Serial.println(initialPressure);
  Serial.println();
  delay(5000);
}


//--------------------------------------------------------------------------------------------  <loop>
String accelRead()//read data from accelerometer
{
  String data = "";
  int a0 = analogRead(0);
  int a1 = analogRead(1);
 
  Serial.print(a0);
  Serial.print(",");
  Serial.print(a1);
 
  data += String(a0);
  data += ",";
  data += String(a1);
 
  return data;
}
String pressureRead()//read data from pressure
{
  String data = "";
  int t=bmp.readTemperature();
  long p=bmp.readPressure();
 
  Serial.println();
  Serial.print("T = ");
  Serial.print(t);
  Serial.println(" *C");
  Serial.print("P = ");
  Serial.print(p);
  Serial.println(" Pa");
  Serial.println();
 
  data += String(t);
  data += ",";
  data += String(p);
 
  return data;
}
int SDwrite(File inputFile, String data, int i) //write data into SD card and flush in certain rate
{
  inputFile.print(data);
  if (i>flushRate)//flush data into SD card. flush rate: 100
  {     
    dataFile.flush(); 
    i = -1; 
  }
  return i+1;
}
int SDwriteNL(File inputFile, int i)
{
  inputFile.println();
  if (i>flushRate)
  {     
    dataFile.flush(); 
    i = -1; 
  }
  return i+1;
}
long moveServoUp(const long bottomP, const long pressurePerFloor, const int movePerFloor, long lastP) // servo move according to altitude
{
  long p=bmp.readPressure();
  int i;
  if(lastP==0)
  {
    lastP=p;
  }
  if(p<lastP)
  {
    i= (bottomP-p)/ pressurePerFloor;
    lastP=p;
  }
  else
  {
    i= (bottomP-lastP)/ pressurePerFloor; 
  }
  if(i<0)
    i=0;
  myservo.write(movePerFloor*i);
 
  Serial.print("Floor: ");
  Serial.println(i);
  //Serial.println(p);
  //Serial.println(lastP);
 
  return lastP;
}
long LP=0; //LP= lastPressure has recorded
void loop()
{
  //----------------------------------- [read and write data]
  SDwrite(dataFile, accelRead(), 0); //less than flushRate forever: save time on calculation
  SDwrite(dataFile, ",", 0);
  SDwrite(dataFile, pressureRead(), 0);
  counter= SDwriteNL(dataFile,counter);
 
  
  //------------------------------------ [servo control]
   LP = moveServoUp(initialPressure, 10, 45, LP);
 
 
  //-------------------------------------- [loop frequence 20Hz]
  delay(50);
}

Friday, August 24, 2012

Rocket Project Update:

Current Progress:

Mechanical Team:  (Jason and Brandon)
  • A design has been completed and an initial prototype has been printed by the Engineering Design Technology department.  An updated design has already been made, but further updates will be made pending assembly of the initial assembly. 
  • Tasks:  Assemble prototype with Servo and Test with electrical team.
Electrical: (Stephen and Ray)
  • BMP085 altimeter is wired.  Dual Accelerometer board is completed. SD card IO is working with prototype board. Servo is wired to prototype board.   Gswitch is tested using a latching relay.
  • Tasks:  Assemble Battery Pack, Wire all parts to soldered protoboard.  Move from arduino protoboard to soldered connections on Arduino Mini.   Integrate Gswitch with package.  Determine overall power budget.
Programming: (James)
  • Code is written to read altimeter and temperature sensor, accelerometers and write data to SD card.  Servo is controlled from code based on altitude. 
  • Tasks:  Write moving average filter for pressure data, do additional calibration for sensors. General code clean up.  Present code to rest of team.
Science: (Michele)
  • Aerogels obtained.  Contacts with Material Science lab made.
  • Tasks:  Deliver aerogels for use in sample container.  Better define science mission.
Testing:  (Nick) 
  • Rotation test apparatus developed.  Status of vibration test apparatus is unknown.  
  • Tasks:  Update status of test equipment.  Test uninstrumented prototype for mechanical failure. 
Funding: (Des)
  • Proposal developed. Paperwork completed and signed.
Tasks:  Present to Student senate.

Oversight:  (Mason)
  • Provide Battery Packs.  
  • Need to decide if current servo is sufficient for needs and obtain other servos
All teams need to contribute status documentation for their area to this blog. (Pictures and text)