Skip to content

Instantly share code, notes, and snippets.

@Electronza
Created December 13, 2019 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Electronza/cdc38f31d91226b29eb6cf6ee3656b66 to your computer and use it in GitHub Desktop.
Save Electronza/cdc38f31d91226b29eb6cf6ee3656b66 to your computer and use it in GitHub Desktop.
Arduino rotating photo table
/*******************************************************************
____ __ ____ ___ ____ ____ __ __ _ ____ __
( __)( ) ( __)/ __)(_ _)( _ \ / \ ( ( \(__ ) / _\
) _) / (_/\ ) _)( (__ )( ) /( O )/ / / _/ / \
(____)\____/(____)\___) (__) (__\_) \__/ \_)__)(____)\_/\_/
Project name: Arduino rotating photo table
Project page: https://electronza.com/arduino-rotating-photo-table/
********************************************************************/
// stepper motor configuration, stepper click in slot #1
int dirPin = 10;
int stepperPin = 6;
int MS1 = 14;
int MS2 = 17;
// relay configuration; relay click is in slot #2
int relayPin = 5;
int i; // required for the loop
void setup() {
pinMode(dirPin, OUTPUT);
pinMode(stepperPin, OUTPUT);
pinMode(relayPin, OUTPUT);
pinMode(MS1, OUTPUT);
pinMode(MS2, OUTPUT);
delay(5000); // wait for 5 seconds before stating the routine
}
// stepper motor routine
void step(boolean dir,int steps){
digitalWrite(dirPin,dir);
delay(50);
for(int i=0;i<steps;i++){
digitalWrite(stepperPin, HIGH);
// adjust the delays according to the motor you use
// some motors have a high inertia, and require a longer "low" delay
delayMicroseconds(250);
digitalWrite(stepperPin, LOW);
// you can adjust this delay to increase the time
// between steps, for a smoother movement
delayMicroseconds(750);
// with the above delaysd each step is made in 1 sec
}
}
void loop(){
// 1/4 step mode
digitalWrite(MS1, HIGH);
digitalWrite(MS2, HIGH);
delay(1000);
// i gives the number of pictures
for (int i = 1; i < 21; i++) {
// 200 steps per revolution
// 20 pictures, 200 / 20 = 10 steps
// with 8 microsteps we have 10 * 8 = 800 pulses to make this rotation
step(true,8);
delay(500); // time for the platform to stabilize
digitalWrite(relayPin, HIGH);
delay(200); // time to keep shutter pressed
digitalWrite(relayPin, LOW);
delay(2000); // increase if you need a longer exposure time
// delay(5000); // increase if longer exposure time
}
while(1); // stay here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment