GRBL Error 33: G-Code Arc Tolerances

After figuring out how two-place decimal fractions caused this blooper, I had to poke into the debris field surrounding the crash:

Tek CC - top deck - failed arcs
Tek CC – top deck – failed arcs

The bCNC Terminal trace stops at the first failure, so I set GCMC to produce two-place fractions (“Number of decimals less than 3 severely limits accuracy”), then rammed the NGC file’s G-Code into a spreadsheet:

Spreadsheet - GCMC 2 digit - full path
Spreadsheet – GCMC 2 digit – full path

The last two columns (perhaps you must open the image in a new tab to see the whole thing) compute the GRBL error values: the absolute difference between the two radii and that difference as a fraction of the radius. The R Error header under Start should be X, of course; I’ll regenerate the images for the DM column.

The reduced accuracy of the two-digit fractions triggers the error marked by the red cells, where the radii differ by 0.0082 mm (>0.005) and the relative error is 0.17% (>0.1%).

Suppressing the first failed arc by passing the same starting point to the next arc simulates the second failure:

Spreadsheet - GCMC 2 digit - suppress first failed arc
Spreadsheet – GCMC 2 digit – suppress first failed arc

Similarly, the third arc from the same point fails:

Spreadsheet - GCMC 2 digit - suppress second failed arc
Spreadsheet – GCMC 2 digit – suppress second failed arc

The fourth arc becomes a full circle and produces the circular gash across the deck:

Spreadsheet - GCMC 2 digit - suppress third failed arc
Spreadsheet – GCMC 2 digit – suppress third failed arc

Two digits definitely aren’t enough!

bCNC Rounding vs. G-Code Arcs: GRBL Error 33

While cutting the top deck of the Pickett-flavored Tek Circuit Computer on the MPCNC, this happened:

Tek CC - top deck - failed arcs
Tek CC – top deck – failed arcs

I traced the off-center circle with a marker to make it more visible, as it’s the drag knife cut that should have been the exit move after completing the window.

Huh. It never did that before …

The bCNC plot looked fine, but the Terminal log showed three Error 33 reports:

Failed arc command - bCNC screen - terminal and plot
Failed arc command – bCNC screen – terminal and plot

The GRBL doc has this to say about Error 33:

The motion command has an invalid target. G2, G3, and G38.2 generates this error, if the arc is impossible to generate or if the probe target is the current position.

The error messages don’t occur immediately after the failing G2/G3 command, because bCNC sends enough commands to keep the GRBL serial input buffer topped off. After GRBL sends the error message, it continues chewing its way through the buffer and, when bCNC notices the first error, it stops sending more G-Code commands and shudders to a stop.

The great thing about Free Software is that when it breaks, you have all the pieces. Looking into the GRBL source code provides a definition of Error 33:

// [G2/3 Offset-Mode Errors]: No axis words and/or offsets in selected plane. The radius to the current
//   point and the radius to the target point differs more than 0.002mm (EMC def. 0.5mm OR 0.005mm and 0.1% radius).

Which doesn’t quite match the code, but it’s close enough:

// Compute difference between current location and target radii for final error-checks.
            float delta_r = fabs(target_r-gc_block.values.r);
            if (delta_r > 0.005) {
              if (delta_r > 0.5) { FAIL(STATUS_GCODE_INVALID_TARGET); } // [Arc definition error] > 0.5mm
              if (delta_r > (0.001*gc_block.values.r)) { FAIL(STATUS_GCODE_INVALID_TARGET); } // [Arc definition error] > 0.005mm AND 0.1% radius
            }

I’ve drag-knifed maybe a dozen top decks with no problem, so figuring out what broke took a while.

The key turned out to be in the Terminal log, where all coordinates in the G-Code commands had, at most, two decimal places. The GCMC program producing the G-Code emits three decimal places, so bCNC rounded off a digit before squirting commands to GRBL.

After more searching, it seems I’d told bCNC to do exactly that:

