Arduino based Automatic Programmable Turn-table

Arduino based Automatic Programmable Turn-table

Automatic Programmable Turn-table

It is often very useful to automate 3D scanning or 360 degree photography of objects. A programmable turn-table comes in mind in such cases where it can be programmed to rotate as required with minimal human intervention. So, this article is about building an automatic programmable turn-table based on Arduino Uno.

Hardware

Materials required
  • Wooden Base
  • Rotating Wooden Platform
  • Bearing
  • Aluminium Faceplate
  • Arduino Uno
  • Polulu A4988 driver
  • 16X2 LCD
  • Stepper Motor NEMA17 4.2kgf cm with GT2 pulley and belt
  • Regulated Power Supply 12V, 1A
  • Wires
  • Screws
Turn-table Outside
View of the turn-table from outside.
Turn-table Inside
View of the turn-table from inside.

Software

The software part consists of the Arduino Program below that uses the serial communication with the computer. The command it accepts is MT (amt) where (amt) is the number of steps of the stepper motor accepting both positive and negative values.
I have used KinectCapture software to capture Kinect images and control the turn-table simultaneously. It has the feature to programmatically do this.

#include <String.h>
#include <LiquidCrystal.h>
#define stp_step 4
#define stp_dir 5
#define stp_ena 6
#define lcd_rs 12
#define lcd_ena 11
#define lcd_d4 7
#define lcd_d5 8
#define lcd_d6 9
#define lcd_d7 10
#define srl_bdrate 9600
String curr_command;
int val = 0;
LiquidCrystal lcd(lcd_rs, lcd_ena, lcd_d4, lcd_d5, lcd_d6, lcd_d7);
 
void setup()
{
    pinMode(stp_ena,OUTPUT);
    digitalWrite(stp_ena,HIGH);
 
    lcd.begin(16,2);
    lcd.noCursor();
    lcd.clear();
 
    lcd.setCursor(0,0);
    lcd.print(" SMH Turn-table ");
    lcd.setCursor(0,1);
    lcd.print("  Auto-Capture  ");
 
    Serial.begin(srl_bdrate);
 
    pinMode(stp_step,OUTPUT); 
    pinMode(stp_dir,OUTPUT);
    digitalWrite(stp_ena,LOW);
 
    delay(1000);
    lcd.setCursor(0,1);
    lcd.print("Waiting...      ");
    ready = 1;
}
 
void parseline()
{
    char val_str[16];
    val = 0;
    if(curr_command[0]=='M'&&curr_command[1]=='T')
    {
        int i = 3;
        do
        {
            val_str[i-3] = curr_command[i];
            ++i;
        }
        while(curr_command[i]!='\n');
        val = atoi(val_str);
    }
}
 
void loop()
{
    if(Serial.available()>0)
    {
        curr_command = Serial.readString();
        lcd.setCursor(0,1);
        lcd.println("Parsing...      ");
        parseline();
        lcd.setCursor(0,1);
        if(val>0)
        {
            lcd.print("Turning CCW...  ");
            turn(val,0);
        }
        else
        {
            lcd.print("Turning CW...   ");
            turn(-val,1);
        }
        Serial.println("ACK");
        lcd.setCursor(0,1);
        lcd.print("Waiting...      ");
    }
}
 
void turn(int deg,boolean ccw)
{
    Serial.print("Turning...");
    Serial.println(deg);
    if(ccw) digitalWrite(stp_dir,HIGH);
    else digitalWrite(stp_dir,LOW);
    delayMicroseconds(100);
    for(int x=0; x<deg; ++x)
    {
        digitalWrite(stp_step,HIGH); 
        delayMicroseconds(600); 
        digitalWrite(stp_step,LOW); 
        delayMicroseconds(600); 
    }
}


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Copyright © 2016-2020 Electronics and Software Blog All rights reserved.