Close

Don't be a Jerk

A project log for MultiBot CNC v2

A low cost 3D printed CNC that can be built with minimal tools yet is capable of great things.

david-tuckerDavid Tucker 03/28/2022 at 00:400 Comments

So I have been struggling for a while now with small movements sometimes causing the machine to jerk violently and loose steps.  This is more annoying than fatal but it does cause small shifts that cause the laser to not always engrave over the same spot when running multiple passes.

I spent some time trying to vary speed, acceleration, and junction deviation to try and sort this out. I found that setting either speed or acceleration super low I can sort this out, but regular movements suffer greatly.  With junction deviation I was able to make things a bit worse by setting it to 1, but going below the default of 0.01 did not seem to significantly improve things at all.

Googling around for a bit, I came across this discussion that seems to have hit on the core of the problem. Basically they suggest that short segments are being overlooked by the path planner and just run at full speed without properly slowing down. I'm not sure that is exactly what is going on, but it sounds very similar to my problem at least.

To verify this I wrote a small test program that moves 30 mm in a straight line, then moves another 30 mm at an angle to that line.  This loops from 0 degrees to 180 degrees in steps of 20.  It worked just fine, with the planner properly slowing and reversing direction in every case, even with the machine running fairly fast at 2,000 mm/min and 200  mm/min*min for acceleration and 0.010 for junction deviation.

I wrote a second program that changes from a 30 mm straight line to a shorter 1 mm angled line followed by an another 30 mm straight line.  So I jog 30 mm, jump over 1 mm and then continue on in the original direction for 30 mm.  This works great at angles 0 and 20, and 80-180, but for 40 and 60 degrees I get the serious jerk.

Upon further testing I find that this jerk happens  for all angles between 40 and 60 degrees off of straight at speeds above 1,000 mm/min.  Varying the jog segment length I found that the fault is worse between 1 and 5 mm.  Going below or above this length makes it much less noticeable.  Setting the junction deviation to 0 has a small benefit but it is not enough to solve the problem  Going all the way up to 4,000 mm/min speed causes a hard fault when trying to jog over at a 60 degree angle.  This is very similar to the hard fault I got previously when I was using too high of a micro step count for the speeds I was running the machine at.

I dug through the code and nothing obvious jumped out at me, but to be honest I did not understand a lot of it.  Things are heavily optimized in there.  It is possible that this is just pushing the controller to fast and that when running both steppers at a fast update rate the controller just can't keep up.  I need to try running with 4 micro steps to see if the problem goes away.  

It is also possible that this is a power supply issue, I think my supply is large enough but this move is asking a lot of the whole system and going up to a 24v 6a supply (from 24v 3a) may be what is needed. And of course it is just as likely that this is an issue with the way the motion planner works and I will need to move off of GRBL to fix it.  At least I have a reliable way to reproduce the problem, so maybe in time I can find a better solution.

Discussions