Maker 101
Published © GPL3+

3D Printed Arduino Rotating Table With 28BYJ-48 Stepper

This project shows how to make a 3D printed Rotating Table using Arduino and a hobby stepper motor.

BeginnerFull instructions provided2,280
3D Printed Arduino Rotating Table With 28BYJ-48 Stepper

Story

Read more

Custom parts and enclosures

Rotating-Table-3D-Parts

Code

Rotating-Table-Stepper

Arduino
// wait for a single step of stepper
int delaytime = 2;

// ports used to control the stepper motor
// if your motor rotate to the opposite direction, 
// change the order as {4, 5, 6, 7};
int port[4] = {4, 5, 6, 7};

// sequence of stepper motor control
int seq[8][4] = {
  {  LOW, HIGH, HIGH,  LOW},
  {  LOW,  LOW, HIGH,  LOW},
  {  LOW,  LOW, HIGH, HIGH},
  {  LOW,  LOW,  LOW, HIGH},
  { HIGH,  LOW,  LOW, HIGH},
  { HIGH,  LOW,  LOW,  LOW},
  { HIGH, HIGH,  LOW,  LOW},
  {  LOW, HIGH,  LOW,  LOW}
};

void rotate(int step) {
  static int phase = 0;
  int i, j;
  int delta = (step > 0) ? 1 : 7;

  step = (step > 0) ? step : -step;
  for(j = 0; j < step; j++) {
    phase = (phase + delta) % 8;
    for(i = 0; i < 4; i++) {
      digitalWrite(port[i], seq[phase][i]);
    }
    delay(delaytime);
  }
  // power cut
  for(i = 0; i < 4; i++) {
    digitalWrite(port[i], LOW);
  }
}

void setup() {
  pinMode(port[0], OUTPUT);
  pinMode(port[1], OUTPUT);
  pinMode(port[2], OUTPUT);
  pinMode(port[3], OUTPUT);
}
void loop() {
  rotate(100);
}

Credits

Maker 101

Maker 101

47 projects • 175 followers
Maker 101; Beginner and intermediate level Maker projects!

Comments