Thursday, 26 April 2012

Some Pictures of the Flight

Here are some pictures of our last flight. We launched out of Strathmore, Alberta on April 24, 2012.  The first few pictures are before the bursting point of our balloon. The conditions of the day of launch were extremely cloudy. The camera used is a GoPro Hero II.





The first picture after burst. 

During descent just above the clouds. 

Geiger Counter

Updated Geiger Counter Code. This program uses a loop to determine the length of the pulse. Then it will , add one to the value of a counter if the pulse is of a certain length, then waits for another pulse. This program will then write the value to the corresponding place in the memory of the EEPROM chip. The program is designed to change the slots in memory that are being used if a significant change in pressure is detected. In event of pressure change, it will shift the store bits so that the former data remains and new data can be taken at a different altitude. Finally, in the 0th slot of eeprom memory the number of pressure bins is stored, to ensure that the correct amount of data is printed in the print data routine. This design is  to be used to measure the background radiation vs altitude.


/******************************************
Geiger counter Program
Waits for a switch d8 or d9
d8 it is high, then goes into write mode,
counting pulses of specific length
d9 is high, goes into read mode, reading off of EEPROM on atmega
*******************************************/
#include  "Wire.h"    // for External EEPROM CHIP
#define chip 0x50

int a0=0; int b0=0; int c0=0; int d0=0; int e0=0;
int a1=0; int b1=0; int c1=0; int d1=0; int e1=0;
int a2=0; int b2=0; int c2=0; int d2=0; int e2=0;
int a3=0;

int x=0;
void writeEEPROM(int input,int x){
         byte first = lowByte(input);
         byte last = highByte(input);
         writeData(31+x, first);
         writeData(32+x, last);

}
void initializeSlots(int x){
  writeData(32+x,0); writeData(1+x,0); writeData(2+x,0); writeData(3+x,0); writeData(4+x,0); writeData(5+x,0);
  writeData(6+x,0); writeData(7+x,0); writeData(8+x,0); writeData(9+x,0); writeData(10+x,0); writeData(11+x,0);
  writeData(12+x,0); writeData(13+x,0); writeData(14+x,0); writeData(15+x,0); writeData(16+x,0); writeData(17+x,0);
  writeData(18+x,0); writeData(19+x,0); writeData(20+x,0); writeData(21+x,0); writeData(22+x,0); writeData(23+x,0);
  writeData(24+x,0); writeData(25+x,0); writeData(26+x,0); writeData(27+x,0); writeData(28+x,0); writeData(29+x,0);
  writeData(30+x,0); writeData(31+x,0);}
void initializeCounts(){
//reinitializes the counters
    a0=0; b0=0; c0=0; d0=0; e0=0;
    a1=0; b1=0; c1=0; d1=0; e1=0;
    a2=0; b2=0; c2=0; d2=0; e2=0;
    a3=0;
}

