A Camera Slider

Discussion in 'The Completed Projects Collection' started by SPQR, Oct 21, 2012.

  1. SPQR

    Thread Starter Member

    Nov 4, 2011
    Warning! Warning! Will Robinson! SPQR is a neophyte!! :D

    I present this camera slider project for comments (took me about a year, but I've learned a ton!).
    And I thank those of you who helped me with my previous questions on the forum!

    1" Aluminum square tube - local metal supplier
    "T"s and elbows - Lowes
    Tripods - Amazon
    Screws, bolts, nuts - Lowes, Fastenal
    Acrylic - Lowes
    1/2" Aluminum angle - Lowes
    Ball bearings, 1/2" rod, rod stands, linear bearings - www.VXB.com
    Nylon standoffs and screws - www.non-ferrousfastener.com
    Camera holder - Amazon
    Antivibration material - Sorbothane - www.amazon.com
    Pulleys, belt - www.polytechdesign.com



    Arduino Uno - Sparkfun
    Arduino Protoshield - Adafruit
    Stepper motor - Vexta PK266-02A - www.interinar.com
    Interinar Stepper Controller - BSD-02LH - www.interinar.com
    Connectors, headers - Sparkfun, All Electronics, Adafruit
    Wire - All Electronics, Jameco, Sparkfun
    Power Supply - FS-15024 - Interinar
    Absolute Binary Rotary Encoder - Parallax
    Micro switches - Adafruit
    7809 (9V regulator), 74HC14 (Schmitt trigger), 10K resistor NET, 10μF 16V tantalum capacitors - Jameco

    Pictures of the box are attached.

    The schematics are attached (One with Fritzing, another with PowerPoint, and a third with PowerPoint of the hardward debouncing only).

    Code ( (Unknown Language)):
    2. ///////////////////////////////////////////////////////////////////
    3. // Camera Slider code
    4. // The Interinar controller should be set at "full step"
    5. // because it makes less noise
    6. ////////////////////////////////////////////////////////////////
    8. const int Encoder_PIN_1 = 2;
    9. const int Encoder_PIN_2 = 3;
    10. const int Encoder_PIN_3 = 4;
    11. const int Encoder_PIN_4 = 5;
    13. const int Forward_PIN = 6;
    14. const int Back_PIN = 8;
    15. const int Stop_PIN = 7;
    16. const int Origin_PIN = 10;
    17. const int End_PIN = 9;
    19. const int STEP_PIN = 11;
    20. const int Enable_PIN = 12;
    21. const int DIR_PIN = 13;
    23. int RotationSpeed;
    24. int Stop;
    25. int Forward;
    26. int Back;
    27. int Origin;
    28. int End;
    30. void setup()
    31. {
    32.    pinMode(STEP_PIN, OUTPUT);
    33.    pinMode(Enable_PIN, OUTPUT);
    34.    pinMode(DIR_PIN, OUTPUT);
    35.    pinMode(Encoder_PIN_1, INPUT);
    36.    pinMode(Encoder_PIN_2, INPUT);
    37.    pinMode(Encoder_PIN_3, INPUT);
    38.    pinMode(Encoder_PIN_4, INPUT);
    39.    pinMode(Forward_PIN, INPUT);
    40.    pinMode(Back_PIN, INPUT);
    41.    pinMode(Stop_PIN, INPUT);
    42.    pinMode(Origin_PIN, INPUT);
    43.    pinMode(End_PIN, INPUT);
    44.    digitalWrite(Enable_PIN, HIGH); //When device turned on, stepper is off
    45.    digitalWrite(DIR_PIN, HIGH);
    46. }
    48. void loop()
    49. {
    50.    Stop = digitalRead(Stop_PIN);
    51.    if (Stop == HIGH) {digitalWrite(Enable_PIN, HIGH);}
    53.    Forward = digitalRead(Forward_PIN);
    54.    if (Forward == HIGH) {digitalWrite(Enable_PIN, LOW);
    55.       digitalWrite(DIR_PIN, HIGH);}
    57.    Back = digitalRead(Back_PIN);
    58.    if (Back == HIGH) {digitalWrite(Enable_PIN, LOW);
    59.       digitalWrite(DIR_PIN, LOW);}
    61.    Origin = digitalRead(Origin_PIN);
    62.    if (Origin == HIGH)
    63.       {
    64.           digitalWrite(Enable_PIN, LOW);
    65.           digitalWrite(DIR_PIN, HIGH);
    66.        }
    68.    End = digitalRead(End_PIN);
    69.    if (End == HIGH)
    70.       {
    71.          digitalWrite(Enable_PIN, LOW);
    72.          digitalWrite(DIR_PIN, LOW);
    73.        }
    75.    int Pin1 = digitalRead(Encoder_PIN_1);
    76.    int Pin2 = digitalRead(Encoder_PIN_2);
    77.    int Pin3 = digitalRead(Encoder_PIN_3);
    78.    int Pin4 = digitalRead(Encoder_PIN_4);
    80.    //The following formula was empirically derived
    81.    //If the dial is set to "zero" the lowest speed is 210 (interval between   pulses)
    82.    //If the dial is set to "16" the highest speed is 60
    83.    RotationSpeed = 220 - (10 * (1 + ( (Pin1*8) + (Pin2*4) + (Pin3*2) + Pin4) ) );
    85.    //RotationSpeed = 300; //use this line for testing and comment out the line above
    87.    for (int i=0; i < 100; i++)
    88.       {
    89.          digitalWrite(STEP_PIN, HIGH);
    90.          delayMicroseconds(RotationSpeed);
    91.          digitalWrite(STEP_PIN, LOW);
    92.          delayMicroseconds(RotationSpeed);
    93.        }
    94. }
    Lessons Learned / Comments
    1. Build the hardware first. Before the use of a belt and pulleys, I used an Acme threaded rod. It sounded like a brass band. NOISY!

    2. The belt and pullies were much better, but because of the long pieces of aluminum, they tended to resonate, so I "padded" the motor with Sorbothane - fantastic material!

    3. The final "quieting" step was changing the stepping. Though 1/8th step on a stepper gives more torque, it also makes a lot of noise - stick with full step if you can.

    4. Use as many connectors as you can (I need to learn more about connectors). In future, I'll even be adding a connector very close to the stepper to allow quick changeouts.

    5. The initial version had all the non-Arduino electronics on a perfboard. It was UGLY. So I learned to use a protoboard whenever possible with Arduino projects.

    6. After "finishing" my early version, I noted that the it used to go back and forth for no reason. I turned on the serial port in Arduino as a debugger, and programmed some observation bits, finding random "1"'s popping up when there should have been only "0"s. I thought about software debouncing. Then, while googling, I found the phrase "hardware debouncing" and it changed everything! A capacitor, resistor and a Schmitt trigger for every switch made it work right. I'll use hardware debouncing for every switch in future projects.

    7. I was going to use a grey code encoder, but the programming looked like a large project, so I found the Parallax Absolute Binary Encoder. It's been taken off the market (not sure why), so I'll work on learning how to program a grey code knob.

    8. The little bearings for the pulley on the distal end work very nice.

    9. I HATE working with acrylic. The "glue" at Lowes doesn't hold worth beans, so I added those 1/2" aluminum angles throughout for strength. The acrylic I chose is too thin.

    10. I used a 7809 regulator, only because I know the 78XX series from many moons ago. I'm sure there is something better now.

    11. If I had a TIG welder, I probably would have welded the frame together (I only have a MIG).

    12. Had a tough time finding the screws for the micro-switches. If anyone is interested, they are #2 machine screws.

    13. For those who have never cut aluminum, thin-walled stuff cuts fine on a carbide wood saw.

    14. You can have NO GAP in the two DB-9 connectors, otherwise you will have a bad connection. Initially, I put the acrylic between the two connectors, but it was a disaster. Had to move the internal DB-9 to outside, then it worked fine.

    15. The linear bearings occasionally need a bit of WD40.

    16. Initially, I planned to use one of those 9V plug connectors for power to the Arduino, then by chance I saw the "Vcc" input terminal on the board, and used it instead.

    Link to YouTube video

    I have a total of 379 questions for you, but I'll not be a boor, and ask just four:

    Questions for the Experts

    1 - How do the experts make their "containers" for projects? Is there a place to buy them pre-made?

    2 - Is there a treatise I can read on connectors? Which connectors to use, and where?

    3 - How do I select the guage of wire for different parts of projects, and when do I use solid vs stranded?

    4 - Do you consider the use of "headers" and "pins" part of a final product? Or should everything be soldered to a board?

    I await your comments...
    Last edited: Oct 21, 2012
    Metalmann likes this.
  2. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    Have you have mistakenly swapped full step and 8th step in this sentence?

    Normally with stepper motors full step makes many times more resonant energy than 8th stepping, so microstepping (ie 8th or 16th) is a must for getting smooth motion.

    And nice project! :)
  3. SPQR

    Thread Starter Member

    Nov 4, 2011
    Thanks very much!

    Hmmmm...let me check...bang! bang!..*&$)(#...rumble...%%...Pow!!!...)&$*#(!!!

    There are two jacks on the controller that control the step mode (J5, J6).
    I had both of them connected and it made noise like crazy.
    I then pulled them off, and it became very quiet, but the programming had to be redone for shorter pulses (decreased from 2,000 to 300).

    But looking at the diagram of the controller it seems that the "default" (without the jumpers) is 1/8th step...
    so you are right...it's the other way around!!!!

    ON ON = full step
    OFF OFF = Eighth step (default)

    Thanks very very much again! (you helped me with one of my prior questions) :)
    Last edited: Oct 21, 2012
  4. BSomer


    Dec 28, 2011
    I always use stranded wire because I like the flexibility. If you have something that may have vibrations or movement, it is best to use stranded because solid core wire can become brittle and break at your connection points. As for the size, it depends greatly on the current going through it. For general small signal/communication stuff I go with 20 - 24 AWG, which is something I have plenty of laying around. If your current draw is less than 5A, 18 AWG is sufficient. Anything higher than 5A I may actually go through some calculations to ensure a reliable wire size.

    Simple answer, yes. I generally prefer using ones that actually have some sort of retention mechanism to prevent accidental removal. Something like this works pretty good.

    Your project looks good. What do you plan on using it for? I watched the video and understand what it does, but cannot think of too many applications for it other than some sort of studio work or something.
  5. SPQR

    Thread Starter Member

    Nov 4, 2011
    Thanks for the excellent comments!

    Interesting ideas about the wire type and size...I'll try to switch to all stranded whenever possible.

    May philosophy of life is "If 22 gauge is good, 10 gauge is better!":D, so I'll stick with 22-24 guage for TTL hookups.

    I've learned a lot regarding connectors on this project. In future, I'll use more of the type that you reference - they are clearly more sturdy than headers, and yet I can remove them at any time.

    The slider is actually for a friend. He does photography for use in training videos and websites he develops.

    In video, you use it for nice effects of simple movement. HERE is a link to a video in Youtube that uses it.

    Also, you can use it for time lapse photography with a still camera (computer controlled shutter release). HERE is another YouTube video.

    Again, thanks very much for the response.
  6. MMcLaren

    Well-Known Member

    Feb 14, 2010
    May I ask about the encoder, please? Do you have a link to the datasheet? Are you simply using it as a speed control?

    Regards, Mike
  7. SPQR

    Thread Starter Member

    Nov 4, 2011
    Yes, it's only a speed control.
    As I mentioned, I didn't want to add a huge section for grey coding, so I found it at Parallax (they don't make it anymore), but I also found some others, I think at Jameco.

    Here is the datasheet.

    It's easy, because you can just read the 1's and 0's into the Arduino, link them together, then convert them to a hexadecimal equivalent.

    I can change two numbers in one line of code and change the "range" of speed and the "maximum" speed.
  8. d'Arsonval

    New Member

    Nov 8, 2012
    This project caught my attention. I like it.
    For those wondering, or asking the builder "What is it's purpose?"... Wellllll.....
    (To the builder, reply as best you can ; )
    To the rest of us... it's a very functional piece of equipment.
    And... can/could be altered to meet one's needs.

    Good Job!

  9. hariseldon

    New Member

    Jun 29, 2013
    Impressive... how did you make the belt?
  10. pritch84

    New Member

    Feb 8, 2015
    Is it possible, a person with basic electronic knowledge who is able to follow instructions could re-produce this?