bCNC Config - Round 2 digits - highlighted
bCNC Config – Round 2 digits – highlighted

Perhaps I’d mistakenly set “Decimal digits” instead of “DRO Zero padding” when I reduced the DRO resolution from three decimals to two? It’s set to “2” in the CNC 3018XL configuration, so this seems like a typical one-off brain fade.

GRBL doesn’t execute invalid commands, so the tool position remains at the end of the window’s outer perimeter while the next two arc commands fail, because their center offsets produced completely invalid radii.

The three failed arc commands should have cut the right end of the window, the inner side, and the left end, but left the tool position unchanged. The final arc command should have withdrawn the blade along the outer side of the window, but became a complete circle, with the commanded end point equal to the leftover starting point at the same radius from the deck center.

The same G-Code file fails consistently with Decimal digits = 2 and runs perfectly with Decimal digits = 3, so at least I know a good fix.

Protip: Keep your hands away from moving machinery, because you never know what might happen!

This seems sufficiently obscure to merit becoming a Digital Machinist column. More analysis is in order …

Diamond Drag Tool Wear

The diamond drag tool now in the MPCNC LM3UU holder has appeared in several holders and suffered considerable misuse along the way:

Diamond Drag Tool tip - MPCNC
Diamond Drag Tool tip – MPCNC

A closer look at the spalled section on the flank:

Diamond Drag Tool tip - MPCNC - detail
Diamond Drag Tool tip – MPCNC – detail

The tool in the (much better) CNC 3018XL LM6UU holder has engraved mostly plastic, plus a few hard drive platters, and seems only slightly rounded:

Diamond Drag Tool tip - CNC 3018
Diamond Drag Tool tip – CNC 3018

An unused tip comes to a neat point:

Diamond Drag Tool tip - unused A
Diamond Drag Tool tip – unused A

As does its companion, arriving in a twofer deal from halfway around the planet:

Diamond Drag Tool tip - unused B
Diamond Drag Tool tip – unused B

They’re brazed on 3 mm OD shanks and ground to a 60° included angle.

Drag Knife Blade Wear

Having used the same two drag knife blades intermittently over the last three-ish years, I wondered just how worn they’d gotten:

Drag Knife Blades - sides
Drag Knife Blades – sides

For scale, the cylindrical part of the blade is 1.0 mm OD.

The blade with the longer face (left above and bottom below) has seen the most use and is definitely rounded at the tip:

Drag Knife Blades - tips
Drag Knife Blades – tips

Three unused blades have sharp tips:

Drag Knife Blades - unused 60 45 30 degree
Drag Knife Blades – unused 60 45 30 degree

From the top, the (nominal) blade angles are 60°, 45°, and 30°, generally indicated by yellow, red, and blue plastic caps. However, various eBay sellers disagree on how to measure the angle (up from surface / outward from axis) and which cap colors correspond to which angles.

The unused 45° blade bracketed by the two used blades:

Drag Knife Blades - unused in center
Drag Knife Blades – unused in center

The two lower blades have angles somewhere between 30° and 45°, suggesting slack grinder and QC tolerances. If the actual angle matters to you, buy an assortment (from one seller!), measure what you get, and don’t be surprised when the results aren’t anything in particular.

Perhaps, with careful attention to alignment in a non-pivoting / collet holder, one might scribe exceedingly narrow lines.

The microphotographic setup:

Drag Knife Blades - microscope stage setup
Drag Knife Blades – microscope stage setup

That’s the back of a sheet of carbon paper (remember carbon paper?), which is deep dark gray in normal light. It’s sitting on the sheet of 100 mil grid paper providing scale for small objects, atop the microscope stage positioner, with cold white illumination from an LED ring light.

Protip: even worn blades remain lethally sharp …

MPCNC: bCNC Probe Camera Refresh

