Arduino Uno and CNC Shield V3 Homing Issues with GRBL

I am having trouble with homing my CNC. It is two axes X/Y and I have the code set to first home Y then home X.

 #define HOMING_CYCLE_0 (1<<Y_AXIS)  // COREXY COMPATIBLE: First home Y
 #define HOMING_CYCLE_1 (1<<X_AXIS)  // COREXY COMPATIBLE: Then home X

Here are my settings:

$0 = 10 (Step pulse time, microseconds)
$1 = 25 (Step idle delay, milliseconds)
$2 = 0 (Step pulse invert, mask)
$3 = 0 (Step direction invert, mask)
$4 = 0 (Invert step enable pin, boolean)
$5 = 0 (Invert limit pins, boolean)
$6 = 0 (Invert probe pin, boolean)
$10 = 1 (Status report options, mask)
$11 = 0.010 (Junction deviation, millimeters)
$12 = 0.002 (Arc tolerance, millimeters)
$13 = 0 (Report in inches, boolean)
$20 = 1 (Soft limits enable, boolean)
$21 = 1 (Hard limits enable, boolean)
$22 = 1 (Homing cycle enable, boolean)
$23 = 0 (Homing direction invert, mask)
$24 = 25.000 (Homing locate feed rate, mm/min)
$25 = 1500.000 (Homing search seek rate, mm/min)
$26 = 250 (Homing switch debounce delay, milliseconds)
$27 = 8.000 (Homing switch pull-off distance, millimeters)
$30 = 1000 (Maximum spindle speed, RPM)
$31 = 0 (Minimum spindle speed, RPM)
$32 = 0 (Laser-mode enable, boolean)
$100 = 40.000 (X-axis travel resolution, step/mm)
$101 = 40.000 (Y-axis travel resolution, step/mm)
$102 = 250.000 (Z-axis travel resolution, step/mm)
$110 = 10000.000 (X-axis maximum rate, mm/min)
$111 = 10000.000 (Y-axis maximum rate, mm/min)
$112 = 250.000 (Z-axis maximum rate, mm/min)
$120 = 50.000 (X-axis acceleration, mm/sec^2)
$121 = 50.000 (Y-axis acceleration, mm/sec^2)
$122 = 10.000 (Z-axis acceleration, mm/sec^2)
$130 = 550.000 (X-axis maximum travel, millimeters)
$131 = 345.000 (Y-axis maximum travel, millimeters)
$132 = 200.000 (Z-axis maximum travel, millimeters)

Both of my hard limit switches work. I have tested with two Arduino boards and two CNC Shield V3s with different A4988 stepper motor drivers so I do not believe it to be the hardware.

I have the stepper motor drivers set to .7v. The CNC does the same thing regardless of whether or not it is under load. Is there something wrong with my grbl settings that could cause this issue?

Thanks,

I think that you forgot to tell us what is wrong.

That fails to include any information that we can use to help you. What is it that it does that is not what you want?

I'm sorry, I thought I attached this video. Basically it does a decent job homing in the y-direction and then does not move as expected in the x-direction (very slow and jittery). If I use UGS to try and have it jog over, it moves slow and jittery as well. Also the amount that it moves backwards after hitting the switches seems to be very wrong.

Homing_Fail.zip (544.8 KB)

I won't download a zip file.

Maybe drop the homing rate some.

Probably has nothing to do with homing, but I doubt that those motors will go that fast.

Fair enough, but changing the speeds did not do anything. It honestly sounds like someone is drilling my motors are so loud when they run. Do you think it could be a hardware problem with one of them?

How do they work with this simple test code? Change the pins to how your motors are wired, of course.


const byte directionPin = 5;
const byte stepPin = 2;
const byte enPin = 8;  // for CNC shield


void setup()
{
   Serial.begin(115200);
   Serial.println("Starting Stepper Demo with millis()");

   pinMode(directionPin, OUTPUT);
   pinMode(stepPin, OUTPUT);
   pinMode(enPin, OUTPUT); // CNC shield
   digitalWrite(enPin, LOW);
}

void loop()
{
   singleStep(10);  // 10 milliseconds per step
}

void singleStep(unsigned long stepInterval)
{
   static unsigned long stepTimer = 0;
   //unsigned long stepInterval = stepI;
   if (millis() - stepTimer >= stepInterval)
   {
      stepTimer = millis();
      digitalWrite(stepPin, HIGH);
      digitalWrite(stepPin, LOW);
   }
}

I figured out part of the problem, one of the stepper motor harnesses had an abnormally high resistance on one of the wires ~.2Mohms, so I changed that wire out. While this solved the issue with the the cnc going in both the Y and X direction while homing, when I tell UGS to jog 10mm it moves about 2 inches and also is incredibly loud with vibrations. I wonder if somehow the steps vs how far it goes is way off. This could be why it moves so far backwards away from the limit switches when homing as well.

What are the microstep settings on the stepper drivers? They should be at least X4 to avoid resonance problems. I have steppers that otherwise work wonderfully, but if set to no microstepping and 200 steps per second will just buzz and not move. Then set them to 700 steps and they work great with no missing steps.

What happens if you run the test code that I posted?

I have not, I am new to stepper motors in general. Not sure what to make the pins.

const byte directionPin = 5;
const byte stepPin = 2;

As of now I just have the CNC shield plugged in and the stepper motors wired to the X and Y. Also have the limit switches attached to the -X and -Y.

Also i am using a GT2 20 tooth pulley with a 1.8 degree stepper motor and 1/4 microstepping. So by my calculations that means that the resolution should be 200/40 * 4 = 20 step/mm. Is there a setting I need to change in order for them to stay out of resonance? Isn't the resolution how grbl will know the distance traveled?

Here is how the Uno pins are mapped to the CNC shield. The pins in the test code are for X axis. For Y axis the pins are step = 3, dir = 6. For Z axis it is step = 4 and dir = 7.

cnc shield Uno pins

I use the RepRap calculator to get my steps/mm and such.

20 step/mm. should be right.
Then enter the numbers into the $100, $101 and $102 places in the grbl configuration.

1/4 or x4 microstepping should be enough to mitigate resonance especially with a belt system that has some natural damping.

Hi GroundFungus,

Thanks for all the help. Once I got the resolution correct and upped the microstepping it is working as desired! You were correct that the singlestepping was causing all the vibrations and then my resolution was off which was causing the extensive pull away after homing.

Thanks again!

Happy that I could help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.