Wednesday, 13 October 2021

Threading trials - G33 in Fusion 360 and LinuxCC

Threading with G33 - spindle synchronised motion

Let's give threading a go now. This should be considerably simpler on a CNC lathe than hitherto, with all the buggerage involving change gears, gearboxes, leadscrew engagement and cross slide movements at the start and end of the threads. Then there's the issue of cutting my preferred metric threads on an imperial machine ie not disengaging the leadscrew between passes.

The spindle encoder feedback is a key part of the process, although it seems the index signal is the default trigger to the movement. Beyond that, the VFD "spindle at speed" input is used to determine the angular position, on the assumption that the spindle movement is as expected, rather than implement an "electronic gear" coupling between the spindle and Z axis movement. 

There's an absolute position signal available from the encoder but it appears I'd need to do more work to implement electronic gearing. One step at a time, fatty. We can get on to that later, once we have the default implementation working. 

How G33 works in LinuxCNC:

From the LinuxCNC documentation:

21. G33 Spindle Synchronized Motion

G33 X- Y- Z- K- $-

K - distance per revolution

For spindle-synchronized motion in one direction, code G33 X- Y- Z- K- where K gives the distance moved in XYZ for each revolution of the spindle. For instance, if starting at Z=0, G33 Z-1 K.0625 produces a 1 inch motion in Z over 16 revolutions of the spindle. This command might be part of a program to produce a 16TPI thread. Another example in metric, G33 Z-15 K1.5 produces a movement of 15mm while the spindle rotates 10 times for a thread of 1.5mm.

The (optional) $ argument sets which spindle the motion is synchronised to (default is zero). For example G33 Z10 K1 $1 will move the spindle in synchrony with the spindle.N.revs HAL pin value.

Spindle-synchronized motion waits for the spindle index and spindle at speed pins, so multiple passes line up. G33 moves end at the programmed endpoint. G33 could be used to cut tapered threads or a fusee.

All the axis words are optional, except that at least one must be used.

Note: K follows the drive line described by X- Y- Z-. K is not parallel to the Z axis if X or Y endpoints are used for example when cutting tapered threads.

Technical Info

At the beginning of each G33 pass, LinuxCNC uses the spindle speed and the machine acceleration limits to calculate how long it will take Z to accelerate after the index pulse, and determines how many degrees the spindle will rotate during that time. It then adds that angle to the index position and computes the Z position using the corrected spindle angle. That means that Z will reach the correct position just as it finishes accelerating to the proper speed, and can immediately begin cutting a good thread.

HAL Connections

The pin spindle.N.at-speed must be set or driven true for the motion to start. Additionally spindle.N.revs must increase by 1 for each revolution of the spindle and the spindle.N.index-enable pin must be connected to an encoder (or resolver) counter which resets index-enable once per rev.

See the Integrators Manual for more information on spindle synchronized motion.

G33 Example

G90 (absolute distance mode) 
G0 X1 Z0.1 (rapid to position) 
S100 M3 (start spindle turning) 
G33 Z-2 K0.125 (move Z axis to -2 at a rate to equal 0.125 per revolution) 
G0 X1.25 (rapid move tool away from work) 
Z0.1 (rapid move to starting Z position) 
M2 (end program)

See G90 & G0 & M2 sections for more information.

It is an error if:
  • All axis words are omitted.
  • The spindle is not turning when this command is executed
  • The requested linear motion exceeds machine velocity limits due to the spindle speed

Let's give it a go:
Seems fairly straightforward - and Fusion 360 uses the G33 cycle for threading, so hopefully it will be fairly plain sailing.

Firstly, let's create a test piece. I have several lengths of 0.5" / 12.7mm mystery loominum stock that can be the sacrificial pig here. So I will turn it down to 12mm and create an M12 thread.

And I'll need to create a suitable tool. The only RH threading tool in the default samples library uses a different insert style. It's simple enough though:


As for the lathe threading toolpath, there are some settings to select such as the infeed angle, which I will set to 29 degrees for a 60 degree thread. The default is 0 degrees, which can increase the risk of chatter with deep and coarse threads. It's also possible to select variable feed depths, which compensates for the fact that the material removal rate would otherwise increase as the tool cuts deeper into the stock, due to the triangular profile.

Here we are, with 5 passes:




Which generates the following code. Seems to be generating the expected G33 content:

%
(8880)
(THREADING TRIAL)
N10 G7
N11 G18
N12 G90
N13 G21
N14 G53 G0 X0.
N15 G53 G0 Z0.

(THREAD1)
N16 T0 M6
N18 G54
N19 G97 S500 M3
N20 G95
N21 G90 G0 X22.7 Z10.306
N22 G0 X10.939
N23 G33 Z-19.246 K2.
N24 X11.833 Z-19.694 K2.828
N25 G0 X22.7
N26 Z10.204
N27 X10.569
N28 G33 Z-19.164 K2.
N29 X11.833 Z-19.796 K2.828
N30 G0 X22.7
N31 Z10.125
N32 X10.284
N33 G33 Z-19.1 K2.
N34 X11.833 Z-19.875 K2.828
N35 G0 X22.7
N36 Z10.059
N37 X10.045
N38 G33 Z-19.047 K2.
N39 X11.833 Z-19.941 K2.828
N40 G0 X22.7
N41 Z10.
N42 X9.833
N43 G33 Z-19. K2.
N44 X11.833 Z-20. K2.828
N45 G0 X22.7
N46 Z10.
N47 X9.833
N48 G33 Z-19. K2.
N49 X11.833 Z-20. K2.828
N50 G0 X22.7

N51 M5
N52 G53 G0 X0.
N53 G53 G0 Z0.
N54 M30
%

I'm guessing the incremental Z moves between passes are the result of the 29 degree entry angle, while the incremental moves in X are the actual infeed between passes. Between passes, the tool is retracted to X22.7 and returned to the start at a faster pitch of 2.828mm.

Clearly it's not attempting to implement any "electronic gear" function. I'm assuming I'd need to modify the Fusion post to make this happen. But that may not be worth the hassle of course...

Good. So let's give that a go, firstly with "air tools". The biggest question in my mind is whether or not the spindle encoder index signal is correctly connected and functioning. That should be easy enough to find out.

Air cutting trial:


And real chips:

Hurrah!


Only slight fly in the ointment is the thread pitch. Originally I planned an M12 x 2.0 thread, then changed my mind and changed the model to M10 x 1.50. I seem to have found a buglet in Fusion lathe CAM, as the pitch didn't change when I reprogrammed the toolpaths. I was able to reproduce this consistently so it appears to be a hard coded fuckup. So I ended up with an M10 x 2.0 thread. Oddly enough I don't have such a nut on the shelf. One to bear in mind when I next change the pitch of a thread in Fusion....

No comments:

Post a Comment

TIG welder up and running - after some fault diagnostics and repair

Finally got some time to connect up the flow meter and argon hose. Plugged in the torch and ground cables and the torch hose etc. Powered it...