Laser Triggered High Speed Photography (for $5 +arduino)
by schildpad in Circuits > Cameras
11850 Views, 71 Favorites, 0 Comments
Laser Triggered High Speed Photography (for $5 +arduino)
Ever tried taking a picture like this? I did and failed miserably. I am not a great photographer but I like to mess around with the settings from the camera, lighting, etc.
The problem was that I didn’t find the time to play with them because I was too focussed on getting my timing right between throwing the apple, focussing and taking the picture. Frustrating was, that when 1 picture was “ok” it was nearly impossible to mimic the same timing again.
Solution: I designed a device with an Arduino, the general idea is: when the apple disrupts a laser beam, the Arduino counts several millisecond and then closes the shutter.
For the people who don't like sifting through a merged instructable I made one only for version 2.
(https://www.instructables.com/id/Laser-triggered-high-speed-photography-for-5-ardui/ )
Update:
In the meantime I used my first version a few times and I noticed a problem. I made the connection with the Arduino with wires. At first I thought it to be a good idea, but you always have to remember with wire has to go where, and they have the tendency to break or jump out of the connections.
So I made version 2: Inspired by Arduino-shields I made my own you just can “click in”. I also used some new components; PCB-connectors to my camera which were much easier to assemble when setting up. I also used a big potentiometer because I want to build it in, in a case. The sensor (LDR) is still connected by a “blue sugger”, because it is handy to be able to prolong the wire. I made a set-up with the sensor 6m away (with 12m audiocable) and it still worked perfectly.
parts needed: Version 1
•laser ( $0.55 http://www.dx.com/p/5mw-650nm-copper-semiconducto...
•camera
•MC-DC2 ($2.6 on ebay)
•arduino
• 10k LDR ($0.1)
• 10k Potentiometer: ($0.1)
• Pushbutton/switch: to focus the camera. ($1)
• 2x Transistors BC547 ($0.05)
• 2x 10k resistor as pull up resisitor($0.01)
•2x 1k resistor: as current limiter ($0.01)
•2x 220 ohm resisitor as pull up resistor($0.01)
• some wire ($0.05)
•blue sugers (literary translated: see step 3 for what I mean) ($0.3)
Update:
Partslist
V2:
-arduino
-PCB-board $1/€0,59 (http://www.dx.com/p/double-sided-glass-fiber-prototyping-pcb-universal-board-3-x-7-5-piece-pack-131730)
-Potentiometer $0,55 /€0,4(local store)
-2x 10k Ohm resistor $0,02/€0,01 (local store)
-2x 100 Ohm resistor$0,02/€0,01 (local store)
-2x 220 Ohm resistor$0,02/€0,01 (local store)
-2x LED (preferably other color) $0,35/€0,25 (local store)
-2x BC 547 (transistor) $0,2/€0,14 (local store)
-10k Ohm LDR $0,1/€0,07 (sensor, light dependent resistor)
-1x push button $1/€0,70 (local store)
-1x blue sugger (2 connections) $0,14/€0,1 (local store)
-1x PCB connector (3 connections) $0,14/€0,1 (local store)
-some wire (local store)
-Connection to camera $2,67/€1,92 (ebay)
-laser (http://www.dx.com/p/5mw-650nm-copper-semiconductor-laser-dot-diode-head-set-red-blue-golden-10-pcs-289847)
Usage
Set up the laser so the beam hits the sensor. Connect the Arduino and the camera. When you give the Arduino power you’ll see that first led lights up. This means that the Arduino is started the initialising process. You’ll have to break the beam several time, the Arduino is taking a 1000 samples to calculate the outer boundries of the light intensity. It takes the average of the maximum level and the minimum level and sets it as the threshold for the camera shutter. After 5-10secondes the second led lights up to indicate that the calibration is complete.
To take a picture, push the button to focus (Led 1 will light up), and let something fall through the laser beam. If the picture is taken to early you can set an extra delay with the potentiometer. My set up was complete after 3 pictures. Now you can take a lot of pictures and play with the lighting without worrying about the right moment to push the button.
If you prefer to use manual focus: just use the lens’ slider to set it to manual focus. You’ll still need to push the focus button, just to prepare the Arduino to take the picture. It seems a bit elaborate but otherwise a broke the beam to much and had a lot of bad pictures. You'll see that in the solderd circuit I replaced the button with a switch so in manual mode I don't have to push it each time.
Hack the Remote
2.1. Buy a remote you can hack. I bought my MC-DC2 for $2.6 on ebay, not to expensive for when it would go wrong. (compatible with Nikon D3100 but you can find a cheap remote for almost any camera).
2.2. Break it open
You’ll see 3 metal plates, the upper one is the focus, the middle one is the ground, and the last one is the shutter. The function (focussing, shutter) will be executed when you connect that plate with the ground. You will have to solder a wire to each plate, I used the same color-coding as the wires already used in the shutter (Red= shutter, yellow= focus, white: ground). I brought them out through small holes I drilled in the side, so I could still use the remote without controller.
It is essential you test your “hacked” system, connected it with the camera and push the focus against the ground en when connected push the third wire against both of them. If the camera does what it should, you can proceed to the next step.
Electronics
Build the circuit under, you ‘ve got:
Version 1
• LDR: needed to detected the laser beam, and when it is gone.
• 10k Potentiometer: used to choose the delay
• LED’s: used in the initialisation mode (see explanation above) and to see if your camera should do something (but maybe does not)
• Pushbutton/switch: to focus the camera.
• 2x Transistors BC547, used to connect the 3 wires from the camera remote.
• 2x 10k resistor as pull up resisitor
•2x 1k resistor: as current limiter
•2x 220 ohm resisitor as pull up resistor
• 2x blue sugar 2: 2 be able to change the length of the sensor wire an to supply the power.
•1x blue sugar 1: to be able to disconnect the camera from the extra electronics
Update
Version 2:
I used the
diagram you find by the pictures to get it all on a the board. You see the ground wire running at the side of the board (on the schematic) but in the picture I ran it under the board because I wanted to leave an opening to the right the make a connection with an LCD, using a PCB connector.
Used components stay the same, I only changed the 3 blue sugars to 1 PCB connector with 3 connections, to the remote, 1 blue sugar became pins directly to the arduino, 1 remained a blue sugar (to the sensor)
I also changed a lot of wires to pins you can plug directly into the arduino. Problem with this solution is that the soldering from the pins will be on top of the board and the pins of the rest of the components will be under the PCB. The trick is to give a the wire/resistor/... you want to connect to the pin some more space. A part of the unstriped wire will be on top and then you solder the wire on top to the pin and the rest can be done under the PCB.
Pins:
The pins I used to get a balanced shield. I advice to put the pins in the arduino, place the PCB over it, and make markings where to solder.
A0: sensor
A1: potentiometer (time)
7: pushbutton
6: Focus
5:shutter
Arduino-time (version 1)
Use following code (Version: 1)
int trigger=0; unsigned long Time=0; unsigned long VTime=0; int focus=0; int overD=0; int thresHold=0; int count=0; int maxx=0; int minn=1500;void setup () { pinMode(5,INPUT); pinMode(3, OUTPUT); pinMode(4,OUTPUT); pinMode(12,OUTPUT); pinMode(13,OUTPUT); Serial.begin(9600); digitalWrite(3,HIGH); //initialisation: take 1000 times a sample to set your outer limits //in the middle of the limits, arduino sets its threshold. If the light inensity falls //below that value, the camera will be triggert. while (count< 1000){ int test = analogRead(A1); delay(5); if(testmaxx){ maxx=test;} count=count+1; Serial.println(count); } thresHold=(minn+maxx)/2; Serial.print("max= "); Serial.print(maxx); Serial.print("min= "); Serial.print(minn); Serial.print("threshold= "); Serial.println(thresHold); delay(1000); digitalWrite(4,HIGH); delay(500); digitalWrite(3,LOW); digitalWrite(4,LOW); } void loop () { VTime= analogRead(A0); //read the time delay(5); Serial.print("VTime= "); Serial.println(VTime); Time=map(VTime,0,1023,0,1200); // map the the time so the range of the potentiometer is usefull, note: I didn't use millisecondes, because it makes the code more complicated then needed and slower. focus= digitalRead(5); //see if you pushed the focus button yet Serial.print("laservalue= "); Serial.println (trigger); while(focus== HIGH) { // if you've focussed, you can now wait till the laserbeam is interrupted Serial.println("focussed"); digitalWrite(3,HIGH); // Led will indicated that the camera is focussed overD=1; // arduino will remember you(ve focussed trigger = analogRead(A1); if(trigger < thresHold && overD ==1){ //If you 've focussed and the intensity of the beam is below the treshold //the camera will take a picture delay(Time); //before taking a picture wait a periode of time //delay(1); Serial.println("pic taken"); digitalWrite(4,HIGH); // take the picture for real delay (500); focus=LOW; //Ready for the next one but you will first have to focus again (optional) } } digitalWrite(3,LOW); digitalWrite(4,LOW); }
Arduino Time (version 2)
Used following code:
(Only difference is the pin configuration)
int trigger=0; unsigned long Time=0; unsigned long VTime=0; int focus=0; int overD=0; int thresHold=0; int count=0; int maxx=0; int minn=1500; void setup () { pinMode(7,INPUT); pinMode(6, OUTPUT); pinMode(5,OUTPUT); pinMode(12,OUTPUT); pinMode(13,OUTPUT); Serial.begin(9600); digitalWrite(5,HIGH); //initialisation: take 1000 times a sample to set your outer limits //in the middle of the limits, arduino sets its threshold. If the light inensity falls //below that value, the camera will be triggert. while (count< 1000){ int test = analogRead(A0); delay(5); if(testmaxx){ maxx=test;} count=count+1; Serial.println(count); } thresHold=(minn+maxx)/2; Serial.print("max= "); Serial.print(maxx); Serial.print("min= "); Serial.print(minn); Serial.print("threshold= "); Serial.println(thresHold); delay(1000); digitalWrite(6,HIGH); delay(500); digitalWrite(5,LOW); digitalWrite(6,LOW); } void loop () { VTime= analogRead(A1); //read the time delay(5); Serial.print("VTime= "); Serial.println(VTime); Time=map(VTime,0,1023,0,1200); // map the the time so the range of the potentiometer is usefull, note: I didn't use millisecondes, because it makes the code more complicated then needed and slower. focus= digitalRead(5); //see if you pushed the focus button yet Serial.print("laservalue= "); Serial.println (trigger); while(focus== HIGH) { // if you've focussed, you can now wait till the laserbeam is interrupted Serial.println("focussed"); digitalWrite(5,HIGH); // Led will indicated that the camera is focussed overD=1; // arduino will remember you(ve focussed trigger = analogRead(A0); if(trigger < thresHold && overD ==1){ //If you 've focussed and the intensity of the beam is below the treshold //the camera will take a picture delay(Time); //before taking a picture wait a periode of time //delay(1); Serial.println("pic taken"); digitalWrite(6,HIGH); // take the picture for real delay (500); focus=LOW; //Ready for the next one but you will first have to focus again (optional) } } digitalWrite(5,LOW); digitalWrite(6,LOW); } <br>
Conclusion & Future Plans
Conclusion:
It worked very well, The pictures I took weren't great because of the bad lighting but they where certainly taken at the right moment.
It was the first time in which I encountered the speed limits of the microcontroller. Because the set up of the laser was just 20cm above the water, my first code was too slow to catch the right moment.
Update:
New set of pictures, coming closer to what it should be. I'm now in the search for a bigger aquarium.
Future:
I plan to make cases for the electronics out of plexi, I now use a plastic butter dish to protect them from the splash.
Also a LCD screen with the use time may be handy. I didn't really need it but when you want to rebuild a set-up it can be handy.