move_lens
description
Transcript of move_lens
![Page 1: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/1.jpg)
How to Move
Canon EF Lenses
Yosuke Bando
![Page 2: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/2.jpg)
Preface
• This instruction is intended to be helpful to
those who are interested in making
modifications to camera lenses to
explore/reproduce focus sweep, focal
stack, and other related imaging
techniques for research purposes.
• But we disclaim any responsibilities for the
consequences of your following this
instruction, so do it at your own risk!
![Page 3: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/3.jpg)
Outline
• Overview & preparation
• Lens modification
• Wiring
• Software
• Putting them together
![Page 4: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/4.jpg)
Outline
• Overview & preparation
• Lens modification
• Wiring
• Software
• Putting them together
![Page 5: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/5.jpg)
The Lens in This Instruction
• Canon EF-S 18-55mm f/3.5-5.6 IS II
– Comes with a Canon EOS Rebel camera kit
• Any Canon EF lenses may be used
![Page 6: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/6.jpg)
The Goal
• The lens has motors and control circuits inside, and
operates according to commands from a camera body
• All you need is to intercept such communications and
send “move focus” commands to the lens
Lens
Camera body
Normally, a camera body
sends commands
Lens
Camera body
Arduino
An external board
(we use Arduino)
sends commands
Hack
![Page 7: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/7.jpg)
Lens Pin-out
• Protocol: SPI (serial peripheral interface)
– 8 data bits, 1 stop bit
VBAT
P-GND
D-GND
CLK
VBAT: 6V power for lens motors
P-GND: Ground for lens motors
VDD: 5.5V power for digital logic
DCL: Data from camera to lens (MOSI)
DLC: Data from lens to camera (MISO)
CLK: Clock
D-GND: Ground for digital logic
VDD
DLC DCL
MOSI: master output, slave input
MISO: master input, slave output
master: camera in this case
slave: lens in this case
![Page 8: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/8.jpg)
Rough Schematic
VBAT
P-GND
D-GND
CLK VDD
DLC DCL
6V battery
• Battery supplies power to the lens motors
• Arduino controls the lens digital logic
• No need to monitor DLC pin
Arduino
![Page 9: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/9.jpg)
Rough Schematic
VBAT
P-GND
D-GND
CLK VDD
DLC DCL
6V battery
• Battery supplies power to the lens motors
• Arduino controls the lens digital logic
• No need to monitor DLC pin
Camera body
Additional wires for synchronization
Arduino
![Page 10: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/10.jpg)
Tools & Parts
Four AA batteries Wire
Camera body
(Rebel T3i is used here,
but can be any
Canon EOS camera)
… and
• Solder
• Soldering iron
• Drill
• (Circuit tester)
• (Breadboard)
Battery holder
Arduino
(+ USB cable)
Nippers Pliers Phillips micro screwdriver
Batteries can be anything
that produces 6V voltage
![Page 11: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/11.jpg)
Outline
• Overview & preparation
• Lens modification
• Wiring
• Software
![Page 12: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/12.jpg)
Lens Modification
• Our sub-goal here is to wire the pins from
outside so that we can send commands
from an external board
![Page 13: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/13.jpg)
Remove the Screws 1/2
• Remove the two micro screws beside the
pins
![Page 14: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/14.jpg)
Remove the Screws 2/2
• Remove the four screws on the back side
of the lens
![Page 15: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/15.jpg)
FYI
• Those four screws are tight
• You might want to use pliers to unscrew
them
![Page 16: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/16.jpg)
Detach the Back Cover
This cable is for
image stabilization
(anti-camera shake).
You can remove it
if it gets in your way.
![Page 17: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/17.jpg)
Insert Wires
• Drill six holes in the lens housing under
the pins
• Pass six wires through the holes
![Page 18: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/18.jpg)
Solder the Wires
• Make sure to keep track of which wire goes to which pin
• Make sure they are electrically connected using a circuit
tester For ease of soldering, we directly attached
wires on top of the pins, making the lens
unable to talk with a camera body any more.
We could instead solder wires to the lower
part of the pins, in which case the lens can
still be used as a normal lens.
or
![Page 19: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/19.jpg)
Reassemble
• Squeeze the wires into the lens housing
• Put the cover back with the screws
No need to put back
the two micro screws
for fixing the pins
![Page 20: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/20.jpg)
Tricks to Fit the Wires
• Cut out portions of the cover and housing
with nippers
To make room for the wired/soldered pins A few wires can be laid through this gap
![Page 21: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/21.jpg)
Tape the Pins
• To make sure that the lens is electrically
disconnected from the camera body
![Page 22: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/22.jpg)
Outline
• Overview & preparation
• Lens modification
• Wiring
• Software
• Putting them together
![Page 23: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/23.jpg)
Overall View of Wiring
Modified lens Hot shoe
Arduino
Battery
Power
Commands
Shutter
release
signal
USB cable from a computer
(code upload & power supply to Arduino)
![Page 24: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/24.jpg)
Hot Shoe Pin-out
• Shutter release can be detected from flash
trigger signal (FLA) at the hot shoe, which
can be used for synchronizing lens control
GND
FLA
The other four small pins
will not be used
![Page 25: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/25.jpg)
Attach Wires to the Hot Shoe
• Cut out a square piece of plastic with two
holes and insert in the hot shoe with wires
• Or just directly solder wires to the pins
Plastic piece
Two wires glued
Seen from
the bottom
Attached on
the hot shoe
![Page 26: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/26.jpg)
Arduino Pin Assignment
Hot shoe pins: D-GND CLK VDD DCL Lens pins: GND FLA
8
13 11
10 9
GND
![Page 27: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/27.jpg)
Full Schematic
VBAT
P-GND
D-GND
CLK VDD
DLC DCL
Arduino 6V battery GND
FLA
8
9
10 11 13 GND
![Page 28: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/28.jpg)
Outline
• Overview & preparation
• Lens modification
• Wiring
• Software
• Putting them together
![Page 29: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/29.jpg)
Arduino Code const int HotShoe_Pin = 8;
const int HotShoe_Gnd = 9;
const int LogicVDD_Pin = 10;
const int Cam2Lens_Pin = 11;
const int Clock_Pin = 13;
void setup() // initialization
{
pinMode(HotShoe_Pin, INPUT);
digitalWrite(HotShoe_Pin, HIGH);
pinMode(HotShoe_Gnd, OUTPUT);
digitalWrite(HotShoe_Gnd, LOW);
pinMode(LogicVDD_Pin, OUTPUT);
digitalWrite(LogicVDD_Pin, HIGH);
pinMode(Cam2Lens_Pin, OUTPUT);
pinMode(Clock_Pin, OUTPUT);
digitalWrite(Clock_Pin, HIGH);
delay(100);
send_signal(0x??);
delay(100);
send_signal(0x??);
}
void loop()
{
if(digitalRead(HotShoe_Pin) == LOW) // upon shutter release
{
send_signal(0x??); // move focus to infinity
delay(1000);
send_signal(0x??); // move focus back to nearest
delay(1000);
}
}
void send_signal(byte signal) // SPI command generator
{
unsigned int i;
for(i = 0; i < 16; i++)
{
digitalWrite(Clock_Pin, i & 1);
if(i % 2 == 0)
{
digitalWrite(Cam2Lens_Pin, (signal >> (i / 2)) & 1);
}
}
}
We are asked not to disclose the commands in public.
Please contact me to get the values shown as ??.
![Page 30: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/30.jpg)
Outline
• Overview & preparation
• Lens modification
• Wiring
• Software
• Putting them together
![Page 31: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/31.jpg)
Put Them Together
• Attach the modified lens to the camera body
• Connect the wires
• Turn on the camera
• Turn on the battery
• Turn on the Arduino
• Upload the code to the Arduino
– This step can be skipped from next time, as the code
stays on the board
• Press the shutter button
– The lens should move
![Page 32: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/32.jpg)
Make it Portable (optional)
• The 6V battery can also be used for supplying
power to the Arduino
Power
![Page 33: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/33.jpg)
Schematic for Portable Setting
VBAT
P-GND
D-GND
CLK VDD
DLC DCL
6V battery GND
FLA
Arduino 8
9
10 11 13 GND
GND Vin
![Page 34: move_lens](https://reader034.fdocuments.us/reader034/viewer/2022051120/55cf8d1d5503462b139231f6/html5/thumbnails/34.jpg)
Mount Everything
The rubber cover
can be ripped off
and the parts can
be screwed into
the camera body