Skip to content

10. Mechanical Design

This week, my team and I were to design and create a machine that includes mechanism+actuation+automation. With that said, we agreed to create a camera slider inspired by DIY Motorized Camera Slider with Pan and Tilt Head and Arduino Bluetooth Motorized Camera Slider. The latter video is from past fab lab participants - Team Page. You can find our team documentation and project here - Link

I was in charge of programming the slider to move horizontally, rotate, pan, and tilt. However, due to some shipping issues of the materials that would allow for horizontally movement, our goal switched to programming our mechanism to rotate and tilt the camera.

The journey started with understadning how to program an Arduino Uno board that we purchased from Amazon -3D Printer CNC Controller Kit with for ArduinoIDE. My teammate, Nicholas Anastasia, was a great help in getting started with programming. We were able to get the board to communicate with the stepping motor by using the following example code from the Arduino IDE:

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(60);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(500);

  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(500);
}

From here, I needed to do some tweaking in order for the stepping motor to move our mechanic. I was able to find an example of a stepper motor rotating fully and reverting back to its position - Stepper One Revolution. Tweaking the code resulted in the following:

#include <Stepper.h>

const int rotateStepsPerRevolution = 200;  // change this to fit the number of steps per revolution for your motor
const int tiltStepsPerRevolution = 200; 
# define ENABLE_PIN = 8

Stepper rotate(rotateStepsPerRevolution, 4,7); // initialize the stepper library on pins 4 and 7
Stepper tilt(tiltStepsPerRevolution, 2,5); // initialize the stepper library on pins 2 and 5

void setup() {
  pinMode(ENABLE_PIN, OUTPUT);
  digitalWrite(ENABLE_PIN, LOW);
  rotate.setSpeed(30);   // set the speed at 30 rpm:
  tilt.setSpeed(25); // set the speed at 25 rpm;

  Serial.begin(9600);  // initialize the serial port:
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  rotate.step(rotateStepsPerRevolution);
  tilt.step(tiltStepsPerRevolution);
  delay(500);

  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  rotate.step(-rotateStepsPerRevolution);
  tilt.step(-tiltStepsPerRevolution);
  delay(500);
}

The above code would allow the stepper to rotate the camera clockwise and, after a full rotation, rotate the camera counter-clockwise. When I went to test the code, my computer experience an issue and died. When attepting to turn on the computer, the computer would not turn on. As a result, I contacted my teammate, Nicholas Anastasia, to request that he continue the code as I fix my computer. I was unavailable to continue programming and left the remainder of the programming to Nicholas Anastasia. You can find the documentation to Nicholas Anastasia experience here - Link


Last update: April 23, 2021