void setup(){
  Serial.begin(9600); // for screen output
  Wire.begin();   // wake up, EEPROM
  pinMode(8, INPUT);
  pinMode(9,INPUT);
  pinMode(10,INPUT);
  pinMode(13, OUTPUT);
  pinMode(11,INPUT);
}
void writeData(unsigned int add, byte data)
// writes a byte of data 'data' to the chip at I2C address 'device', in memory location 'add'
{
Wire.beginTransmission(chip);
Wire.write((int)(add >> 8));   // left-part of pointer address
Wire.write((int)(add & 0xFF)); // and the right
Wire.write(data);
Wire.endTransmission();
//Serial.println(data, DEC);
delay(10);
}
byte readData(unsigned int add) // reads a byte of data from memory location 'add' in chip at I2C address 'device'
{
byte result;  // returned value
Wire.beginTransmission(chip); //  these three lines set the pointer position in the EEPROM
Wire.write((int)(add >> 8));   // left-part of pointer address
Wire.write((int)(add & 0xFF)); // and the right
Wire.endTransmission();
Wire.requestFrom(chip,1); // now get the byte of data...
result = Wire.read();  return result; // and return it as a result of the function readData
}
void loop(){
  Serial.println("Waiting For Switch");
  while(digitalRead(8)==LOW && digitalRead(9)==LOW){
    digitalWrite(13, HIGH);
    delay(1000);
    digitalWrite(13,LOW);
    delay(1000);
  }
 
  if(digitalRead(8)==HIGH){
    Serial.println("Initializing Counts");
    initializeCounts();  
    initializeSlots(0);
   
   
   
   
    Serial.println("Counting Background Radiation");
    int formerMax=900;
    int loopStopper = 1;
    while(digitalRead(8)==HIGH){
    int height = analogRead(0);
    //Serial.println(formerMax);
    //Serial.println(height);
   
    if(height<1000&&height>=900&&formerMax!=1000){
    formerMax=1000;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    writeEEPROM(formerMax,x);
    }
    else if(height<900&&height>=800&&formerMax!=900){
    formerMax=900;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    writeEEPROM(formerMax,x);
    }
    else if(height<800&&height>=700&&formerMax!=800){
    formerMax=800;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    writeEEPROM(formerMax,x);
    }
    else if(height<700&&height>=600&&formerMax!=700){
    formerMax=700;
    loopStopper++;
    x=x+32;
    initializeSlots(x);
    initializeCounts();
    writeEEPROM(formerMax,x);
    }
    else if(height<600&&height>=500&&formerMax!=600){
    formerMax=600;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    writeEEPROM(formerMax,x);
    }
    else if(height<500&&height>=400&&formerMax!=500){
    formerMax=500;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    writeEEPROM(formerMax,x);
    }
    else if(height<400&&height>=300&&formerMax!=400){
    formerMax=400;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    writeEEPROM(formerMax,x);
    }
    else if(height<300&&height>=200&&formerMax!=300){
    formerMax=300;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    writeEEPROM(formerMax,x);
    }
    else if(height<200&&height>=100&&formerMax!=200){
    formerMax=200;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    writeEEPROM(formerMax,x);
    }
    else if(height<100&&height>=0&&formerMax!=100){
    formerMax=100;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    writeEEPROM(formerMax,x);
    }
    /***
    else if(height<450&&height>=400&&formerMax!=450){
    formerMax=450;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    }
    else if(height<400&&height>=350&&formerMax!=400){
    formerMax=400;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    }
    else if(height<350&&height>=300&&formerMax!=350){
    formerMax=350;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    }
    else if(height<300&&height>=250&&formerMax!=300){
    formerMax=300;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    }
    else if(height<250&&height>=200&&formerMax!=250){
    formerMax=300;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    }
    else if(height<200&&height>=150&&formerMax!=200){
    formerMax=200;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    }
    else if(height<150&&height>=100&&formerMax!=150){
    formerMax=150;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    }
    else if(height<100&&height>=50&&formerMax!=100){
    formerMax=100;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    }
    else if(height<50&&height>=0&&formerMax!=50){
    formerMax=50;
    x=x+32;
    loopStopper++;
    initializeSlots(x);
    initializeCounts();
    }
    ***/
   
     
      while(digitalRead(10)==LOW && digitalRead(8)==HIGH);    
      int counter=0;
     
      while(digitalRead(10)==HIGH){
      counter++;
      delayMicroseconds(192);
     
      }
     if(counter==1){//0ms<t<.2ms
       a0++;
       byte first = lowByte(a0);
       byte last = highByte(a0);
       writeData(1+x, first);
       writeData(2+x, last);
     }
     else if(counter==2){//.2ms<t<.4ms
       b0++;
       byte first = lowByte(b0);
       byte last = highByte(b0);
       writeData(3+x, first);
       writeData(4+x, last);
     }
     else if(counter==3){//.4ms<t<.6ms
       c0++;
       byte first = lowByte(c0);
       byte last = highByte(c0);
       writeData(5+x, first);
       writeData(6+x, last);
     }
     else if(counter==4){//.6ms<t<.8ms
       d0++;
       byte first = lowByte(d0);
       byte last = highByte(d0);
       writeData(7+x, first);
       writeData(8+x, last);
     }
     else if(counter==5){//.8ms<t<1.0ms
       e0++;
       byte first = lowByte(e0);
       byte last = highByte(e0);
       writeData(9+x, first);
       writeData(10+x, last);
     }
     else if(counter==6){//1.0ms<t<1.2ms
       a1++;
       byte first = lowByte(a1);
       byte last = highByte(a1);
       writeData(11+x, first);
       writeData(12+x, last);
     }
     else if(counter==7){//1.2ms<t<1.4ms
       b1++;
       byte first = lowByte(b1);
       byte last = highByte(b1);
       writeData(13+x, first);
       writeData(14+x, last);
     }
     else if(counter==8){//1.4ms<t<1.6ms
       c1++;
       byte first = lowByte(c1);
       byte last = highByte(c1);
       writeData(15+x, first);
       writeData(16+x, last);
     }
     else if(counter==9){//1.6ms<t<1.8ms
       d1++;
       byte first = lowByte(d1);
       byte last = highByte(d1);
       writeData(17+x, first);
       writeData(18+x, last);
     }
     else if(counter==10){//1.8ms<t<2.0ms
       e1++;
       byte first = lowByte(e1);
       byte last = highByte(e1);
       writeData(19+x, first);
       writeData(20+x, last);
     }
     else if(counter==11){//2.0ms<t<2.2ms
       a2++;
       byte first = lowByte(a2);
       byte last = highByte(a2);
       writeData(21+x, first);
       writeData(22+x, last);
     }
     else if(counter==12){//2.2ms<t<2.4ms
       b2++;
       byte first = lowByte(b2);
       byte last = highByte(b2);
       writeData(23+x, first);
       writeData(24+x, last);
     }
     else if(counter==13){//2.4ms<t<2.6ms
       c2++;
       byte first = lowByte(c2);
       byte last = highByte(c2);
       writeData(25+x, first);
       writeData(26+x, last);
     }
     else if(counter==14){//2.6ms<t<2.8ms
       d2++;
       byte first = lowByte(d2);
       byte last = highByte(d2);
       writeData(27+x, first);
       writeData(28+x, last);
     }
     else if(counter==15){//2.8ms<t<3.0ms
       e2++;
       byte first = lowByte(e2);
       byte last = highByte(e2);
       writeData(29+x, first);
       writeData(30+x, last);
     }
     /**else if(counter>=16){//t>3.0ms
       a3++;
       byte first = lowByte(a3);
       byte last = highByte(a3);
       writeData(31+x, first);
       writeData(32+x, last);
     }**/
   
    }
    writeData(0,loopStopper);
  }
  if (digitalRead(9)==HIGH&&digitalRead(8)==LOW){  
    Serial.println("Printing Data");
    int z=0;
    int lS = readData(0);
    int zStop = (lS-1)*32;
   
    while(z<=zStop){
    Serial.print("0.0ms<t<0.2ms     ");
    byte temp1=readData(2+z)<<8;
    Serial.println(readData(1+z)+temp1);
 
    Serial.print("0.2ms<t<0.4ms     ");
    byte temp3=readData(4+z)<<8;
    Serial.println(readData(3+z)+temp3);
 
    Serial.print("0.4ms<t<0.6ms     ");
    byte temp5=readData(6+z)<<8;
    Serial.println(readData(5+z)+temp5);
 
    Serial.print("0.6ms<t<0.8ms     ");
    byte temp7=readData(8+z)<<8;
    Serial.println(readData(7+z)+temp7);
   
    Serial.print("0.8ms<t<1.0ms     ");
    byte temp9=readData(10+z)<<8;
    Serial.println(readData(9+z)+temp9);

    Serial.print("1.0ms<t<1.2ms     ");
    byte temp11=readData(12+z)<<8;
    Serial.println(readData(11+z)+temp11);

    Serial.print("1.2ms<t<1.4ms     ");
    byte temp13=readData(14+z)<<8;
    Serial.println(readData(13+z)+temp13);
   
    Serial.print("1.4ms<t<1.6ms     ");
    byte temp15=readData(16+z)<<8;
    Serial.println(readData(15+z)+temp15);
   
    Serial.print("1.6ms<t<1.8ms     ");
    byte temp17=readData(18+z)<<8;
    Serial.println(readData(17+z)+temp17);
   
    Serial.print("1.8ms<t<2.0ms     ");
    byte temp19=readData(20+z)<<8;
    Serial.println(readData(19+z)+temp17);
   
    Serial.print("2.0ms<t<2.2ms     ");
    byte temp21=readData(22+z)<<8;
    Serial.println(readData(21+z)+temp21);
   
    Serial.print("2.2ms<t<2.4ms     ");
    byte temp23=readData(24+z)<<8;
    Serial.println(readData(23+z)+temp23);
   
    Serial.print("2.4ms<t<2.6ms     ");
    byte temp25=readData(26+z)<<8;
    Serial.println(readData(25+z)+temp25);
   
    Serial.print("2.6ms<t<2.8ms     ");
    byte temp27=readData(28+z)<<8;
    Serial.println(readData(27+z)+temp27);
   
    Serial.print("2.8ms<t<3.0ms     ");
    byte temp29=readData(30+z)<<8;
    Serial.println(readData(29+z)+temp29);
   
    Serial.print("pressure bin      ");
    byte temp31=readData(32+z)<<8;
    Serial.println(readData(31+z)+temp31);
   
    z=z+32;
    Serial.println();
    }
    Serial.println("\nFinished Printing Data");
    while(digitalRead(9)==HIGH){
        delay(100);
    }
   
 }
 
}

