Posts Tagged CNC

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!


1 Comment

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 …

, ,


Natural Enemies

I couldn’t resist setting this up for my next Digital Machinist column on logarithmic scales:

Homage Tektronix Circuit Computer with HP 50g calculator
Homage Tektronix Circuit Computer with HP 50g calculator

The caption will read “Photo 1: A replica Tektronix Circuit Computer shown with its natural enemy, an HP 50g Graphing Calculator.”

It’s my desk calculator. In the Basement Laboratory, I use the HP 48 calculator app, with a couple of $10 Sharp calculators in harm’s way.



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.

, , ,


Homage Tek CC Cursor: Pivot Milling

A test to mill the pivot hole in 0.5 mm PETG sheet worked perfectly:

Tek CC - cursor pivot hole milling
Tek CC – cursor pivot hole milling

The cutter is a 3.175 mm = 1/8 inch router bit, one of a ten-pack that came with the CNC 3018 and to which I have no deep emotional attachment, held in a collet in the Sherline. The hole is 5.5 mm to fit an eyelet. The PETG is taped to a thin plywood scrap.

The hole happened by feeding G-Code manually into LinuxCNC, after touching off XYZ=0 at the center of the pivot and jogging up a bit:

g0 y-1.1625
g0 z0.5
g2 p5 z-1.5 i0 j1.1625

Yes, I engraved the hairline using a diamond drag tool on the CNC 3018, cut the cursor outline with a drag knife on the MPCNC, then milled the pivot hole on the Sherline. This seems way over the top, even to me, but that’s just how the tooling worked out right now.

In actual practice, I’d probably mill a stack of cursors and pivot holes on the Sherline in one setup, then engrave the hairlines in a suitable fixture. I think I know enough to fit a spring-loaded diamond drag bit into the Sherline’s 10 mm ID spindle or, worst case, conjure a block for the Z-axis carrier in place of the entire spindle mount.

At least now I can remember what I did to make the hole.


Leave a comment

Monthly Image: Digital Machinist 14.4 Cover

I ain’t getting richer, but I did get mah pitcher onna cover of th’ Digital Machinist:

Digital Machinist Cover DM14.4 - Winter 2019
Digital Machinist Cover DM14.4 – Winter 2019

I just caught George Bulliss in a weak moment. [grin]

It’s the diamond drag holder on the CNC 3018-Pro, before the XL axis extension hackage., with the probe camera stuck to the left side.

You can say you knew me before …



Drag Knife Cuttery: Entry & Exit Moves

The first pass at cutting laminated decks for the Homage Tektronix Circuit Computer left little uncut snippets at the starting point of the cut. The point of the drag knife blade trundles along behind the cutting edge and, when the ending point equals the starting point, leaves an un-cut sliver as it’s retracted vertically:

Drag Knife - LM12UU - knife blade detail
Drag Knife – LM12UU – knife blade detail

The knife blade isn’t aligned in any particular direction, so it can leave a nick on either side as it enters the deck vertically at the start of the cut.

Gradually entering the deck along the cut line gives the blade enough time to swivel around to the proper alignment before it gets down to serious cutting. Continuing the final cut past the starting point then allows the blade to recut anything remaining from the entry move.

The middle and top decks have windows exposing the scales:

Tek CC - radial text example
Tek CC – radial text example

The paths are basically two arcs connected by semicircular cuts, but with ramps on each end recutting the entry and exit paths:

Top Deck - Window Cut Path
Top Deck – Window Cut Path

The entry path in the upper left slants downward from the TravelZ level of 1.5 (-ish) mm to Z=0, with the nose of the blade holder flush against the surface and the blade sunk to its full length. The vertical path to Z=-2 (-ish) increases the cutting pressure from roughly the preload value to preload + 2*(spring rate), so the blade won’t ride up under the cutting forces.

The path then goes completely around the window at Z=-2, then ramps up to the TravelZ level again.

All of which produces a neat cutout that sticks to the Cricut mat when I peel the rest of the deck off:

Tek CC - MPCNC drag knife
Tek CC – MPCNC drag knife

That’s a middle deck before I started laminating them, but you get the general idea.

The GCMC code (extracted from the complete lump) looks like this:

  local WindowArc = 54deg;

  local ac = -17 * ScaleArc + ScaleRT/2;   // center of window arc
  local r0 = DeckRad - ScaleHeight;        // outer
  local r1 = DeckRad - 2 * ScaleHeight;    // inner

  local aw = WindowArc - to_deg(atan(ScaleHeight,(r0 + r1)/2));    // window arc minus endcaps

  p0 = r0 * [cos(ac + aw/2),sin(ac + aw/2),-];
  p1 = r0 * [cos(ac - aw/2),sin(ac - aw/2),-];
  local p2 = r1 * [cos(ac - aw/2),sin(ac - aw/2),-];
  local p3 = r1 * [cos(ac + aw/2),sin(ac + aw/2),-];

  arc_cw(p0 +| [-,-,0],ScaleHeight/2);    // blade enters surface
  move([-,-,KnifeZ]);                     // apply pressure

  arc_cw(p1,r0);                          // smallest arc
  arc_cw(p2,ScaleHeight/2);               // half a circle

  arc_cw(p1 +| [-,-,TravelZ],r0);         // exit from cut


Having measured the angular position of the window and its size on the original Tek CC, I compute the coordinates of the four points where the semicircular “end caps” meet the longer arcs, then connect the dots with arc_xx() functions to generate the G-Code commands. As always, using the proper radius signs requires trial & error.

While I was at it, I added entry & exit moves for the deck’s central pivot hole and outer perimeter.

I’m pretty sure the right CAM package would take care of that, but GCMC operates well below the CAM level.

, , ,

1 Comment