Phase 1 Meteor Detective Project

So after 2 weeks of toil and quick, useful help from the mbed community, my project has reached its initial testing phases. This is the first version of my program which I can say fulfills most of my objectives which are:

record a series of voltages on an input, and write those to a file

record said voltages only when a condition on the input has been met (in my case above a certain value)

send an external signal when either the voltage is above the trigger level or a file has been created and is being written to

wait indefinitely for the trigger value to occur

write multiple files in some numerical order

write a file recording data from several (3 for now) inputs

stop observations when a condition has been met (number of files written or a special input has been triggered)

 

In the future I wish to develop and add these additional capabilities

 

A time stamp for each file such that One can accurately know (down to seconds at least) the local time at which the trigger value has been reached and the file written to.

A low power on-board RTC so that the program will only be started after a certain time of day (Also playing around with the idea of using the lux of the sky to trigger this, so that only when the sky is a certain brightness or darker, will the program initiate)

Some sort of cloud sensor (may tie in well with the lux sensor)

A way to store data externally (an SD card or USB stick)

 

The goal of this project is to create an autonomous all-sky observatory station for use in detecting meteors. The ideal unit will be:

power efficient

inexpensive

easy to service and rugged

small

self sufficient for weeks if not months

Presently we are using various types of sensors to capture incoming photons from a meteor event. The sensors input a voltage to the mbed, which will be stored (along with a couple seconds of data afterward) at a high speed (1 ms or shorter sampling rate). When a trigger value has been exceeded an analog signal lights an led. In the future we may wish to pair this with a high speed video camera, which will eliminate the need for an RTC since we can merely flash an LED in the camera's FOV when the trigger has been exceeded. Another signal will be sent from the mbed to the camera, initiating a 5 second capture function. This will (when triggered) save the previous 5 seconds of video (which have been stored in a short-term buffer) as well as a further 5 seconds after.

The unit will certainly need to be solar powered, and we are experimenting with the elegant solution of using the solar cells which power the unit as a means for detecting light emitted from meteors. Early results are promising. It seems new generation solar cells have become efficient enough to detect very high frequency ranges and relatively low amplitude signals. The large surface are of the cells is advantageous as it allows more light to be collected than the standard research grade photodiode (think 5mm diameter versus 1m square). Previous solutions to this problem have involved 7 1cm diameter photodiodes on a custom machined aluminum pedestal under a lambertian sphere. This costs several thousands of dollars and is very delicate. A solar panel on the other hand is 50$ and can take a fair amount of abuse.

This is a work in progress and a field trial is still far off. However the code behaves as we might expect and does what we want. A few issues remain, namely whether or not the mbed can understand fractional milliseconds. We should like to use fractional millisecond sampling rates, however when a fraction (0.5, 0.1) is entered, strange behavior ensues. Also we would like an accurate way to time stamp the file. As far as I know the mbed can't easily do this and keep an accurate clock. However, here is the first working version. Special thanks to D. Wendelboe who helped with the read and write syntax.

 

//-----------------------------------------------------------------------------
// Meteor Detective
// A program which waits for a set trigger voltage, stores a set number of 
// readings which are a set time apart. The program opens a file,
// records the data, and then closes the file once the set number of values
// are recorded. The program continues to poll the input voltage waiting for
// the next instance of above trigger value voltage.
// There is code to allow for the use a trigger switch to terminate the process
//
// Thanks to D. Wendelboe who adapted a few sample programs to get me started
//
// D. Wendelboe  14 July 2010  - Submitted "as is". No guarantees implied.
// J. Ehrman 16 July 2010
//-----------------------------------------------------------------------------

#include "mbed.h"

//The next 3 values are various parameters which may be adjusted as desired
#define SR        1  // Sampling Rate in Milliseconds
#define SD     2000  // number of values recorded, multiply by sampling rate to get rough estimate of duration
#define TV1     0.6  // Trigger Value on a scale of 0.0 to 1.0, 0.0 being 0.0 V and 1.0 being 3.3 V
#define TV2     0.6  // Trigger value for input 2
#define TV3     0.6  // Trigger Value for input 3
#define KV     0.99  // Value required to terminate operation
#define ON   1
#define OFF  0
//#define REPEAT do{
//#define UNTIL( condition ) }while(!(condition));

LocalFileSystem local("local");
AnalogIn channel1(p18);
AnalogIn channel2(p19);
AnalogIn channel3(p20);
DigitalOut myled(p5);
AnalogIn kill(p15); 
DigitalOut led1(LED1);
DigitalOut led2(LED2);

float analog_value1;
float analog_value2;
float analog_value3;
float switch_value;
int x = 1;
int count = 0;

int main() {
//    switch_value = kill.read();
//    while (switch_value < KV){
      while (x < 4) {
          char filename[64];    
          sprintf(filename, "/local/analog_%d.txt", x);
          FILE *fp = fopen(filename, "w");
              while (count < SD)   {
                       analog_value1 = channel1.read();
                       analog_value2 = channel2.read();
                       analog_value3 = channel3.read();
                         if (analog_value1 < TV1 && analog_value2 < TV2 && analog_value3 < TV3)
                         { 
                               led2 = ON;
                               wait_ms(SR);           // sampling rate
                               led2 = OFF;
                          } else {
                                while (count < SD) {   // sampling duration
                                    analog_value1 = channel1.read();
                                    analog_value2 = channel2.read();
                                    analog_value3 = channel3.read();
                                    fprintf (fp, "%3i: %f | %f | %f \r\n", count+1, analog_value1, analog_value2, analog_value3);
                                    myled = ON;        // Turn LED ON if sample was stored.
                                    count++;           // Increment sample counter.
                                    led1 = ON;         // LED2 ON.
                                    wait_ms(SR);       // Wait x second(s)(sampling rate)
                                    led1 = OFF;        // LED2 OFF.       
                                                    }
                                 myled = OFF;
                                 fclose(fp);
                                 }
             }
             x++;
             count = 0;
//           switch_value = kill.read();
      }
}          
 

Jim Ehrman, July 23, 2010


0 comments

You need to log in to post a comment