Hi,
i have an issue with a stepper motor driven feed on a vertical slotter,
it basically fires up the spindle which is a 3phase motor, then every revolution that triggers feed to be put on and also taken off at the bottom off the stroke in order to cut out of the material and back to zero, however its often a few degrees off when it comes back to zero,
i have tried it with a different motor and driver not connected to the machine and its doing the same thing so i suspect its steps getting lost between the arduino and the driver,
whats really confusing me is i have tried slowing the motor right down to 2000 steps/sec and acceleration right down and it seems to do exactly the same thing, heres some of the code,
how else can i diagnose where the steps are going?
Cheers
Ralph
AccelStepper stepper1(AccelStepper::DRIVER, STEPPER1_STEP_PIN, STEPPER1_DIR_PIN);
stepper1.setMaxSpeed(3000.0);
stepper1.setAcceleration(60000.0);
if (CNCCut)
{
digitalWrite(spindle, HIGH);
if (CNCCut && tdctop != lasttdctop && tdctop == LOW)
{
stepper1.moveTo(cuttingzero + steps + 4); // - number gives its a first cut and helps backlash??
stepper1.run();
cuton = true;
steps += 4;
Delay = ((( millis() - previousMillis) * 0.625) - (steps) * 2.7) - 29;
revtime = (millis() - previousMillis);
Serial.println(steps);
Serial.println(revtime);
Serial.println(Delay);
previousMillis = millis();
}
lasttdctop = (tdctop);
if (cuton && CNCCut && millis() >= previousMillis + (Delay)) // this needs replacing a delay
{
if (modestate == LOW) stepper1.moveTo(cuttingzero); // mode switch 2 blind hole
else stepper1.moveTo(cuttingzero + steps - 4); // mode switch 1 through cut
stepper1.run();
cuton = false;
}
}
else if (!tdctop) digitalWrite(spindle, LOW);
if (steps > stepstocut)
{
stepper1.moveTo(cuttingzero);
CNCCut = false;
steps = 0;
}