DIY Motorized Moving Timelapse Camera Dolly With Arduino
by mastelios in Circuits > Cameras
136134 Views, 190 Favorites, 0 Comments
DIY Motorized Moving Timelapse Camera Dolly With Arduino
Slider
Camera Attachement
Electronics
arduino
an Adafruit Motor shield
a High Torque 15RPM 12V DC Geared Motor dc motor
a 3-step toggle switch for direction movement
a led toggle switch for main power
a pushbutton
2 reed switches for the stops
and some electronic components,relays etc.
At first I had a stepper motor I wanted to use but it draw way to much current for both the shield and the battery so I switched to the dc geared.It does the job great and draws way less current. It's coupled with a smooth hub pulley taken from an old photocopier and uses a smooth belt/string also from a photocopier,the scanner part.Its basically a metallic string covered in plastic.
For the motor shield I found the unused pins and soldered pins for ease of use and to be able to be removed and disconnected if needed.Plus the +5v and ground for switches and staff.
Connecting the Electronics
Top Cover
Software
So, when you flip the switch in one direction on the other and if the camera has not triggered the corresponding reed switch the camera starts moving and taking photos. If you press the button while moving,the camera starts moving fast,for debugging purposes. Also If you press the button while the 3-state toggle switch is in middle(-off) there is a panorama function. The possibilities of movements combining the servo and dc motor are endless.
#include <AFMotor.h>
#include <Servo.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(A3, A2); // RX, TX
AF_DCMotor motor(4); // create motor #4, 64KHz pwm
Servo servo;
int swDirFor=2; //forward button
int swDirBack=3; //Backward button
int swStopBeg=10; //stop1 button
int swStopEnd=A1; //stop2 button
int swPhoto=11; //sw relay for photo
int servoPin=9; //servopin
int steps=100; //step duration 1200 fotos
int servoPos=96; //middle position of servo
//int servoStart=20; //start position of servo
//int servoStop=155; //end position of servo
int servoPot=A0; //pin of servo pot
int noOfSteps=0; //count number of steps
int swFast=A5; //sw for fast movement
int i=0;//for loop
void setup() {
mySerial.begin(9600);
Serial.begin(9600); // set up Serial library at 9600 bps
servo.attach(servoPin); //servopin
motor.setSpeed(200); // set the speed to 200/255
pinMode(swDirFor,INPUT);
pinMode(swDirBack,INPUT);
pinMode(swStopBeg,INPUT);
pinMode(swStopEnd,INPUT);
pinMode(servoPin,OUTPUT);
pinMode(swPhoto,OUTPUT);
pinMode(servoPot,INPUT);
pinMode(swFast,INPUT);
digitalWrite(swPhoto,LOW);
servoMove(servoPos);
}
///////////////////////////////////////////////////////////////
void loop() {
if (mySerial.available()){
mySerial.write('a');
//mySerial.print("button stop end: ");
//mySerial.println(digitalRead(swStopEnd));
}
Serial.print("button state for: ");
Serial.println(digitalRead(swDirFor));
Serial.print("button state back: ");
Serial.println(digitalRead(swDirBack));
Serial.print("button stop Beg: ");
Serial.println(digitalRead(swStopBeg));
Serial.print("button stop end: ");
Serial.println(digitalRead(swStopEnd));
Serial.print("servo pot: ");
Serial.println(analogRead(servoPot));
Serial.print("Fast switch: ");
Serial.println(digitalRead(swFast));
servoPos=map(analogRead(servoPot), 0,1024,1,180);
servoMove(servoPos);
//forward movement
while ((digitalRead(swDirFor)==1)){
if (digitalRead(swStopEnd)==0){
Serial.println("BREAK stopEnd");
break;
}//if close
while (digitalRead(swFast)==1){
Serial.println("FF");
runMotor(0,1000);
}//while swFast close
noOfSteps ++;
runMotor(0,steps);
delay(750);//final delay(2k-1hour)
takeFoto();
} //while swDirFor)==1 close
//backward movement
while ((digitalRead(swDirBack)==1)){
if (digitalRead(swStopBeg)==0){
Serial.println("BREAK stopBeg");
break;
}//if close
while (digitalRead(swFast)==1){
Serial.println("FB");
runMotor(1,1000);
}//while swFast close
runMotor(1,steps);
// noOfSteps ++;
// servoMove(160);
delay(1000);//final delay
takeFoto();
} //while swDirBack)==1 close
//servo movement
if ((digitalRead(swFast)==1)){
Serial.println("mesa sto if");
servoMove(20);
delay(2000);//time to move servo to starting pos
for (i = 20 ; i <= 155 ; (i=i+27)){
//Serial.println("mesa sto for");
servoMove(i);
delay(2000);
takeFoto();
delay(100);
noOfSteps++;
}//for close
}//if close
delay(500);
Serial.print("steps: ");
Serial.println(noOfSteps);
}//loop close
// Routine for movement/////////////////////////////////////////
void runMotor(int dir,int steps){
switch (dir){
case 0:
Serial.println("Forward ");
motor.run(FORWARD); // turn it on going forward
delay(steps);
motor.run(RELEASE); // stopped
Serial.println("Stop Forward");
break;
case 1:
Serial.println("Backward");
motor.run(BACKWARD);
delay(steps);
motor.run(RELEASE);
Serial.println("Stop Backward");
break;
}//switch close
//delay (100);
}//runMotor close
//Routine foto//////////////////////////////////////////////////
void takeFoto(){
//delay (500);
Serial.print("CLICK!!! ");
digitalWrite(swPhoto,HIGH);
delay(1500);
digitalWrite(swPhoto,LOW);
}//takeFoto close
//Routine servo//////////////////////////////////////////////////
void servoMove(int pos){
servo.write(pos); // tell servo to go to position in variable 'pos'
Serial.print("servo move to: ");
Serial.println(pos);
delay(150); // waits 15ms for the servo to reach the position
}//servo close
First Tries and Todo
Moving sea.Not the best choice
Back yard nature
I also have a to-do list. Attaching a Metal ball head and some kind of way to attach tripods on both sides.
I hope you have enjoyed this instructable and thanks for reading..