Adding stepper motors to the MINIQ BG6300 milling table

In this video I show you how I added the stepper motors to the screws of the MINIQ BG6300 milling table. To make it smoother, I added thrust bearings to both sides of the shafts. The plastic mounts are 3D printed from PLA. I designed them myself. Since I needed longer screws because of the additional bearings and the coupler between the screw and the shaft of the stepper motor, I did the following: I removed the y-axis screw and replaced it with the x-axis screw then cut it to length. Then, I cut a new threaded rod for the x-axis and put the y-axis’ knob on it. The stepper motors could be stronger. The ones I use only provide 0.14 Nm torque, but slightly larger motors can provide roughly 0.6 Nm, so more than four times higher torque. It might worth the investment on the long run.



Files for 3D printing



Arduino source code

#include <AccelStepper.h> //accelstepper library
AccelStepper stepper(1, 5, 2); // direction 2, step 5
AccelStepper stepper2(1, 6, 3); // direction 3, step 6


//Pins
const byte Analog_X_pin = A6; //x-axis readings
const byte Analog_Y_pin = A7; //y-axis readings

//Variables
int Analog_X = 0; //x-axis value
int Analog_Y = 0; //y-axis value

void setup()
{

  //SERIAL
  Serial.begin(9600);
  Serial.println("Test");
  //----------------------------------------------------------------------------    
  //PINS
  pinMode(Analog_X_pin, INPUT);
  pinMode(Analog_Y_pin, INPUT);  
  //----------------------------------------------------------------------------  
  //Stepper parameters
  //setting up some default values for maximum speed and maximum acceleration
  stepper.setMaxSpeed(2000); //SPEED = Steps / second  
  stepper.setAcceleration(100); //ACCELERATION = Steps /(second)^2    
  stepper.setSpeed(200);
  delay(500);
  //----------------------------------------------------------------------------
  stepper2.setMaxSpeed(2000); //SPEED = Steps / second  
  stepper2.setAcceleration(100); //ACCELERATION = Steps /(second)^2    
  stepper2.setSpeed(200);
  delay(500);  

}

void loop()
{
  ReadAnalog();  
  stepper.runSpeed(); //step the motor (this will step the motor by 1 step at each loop indefinitely as long as setSpeed is not zero)
  stepper2.runSpeed();  
}

void ReadAnalog()
{
  //Reading the 3 potentiometers in the joystick: x, y and r.
  Analog_X = analogRead(Analog_X_pin);  
  Analog_Y = analogRead(Analog_Y_pin);     

  //The default signal is always around 512 theoretically since the potentiometer of the joystick is in the middle
  //We allow some dead-zone in the center so that's why we "start to listen" to the joystick from 600 in the + direction
  if(Analog_X>600) 
  {
  stepper.setSpeed(200);  
  }
  //if the reading is smaller than 400, then we know that the joystick was moved in the negative direction
  else if (Analog_X<400) 
  {
    stepper.setSpeed(-200);
  }
  else 
  {
    stepper.setSpeed(0);
  }
  //----------------------------------------------------------------------------  
  if(Analog_Y>600) 
  {
  stepper2.setSpeed(200);  
  }
  else if (Analog_Y<400) 
  {
    stepper2.setSpeed(-200);
  }
  else 
  {
    stepper2.setSpeed(0);
  }
  
}

The above source code is an extremely simplified version of the joystick-controller stepper motors. If you want to have a more detailed code, explanation and setup, check the following video.



Previous
Previous

Useful gadgets for stepper motor projects

Next
Next

Dissecting the MINIQ BG6300 milling table