GRBL probe inaccuracy... a fix

So I have been dialing in my process for milling PCB’s which involves a leveling routing using bCNC, to compensate for warpage in the xy plane. So far my results are decent, but I had a sneaking suspicion my v-groove bit was consistently diving in ~0.3mm too far. Then I noticed the PCB slightly warping every time the probe touched it. Investigating this, I found an issue report for grbl that explains this behavior:

So if you just use G38.2 to probe down on z and set your zero afterwards, there will always be some error proportional to your machine’s z acceleration and the probing speed. Basically it slows down after contact, obeying max acceleration, which means it will come to a stop slightly beyond the contact point. So with grbl you have to compensate for this. To properly set zero after probing, you have to add a retract back to the point of contact, and zero from there.

Unfortunately the guy didn’t end up posting his macro. I don’t know gcode like the back of my hand, so I’ll have to look some things up and do some testing to figure out how to retract the proper distance (somehow make use of the contact position stored internally in grbl). If anyone has already done this, please share.

I think this will be the secret to me being able to do much finer pitch pcbs. I also just probe at 100 now, and want to make my macro do a slow second probe. That I know how to do, but without the retract thing it will still always be off a bit.

1 Like

Nm, I got it figured out. According to chamnit (lead grbl dev), the contact point position is only reported, not used internally anywhere else in grbl. So you have to handle the probing decel error manually. This could mean looking at the “PRB:…” output in the terminal, write it down, and using it as needed in your setup… or you can automate the process using a macro in bCNC. Here is what lurks under my bCNC “z-probe button”:

(Z probe script: precise contact point using bCNC macros)
G91
G38.2 Z-20 F100
G10 P0 L2 Z[prbz]
G0Z5
G90

Doing it this way will give you way more accuracy than even a slow second probing, and you don’t have to slow down the probe to do it. It is accurate within a single microstep is my understanding (uses interrupts to record the step where contact happened before slowing down). I think this is also a thing for Marlin users as well (afaik there are no fw we use that make use of the interrupt contact position internally… just the terminal report is all we get from G38.2 regardless of grbl or marlin).

This has happened to me a few times already… yet I will add one more reason I’m stoked I struggled through learning bCNC. It does look very win95, but man it is just perfect for this whole… cnc thing!

Hi, will the PRB output simply appear in serial monitor if I run a probe command? Sorry, I’m fairly new to this. I’m running bCNC and would love to know how to correct prove for decelleration as you’ve done. Very cool. I wonder why this isn’t incorporated in bCNC already, seems a no-brainer. Thanks!

Yes you will see the PRB output in terminal, if needed. With bCNC you don’t really need to ever see that output though, because bCNC can make use of that output automatically. Like for z probing, you can make a simple script that touches and sets z 0… no copy pasting or math needed. Same for x and y… just take care to enter the radius of your probe in the script for x and y. The coolest display of bCNC automating things, is the leveling function. Just one click after some initial settings, then it probes a grid with many points, and offsets you gcode automatically. BCNC is super powerful this way. Also note you can use one of those small wireless keyboards for jogging with bCNC. I use a rii on mine… replaces full house jogging hardware, and of course can be used for Linux stuff as well.

Edit: regarding acceleration control, I have that hard coded into grbl, and I also have it in my grbl settings file just in case I screw it up plying around. Bcnc has a tab where you can access these grbl $ settings in a gui, but I avoid it because it doesn’t support all flavors of grbl (especially fluidnc). Hitting the send button in that gui is the same as copy/pasting your grbl settings in the terminal, but with copy/paste you have all available options there.