For the usual inscrutable reasons, updating bCNC killed the USB camera on the MPCNC, although it still worked fine with VLC. Rather than argue with it, I popped a more recent camera from the heap and stuck it onto the MPCNC central assembly:

bCNC - USB probe camera - attachment
bCNC – USB probe camera – attachment

This one has a nice rectangular case, although the surface might be horrible silicone that turns to snot after a few years. The fancy silver snout rotates to focus the lens from a few millimeters to infinity … and beyond!

If you think it looks a bit off-kilter, you’re absolutely right:

bCNC - USB probe camera - off-axis alignment
bCNC – USB probe camera – off-axis alignment

The lens image reflected in a mirror on the platform shows the optical axis has nothing whatsoever to do with the camera case or lens snout:

bCNC - USB probe camera - off-axis reflection
bCNC – USB probe camera – off-axis reflection

Remember, the mirror reflects the lens image back to itself only when the optical axis is perpendicular to the mirror. With the mirror flat on the platform, the lens must be directly above it.

Because the MPCNC camera rides at a constant height over the platform, the actual focus & scale depends on the material thickness, but this should be typical:

bCNC - USB Probe Camera - scale - screenshot
bCNC – USB Probe Camera – scale – screenshot

It set up a Tek Circuit Computer test deck within 0.2 mm and the other two within 0.1 mm, so it’s close enough.

The image looks a whole lot better: cheap USB cameras just keep improving …

ACM Poughkeepsie Presentation: Algorithmic Art

In the unlikely event you’re in Poughkeepsie this evening, I’ll be doing a talk on my Algorithmic Art for the Poughkeepsie ACM chapter, with a look at the HPGL and G-Code transforming math into motion:

Superformula - triangle burst - detail
Superformula – triangle burst – detail

The PDF of the “slides” lacks my patter, but the embedded linkies will carry you to the blog posts & background information:

See you there! [grin]

MPCNC Drag Knife Holder: Lock Screw

While calibrating the MPCNC’s probe camera offset for the drag knife holder, this happened:

Drag Knife - vertical escape
Drag Knife – vertical escape

Well, at least it’s centered on the target:

Drag Knife - vertical escape - detail
Drag Knife – vertical escape – detail

This happened a few times before, because my fingers don’t fit neatly inside the drag knife holder to tighten the lock ring:

Drag Knife - LM12UU ground shaft - assembled
Drag Knife – LM12UU ground shaft – assembled

[Update: The lock ring keeps the holder at a fixed position inside the 12 mm shaft and doesn’t affect the blade directly. When the ring works loose, the threaded holder can rotate to expose more blade and, in this case, stab deeper into the target. ]

So I turned & knurled an aluminum ring, then tapped a 3×0.5 mm hole for a lock screw plucked from the Drawer o’ Random M3 Screws:

Drag Knife - lock screw - side
Drag Knife – lock screw – side

A view looking along the screw shows a bit more detail around the spring:

Drag Knife - lock screw - front
Drag Knife – lock screw – front

The general idea is to set the blade extension, then tighten the lock screw to hold it in place, without relying on the original brass lock ring, shown here while cutting a boss for the spring:

Drag Knife - turning spring recess
Drag Knife – turning spring recess

The lock screw’s knurled handle just barely kisses the NPCNC’s black tool holder ring, so my guesstimated measurements were a bit off. Clamping the knife holder one itsy higher in the tool holder solved the problem.

I cranked on 300 g of spring preload and, squashed like that, the spring’s rate is now 75 g/mm. Cutting at Z=-1 mm should suffice for laminated paper slide rule decks.

The original sizing doodle:

Drag Knife Holder - lock screw ring doodle
Drag Knife Holder – lock screw ring doodle

The short 18 mm section clears the inside of the LM12UU bearing, although it could be a millimeter shorter. The 19 mm section comes from the 3/4 inch aluminum rod I used, skim-cut to clean it up.

If I ever remake this thing, it needs a major re-think to get all the dimensions flying in formation again.