i learned to photograph about 4 years ago and since then i was thinking of how to control my camera movement's and making automation system for routine actions
then i found a blog about a diy camera slider so i started making it last summer in quarantine i made some progress but got stuck because power source was big and the wiring was a mess, and couldn't make other axis like tilt and pan , plus i had no experience or knowledge at all for coding, and couldn't find bearing system robust to support tilt and pan movement ,also i wanted to add an interface like an LCD or mobile app and to make it battery power operated to make it mobile and easy to carry anywhere.
so i choosed a new project with some kind close similarity to the slider
i choosed to Make a 360 Turntable for product photography and maybe add photogrammetry system "if i got it working :D" since i also love 3d modeling and sculpting ,
the project main features can be separated into two parts the rotating turntable and the controlling unit box
so for the table itself wanted to make it closed cylindrical box at first but thought of time consumption for printing and although it will take a lot of material to make it the size i wanted to be, which is 30cm approximately wide , so i choosed 3mm plywood and laser cutting then i scketched some lines to think about what will be in place and relations to other component
then up to the modeling :D i used fusion for sketching and then extruded some surfaces (sketches) and assembled them together with joints, then i added electronic components to think how they will be mounted together
for the main constructer of the table and its base i used 8cm tall screws with 8mm diameter and nuts
for the control box i firstly imported all components i decided to use into fuison360, i used GrabCade and MCmaster to find all components.
after that i arranged them to know what is a good size for the box
then i drew the sketches and i used T-slots for final assembly of the box itself
then i projected components openings and screws for final assembly
after finishing i exported all final sketches DXF for getting ready to laser cutting
i arranged all parts in illustrator and add some stuff there too like the led openings
for fabricating on laser i used laser work software to arrange files and setting up power and speed for the laser machine i then uploaded files and waited i used approximately 3 of 30x50 cm rectangular sheets
then i started assembling plywood parts and made sure it all fits
i made a prototype before the final one since i was limited on the material i got and was limited on time too
for deciding motor mounting place
firstly i wanted to make it simple and mount it in the center but since i wanted to make the table rotate for 360 video "smooth move" i decided to make an alternative place on the edge and make a gearing system that maximize numbers of steps for better smooth move
i made a special mounting system :D
since i didnt get the bearings before i start i made the motor mount that can be raised with wooden laser cut spacers :D
now it all went perfect, :D
up to the hard stuff we goooo
the electrical components i used :
Nema 17 stepper motor + jumper wire cable >> output
stepper driver a4988 + Expansion Board module
16x2 i2c LCD Screen >> output
rotary encoder module >> input
on off switch
mini breadboard
5mm IR infrared LED (Transmitter Diode) >> output
5mm LED s (green and red) for indicating status >> output
a lot of Jumper Wire (male to male , and male to female )
Arduino UNO
and some 330ohm resistors basically for the LEDs
here is how i made connections but i couldn't find the stepper driver a4988 which im using but its the same principles
i didn't think enough of cable management or cable place its a mess i know
i started to connect each component firstly to Test it separately then assembled
i2c LCD wiring pin diagram
Stepper motor expansion board
wiring pin diagram
the Rotary encoder
wiring pin diagram
i used 9V 2amps power supply because stepper motor nema 17
Current: 1.2A at 4V
its cool and easy website i just dragged the component and it gives you suggestions how to connect them "i'm not cheating :D"
i tested every and each component alone
with code in separate
at first the code begins with some declarations and definition to libraries and other variables used
const int stepPin = 6;
const int dirPin = 7;
void setup() {
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
digitalWrite(dirPin,LOW); // direction
for(int x = 0; x < 1000; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(350);
digitalWrite(stepPin,LOW);
delayMicroseconds(350);
}
delay(500);
}
#define clk 2
#define data 3
int counter = 0;
int State;
int LastState;
void setup() {
//Define the pins as inputs
pinMode (clk,INPUT);
pinMode (data,INPUT);
Serial.begin (9600); //Start serial com so we could print the value on the serial monitor
// Reads the initial state of the clock pin
LastState = digitalRead(clk);
}
void loop() {
State = digitalRead(clk); // Reads the "current" state of the clock pin
// If the previous and the current state of the clock are different, that means a step has occured
if (State != LastState){
// If the data state is different to the clock state, that means the encoder is rotating clockwise
if (digitalRead(data) != State) {
counter ++;
} else {
counter --;
}
Serial.print("Position: ");
Serial.println(counter);
}
LastState = State; // Updates the previous state of the clock with the current state
}
so i found that i have to make an array and call one of them with the counter from the encoder like the numeric keyboard example we had before
i made
char MenuLine[4][20] = {" 360 Video ", " Clk&Rotate ", " option 3 "};
int CursorLine = 0;
and in the loop i called the CursorLine with the counter of the encoder to shuffle through the MenuLine array
and i made a selection function if pressing the button takes the CursorLine number and put the correspond
void selection()
{switch (CursorLine) {
case 0:
lcd.print(" Clk&Rotate ");
Serial.println(" Clk&Rotate ");
rotate_clik_IR();
break;
case 1:
lcd.print(" 360 Video ");
Serial.println(" 360 Video ");
rotate_video();
break;
case 2:
lcd.print("Option 3");
Serial.println(" 3 Selected");
i added a function for rotating the motor and called it from the selection menu
void rotate_video() { // rotates the shaft full cycle
digitalWrite(dirPin, HIGH); // LOW for CCW , HIGH for CW direction
for (int x = 0; x < 200; x++) { // 200 step for full rotation of the shaft
digitalWrite(stepPin, HIGH);
delay(5); // Speed
digitalWrite(stepPin, LOW);
delay(5);// Speed
}
}
rotate_clik_IR(); // rotates the shaft no of steps and then call another function for the IR shutter in it
void rotate_clik_IR() {
digitalWrite(dirPin, HIGH);
Serial.println(" shot 1");
// IR function here <<<<<
for (int x = 0; x < 50; x++) { // 50 for 1/4 rotation of the motor
digitalWrite(stepPin, HIGH);
delayMicroseconds(3000); // Speed
digitalWrite(stepPin, LOW);
delayMicroseconds(3000);// Speed
}
i searched and found a ir library which have builtin functions and found the one needed for my camera brand
ir code void sonyShutter() {
for (int i = 0; i < 3; i++)
{
irsend.sendSony(740239, 20); // specifically for sony and the code is for shutter release
digitalWrite(redLED, HIGH); // just an indicator
digitalWrite(greenLED, HIGH); // just an indicator
delay(40);
digitalWrite(redLED, LOW); // just an indicator
digitalWrite(greenLED, LOW); // just an indicator
}
}
at first the code begins with some declarations and definition to libraries and other variables used
Void Setup<< where code play only once at the beginning only
here i declared output and input pin and power on the lcd and its backlight also i added
welcome screen
Void Loop
it basicaly work with the encoder and shuffle through an array and select it
next i add the actions after selection each in a separate function and called them all back each in its place
testing motor
testing rotary encoder plus rolling in array :D for menu system
adding action component when pressing the rotary button
when i was alone coding i usually search google but my group instructors Menna & Mohannad was so helpful , and thanks Saed for making my ir infra led work
i paused many time for coding i didn't know how encoder works and how to make a menu system for choosing within
im stuck now at making a submenu within the first choice or the first array
the code just exits to the main menu every time :S
if i hade more time i would
print a knop for the rotary encoder
make a 3dprinted gearing system
add submenu and make a user input in it
controlling over Bluetooth with GUI smartphone or a pc