Monday, 13 February 2012

First Test Launch

On Last Friday Feb 10, we did a test launch. We didn't quite have a working barometer for the flight, but I built and tested one this weekend. For the launch, a solder on the data logger came loose and we didn't end up collecting any data. I worked this weekend to make the board robust and rather than soldering the wire connectors, I had put some wire sockets where we actually screw the battery connections in, and if they come loose, all we need is a screwdriver. Finally I reprogrammed the balloon exploder circuit which overloaded with the delay command and didn't function properly.

Here is the schematic for the new barometer.  The first op-amp and transistor is required to make a constant current source for the nph8100ah pressure transducer. The second op-amp is a differential amplifier which takes the difference in the output, and amplifies the voltage so at atmospheric pressure it puts out about 4 volts.

Lastly, here is the code for the new balloon exploder circuit.


/*
 Balloon Exploder
 Standby: Repeatedly blinks an LED at 1 second intervals
 Recieves voltage at input, turns off standby
 Waits x number of minutes, then sends a HIGH out to 12 and LED Rapid Blinks
 */

void setup() {              
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected
  pinMode(13, OUTPUT);    //pin 13 is set to an output
  pinMode(8, INPUT);      //pin 8 is set to an input
  pinMode(12, OUTPUT);    //pin 12 is set to output
  digitalWrite(12,LOW);   //pin 12 is initialized as low
}
void delayMinute()
// delays for a minute
{
  int counter = 0;
  while(counter<60){
    delay(1000);
    counter++;
  }
}
void delayXMinutes(int x){ //delays for x amount of minutes
  int counter = 0;
  while(counter<x){
    delayMinute();
    counter++;
  }
}
void loop(){
  while(digitalRead(8)==LOW){   // while loop reads pin 8 and will stay in loop until pin 8 recieves 5 volts
    digitalWrite(13, HIGH);
    delay(1000);            
    digitalWrite(13, LOW);     //slow blink to show that the switch has not been flipped yet
    delay(1000);            
  }                        
  delayXMinutes(5);               // delays x number of minutes LIGHT IS OFF WHILE waiting
  digitalWrite(12, HIGH);    //sets pin 12 to 5 volts for transistor
  while(digitalRead(8)==HIGH){ //stays in this state until switch is flipped again
    digitalWrite(13, HIGH);
    delay(100);            
    digitalWrite(13, LOW);   //fast blink to show that the fuse has gone off
    delay(100);            
  }            
}

Monday, 30 January 2012

Some Pictures of the circuits

I have taken some pictures of what we have done. Below is a picture of the balloon exploder circuit that will be on the first test launch. Its primary purpose is to wait a designated amount of time, the set off a solar ignitor that will not in fact pop any balloons, but it will burn through the line connecting the parachute and the balloon. 
Below is the data logger I have created. On board is the atmega 328, a 12 volt and 5 volt voltage regulator, a 12v one sided op-amp, usb break out board, dual axis accelerometer, a thermistor, and a barometer. 

Below is the trackuino. This is designed to get the gps signal and send it over the aprs network. It can also transmit temperature and other data aswell. More about it at http://code.google.com/p/trackuino/

This is a photo from inside the Styrofoam box. I had taped down some wires on the balloon exploder circuit (on the top) since I only used a protoboard because this is temporary and only intended for the test flight. We have the data logger on the right and on the left a gps tracker. The trackuino has not yet been tested, although once its working the other gps tracker will probably remain for redundancy.

Here is a shot at another angle. As you can see we have dowel glued in to hold the circuits and other pieces into place while in flight.

Here's a picture of the closed box. We have the radio transmitter sticking out the top and also the wires for the balloon exploder circuit. 

 And another picture of the payload. The total measured weight is 960 grams.

Monday, 23 January 2012

Some Test Data

For the last couple of weeks I have been doing some fine tuning and some testing. First of all, I have been testing the data logger and and now have some calibration data for the barometer and the accelerometer. I have also found out that the thermistor we currently have outputs a negative voltage for negative numbers and a positive voltage for positive numbers. The arduino does not recognize negative voltages. We could have run the thermistor through an opamp to shift the voltage, but since I'm running out of room on my board, it is just easier to order a different one that does only positive voltage. Once this comes in, I will put some test data of the temperature up. I have also done some testing of the balloon exploder circuit. We plan to have a few smaller balloons for the first test flight. It will be easier to cut the line than to have a number of balloon exploders, so I needed to test to see if the solar ignitors will burn through the nylon line. I did a test with simply a solar ignitor connected to 18v and another test with the whole exploder circuit and both tests were successful.

The barometer calibration data is at the following link:
https://docs.google.com/spreadsheet/ccc?key=0AqH-Vyu_xTSKdGFBam9sbFFIbEJUMDRRRER1RG8tcnc
And some test data is at the following link:
https://docs.google.com/spreadsheet/ccc?key=0AqH-Vyu_xTSKdDN1S0EyOVJXRlZWdThxamR1NWpxUEE