Introduction: Arduino Tb.shield (3 Axis Timelapse Motion Control)
I love timelapse photography.
Two years ago, driven by a good friend of mine i decided to give it a try on timelapse photography. I had a DSLR camera but didn’t had an intervalometer, so i assembled a small electronic circuit on top of an Arduino Uno, made some basic code and did my first timelapse movie. The result was awful, but for some reason I was hooked.
Since that day I have never stopped looking for ways to evolve. I studied and tried various techniques until i got better. But, as i got better i felt something was missing. Yes, you guessed it, i needed motion control to give my timelapse movies a cinematographic feel. So, i did a market research and found out that there were great timelapse motion control devices for sell, but all of them were to expensive for me. Well, the next step had become clear to me, i was going to make my own 3 axis timelapse motion control system.
Step 1: Drawing the Schematics.
Use an electronic design software and draw the following schematic.If the scheme is not clearly visible please download the pdf file.
Attachments
Step 2: PCB
Draw the PCB layout. If the picture is not clearly visible please download the pdf file.
Step 3: Gerber Files
Most of the electronic design softwares available will provide the ability to automatically generate the necessary gerber files to manufacture the PCB´s. If you don´t have one you can download the gerber files here: Gerber files.
Step 4: First Test – Controlling Skywatcher Virtuoso Mount
What you´ll need:
- 1 x RJ11 connector
- 2 x 220 Ohm Resistor
- 2 x 8 pin Arduino Stackable Header, 1 x 6 pin Arduino Stackable Header and 1 x 10 pin Arduino Stackable Header
- 1 x Comunication Cable
- 1 x tb.shield PCB
- 1 x Virtuoso Mount
Panohead Library: download here - panohead library.
The code: download here - panohead_test.
# include
# include
void setup() {
panohead.init();
}
void loop() {
long lngPositionPitch = 0;
long lngPositionYaw = 0;
//Read current position
lngPositionPitch = panohead.readAxisPosition(PANOH_AXIS_PITCH);
lngPositionYaw = panohead.readAxisPosition(PANOH_AXIS_YAW);
lngPositionPitch = lngPositionPitch + panohead.fromAngle(20.0);
lngPositionYaw = lngPositionYaw + panohead.fromAngle(20.0);
// 20 degrees motion in both axis
panohead.driveToPositionBothAxis(lngPositionYaw, lngPositionPitch);
delay(20000);
lngPositionPitch = panohead.readAxisPosition(PANOH_AXIS_PITCH);
lngPositionYaw = panohead.readAxisPosition(PANOH_AXIS_YAW);
lngPositionPitch = lngPositionPitch + panohead.fromAngle(-20.0);
lngPositionYaw = lngPositionYaw + panohead.fromAngle(-20.0);
// 20 degrees motion in both axis in the opposite direction
panohead.driveToPositionBothAxis(lngPositionYaw, lngPositionPitch);
delay(20000);
}
Now we just have to solder the RJ11 (U5 on PCB), the two 220 Ohm Resistor (R7 and R8 on PCB) and the stackable headers in the right places, connect everything and upload the code to the Arduino Board. The Virtuoso Mount should move the two axis 20 degrees in one direction and after 20 sec in the other one.
Step 5: Second Test - Controlling Camera Shutter
What you´ll need:
- 1 x tb.shield
- 1 x 3.5mm stereo audio jack
- 2 x optocoupler 4N25
- 2 x 330 Ohm Resistor
- 1 x release shutter cable
The code: download here – shutter test.
# define PIN_FOCUS 6 // focus
# define PIN_SHUTTER 9 // shutter
void setup(){
pinMode(PIN_FOCUS, OUTPUT);
pinMode(PIN_SHUTTER, OUTPUT);
}
void loop(){
digitalWrite(PIN_FOCUS, HIGH);
delay(100);
digitalWrite(PIN_SHUTTER, HIGH);
delay(100);
digitalWrite(PIN_FOCUS, LOW);
digitalWrite(PIN_SHUTTER, LOW);
delay(4800);
}
Now you just have to solder the 3.5mm stereo audio jack (U4 on PCB), the two optocouplers 4N25 (U2 and U3 on PCB) and the two 330 Ohm Resistors (R5 and R6 on PCB) in the right places, connect the camera to the 3.5mm stereo audio jack on the tb.shield and upload the code to the Arduino Board. The camera shutter should trigger every 5 sec.
Step 6: Third Test - Controlling Motors
What you´ll need:
- 1 x tb.shield
- 1 x L298P
- 8 x diode 4004
- 4 x 10k Ohm Resistor
- 4 x 5mm led
- 3 x 2 pin screw connector
- 1 x DC Motor
- 1 x 9v battery adapter
- 1 x 9v battery
The code for motor 1: download here - motor1 test.
# define PIN_M1_DIRECTION_FW 2 // m1 forward
# define PIN_M1_DIRECTION_RV 4 // m1 reverse
# define PIN_M1_SPEED 3 // m1 speed
void setup(){
pinMode(PIN_M1_DIRECTION_FW, OUTPUT);
pinMode(PIN_M1_DIRECTION_RV, OUTPUT);
pinMode(define PIN_M1_SPEED, OUTPUT);
}
void loop(){
analogWrite(PIN_M1_SPEED, 255);
digitalWrite(PIN_M1_DIRECTION_FW, HIGH);
digitalWrite(PIN_M1_DIRECTION_RV, LOW);
delay(5000);
digitalWrite(PIN_M1_DIRECTION_FW, LOW);
digitalWrite(PIN_M1_DIRECTION_RV, LOW);
delay(5000);
digitalWrite(PIN_M1_DIRECTION_FW, LOW);
digitalWrite(PIN_M1_DIRECTION_RV, HIGH);
delay(5000);
digitalWrite(PIN_M1_DIRECTION_FW, LOW);
digitalWrite(PIN_M1_DIRECTION_RV, LOW);
delay(5000);
}
The code for motor 1: download here - motor2 test.
# define PIN_M1_DIRECTION_FW 7 // m1 forward
# define PIN_M1_DIRECTION_RV 8 // m1 reverse
# define PIN_M1_SPEED 5 // m1 speed
void setup(){
pinMode(PIN_M1_DIRECTION_FW, OUTPUT);
pinMode(PIN_M1_DIRECTION_RV, OUTPUT);
pinMode(define PIN_M1_SPEED, OUTPUT);
}
void loop(){
analogWrite(PIN_M1_SPEED, 255);
digitalWrite(PIN_M1_DIRECTION_FW, HIGH);
digitalWrite(PIN_M1_DIRECTION_RV, LOW);
delay(5000);
digitalWrite(PIN_M1_DIRECTION_FW, LOW);
digitalWrite(PIN_M1_DIRECTION_RV, LOW);
delay(5000);
digitalWrite(PIN_M1_DIRECTION_FW, LOW);
digitalWrite(PIN_M1_DIRECTION_RV, HIGH);
delay(5000);
digitalWrite(PIN_M1_DIRECTION_FW, LOW);
digitalWrite(PIN_M1_DIRECTION_RV, LOW);
delay(5000);
}
Now you just have to solder the L298P C.I. (U1 on PCB), the 8 diodes 4004 (D1 to D8 on PCB), the 4 10k Ohm Resistor (R1 to R4 on PCB), the 4 5mm leds (L1 to L4 on PCB) and the 3 x 2 pin screw connector (VS, MOTOR and MOTOR_1 on PCB) in the right places, connect everything and upload the code to the Arduino Board.
Step 7: Make Amazing Timelapse Films.
Now its time to make use of your fully assembled tb.shield and start making amazing timelapse movies. I hope you enjoyed this instructable.I´ll keep it updated. Feel free to comment.
Have fun,
Patrício