


I'm a DSLR video hobbyist and wanted to motorize this 7ft slider I built with Rig Wheels
http://www.rigwheels.com/ and box track.
I used the Arduino mega and motor shield from radio shack, along with a potentiometer and switch to control the speed and direction of the servo. I modified the servo to rotate continuously by removing the control board and plastic tab on the gear that makes it stop.
Here's a video that shows how the project works:
http://youtu.be/T3kRqQmtkjYHere's some sample video with some shots with the slider:
https://vimeo.com/37225344And here's the sketch that makes it all work:
//This program controls the speed of the servo with a potentiometer
int potpin = A0; // Analog input 0 is used for the potentiometer
int val;
int dirA = 12; // Sets pin on motor shield for direction
int dirB = 13; // not used in this example
int speedA = 3; // sets pin on motor shield for speed
int speedB = 11; // not used in this example
int buttonPin = A5; // sets pin for switch used for direction change
void setup()
{
pinMode (dirA, OUTPUT);
pinMode (dirB, OUTPUT);
pinMode (speedA, OUTPUT);
pinMode (speedB, OUTPUT);
pinMode (potpin, INPUT);
pinMode (buttonPin, INPUT);
digitalWrite (buttonPin, HIGH); // Turns on pull-up resistor after input
}
void loop()
{
while(digitalRead(buttonPin) == LOW) //when pin goes LOW
{
val = analogRead(potpin); // read the value from the potentiometer
digitalWrite (dirA, HIGH); // servo forward
analogWrite (speedA, val); // Set the speed of the motor to the value of the potentiometer
}
val = analogRead(potpin); // read the value from the potentiometer
digitalWrite (dirA, LOW); // Servo Backward
analogWrite (speedA, val); // Set the speed of the motor to the value of the potentiometer
}