Go Down

Topic: Synchronizing two camera's using an arduino MEGA ADK (Read 1 time) previous topic - next topic

Abboud

Aug 27, 2014, 10:09 am Last Edit: Aug 27, 2014, 10:17 am by Abboud Reason: 1
Hello everyone,

I'm a PhD student working on developing a new experimental set-up for full field measurements. The idea is to synchronize a CCD camera and an IR one, using an arduino MEGA ADK.
I wrote this simple program using the delay() function, but while reading about the arduino code i realized that this it is not the best option. by the way this code never worked also :(

I'm just wondering what other function can help me manage this time delay between my cameras?
And another question, is there a way to manage two loop() independently in the same code? for example one first loop to manage my cameras delay and another independent one to manage two blinking LED.

I don't know if i was that clear in my message but I'm hoping that i can be clearer while discussing.

this is my code :
Quote
int cameraIR = 49;
int cameraCCD = 48;

float dCCD = 2.6; // ms    // Physical delay of the CCD camera, it represents the delay between
                                            // the moment of taking the image and the moment of storage

float dIR = 0.0028; //ms      // Physical delay of the IR camera

float dsv = 0.001;      //  sensor value delay, i usually use 1┬Ás

int fa = 20 ;         // fa in fps will be the frame rate of my camera


void setup() {
 pinMode(cameraIR, OUTPUT);
 pinMode(cameraCCD, OUTPUT);
}

void loop() {
 // since the time delay of the IR camera is less then the CCD camera i started by turning the CCD camera on

 digitalWrite(cameraCCD, HIGH);

 // dCCD - dIR = this time delay will allow me to synchronize both cameras so they take images at the same time
 delay(dCCD-dIR);  
 digitalWrite(cameraIR, HIGH);

 // = sensor Value delay
 delay(dsv);

// both cameras are put to LOW at the same time
 digitalWrite(cameraIR, LOW);
 digitalWrite(cameraCCD, LOW);
// this delay will alloy me to respect the frame rate chosen above
 delay((1000/fa)-(dCCD-dIR)-dsv);  
}



Go Up