My high speed photography project for water drops ect, is comming along very nicely so here what i have done so far.
With the Arduino Duemilanove i'm controlling a: Solenoid valve, Photogate, Flash and my Camera.
Works like this:
1. open shutter on camera
2. a delay control the drops from the solenoid valve
3. a photogate waits for the drop the pass the gate
4. after a delay the flash get fired and the picture is taken.
this is what i have done with it:
More here:
http://www.flickr.com/photos/34463171@N04/Here is the schematic for it, this is the first time i have drawn a schmatic so there might be some error in it:
And the code:
int buttonPin = 2; // Connection to the Button
int solenoidPin = 8; // Connection to the Solenoid valve
int flashPin = 9; // Connection to the Flash
int cameraPin = 10; // Connection to the Camera
int photogatePin =11; // Connection to the Photogate
int varloop = 0; // Check variable for Photogate
int val = 0; // Variable for checking if something has passed through the photogate
int bval = 0; // Variable for checking is button is pressed
int flashTimer = 212; // Delay before flash is fired ----- Millisecond
// int flashTimer_micro = 500; // Delay before flash is fired ----- Microsecond (1000 = 1 milisecond)
int solenoidDelay = 250; // Delay for the Solenoid vale, determinds how many drops are dropped
int cameraDelay = 250;
void setup(){
pinMode(cameraPin, OUTPUT);
pinMode(solenoidPin, OUTPUT);
pinMode(flashPin, OUTPUT);
pinMode(photogatePin, INPUT);
pinMode(buttonPin, INPUT);
}
void loop(){
bval = digitalRead(buttonPin);
if (bval == HIGH){
varloop = 0;
} else {
openShutter();
dropWater();
while(varloop != 1){
detectFlash();
}
varloop = 0;
}
}
int openShutter(){
digitalWrite(cameraPin, HIGH);
delay(cameraDelay);
digitalWrite(cameraPin, LOW);
}
int dropWater(){
digitalWrite(solenoidPin, HIGH);
delay(solenoidDelay);
digitalWrite(solenoidPin, LOW);
}
int detectFlash(){
val = digitalRead(photogatePin);
if (val == HIGH) {
delay(flashTimer);
// delay(flashTimer_micro);
digitalWrite(flashPin, HIGH);
delay(50);
digitalWrite(flashPin, LOW);
delay(500);
varloop = 1;
}
}
Next ting will be to add a LCD display
Jens Erik
http://www.flickr.com/photos/34463171@N04/