Synchronize Spindle speed to live feed rate

All things related to Centroid Oak, Allin1DC, MPU11 and Legacy products

Moderator: cnckeith

Post Reply
skibum-engineer
Posts: 8
Joined: Thu Feb 11, 2021 9:09 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Synchronize Spindle speed to live feed rate

Post by skibum-engineer »

Here is a Coding Idea I am trying to work on.

Scaling the Spindle RPM command synchronous to the live feedrate of the running program. This is for use as an extrusion output in the place of a spindle.

Existing Command:

G01 X10 Y25 Z48 F200 S3000

The dream:

Spindle RPM is a multiplier of actual feedrate (#4109?) and therefore if the feedrate is overridden, the spindle speed will also scale to match.

G01 X10 Y25 Z48 F200 S[3000*(#4109)/200]


I know I need to pass the variable into the program but i need to keep updating it to be accurate on each line.

I'd appreciate your feedback!


This is on an OAK board running Mill12 no ATC
skibum-engineer
Posts: 8
Joined: Thu Feb 11, 2021 9:09 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Synchronize Spindle speed to live feed rate

Post by skibum-engineer »

Quick Update I tried the below code with limited success:

The result does scale via the feedrate override * by the commanded feedrate but it does not follow the actual feedrate which will change along the curves when accelerating or decelerating. That is the remaining challenge. Does anyone know how to extract the fedrate that you see displayed in the gcode view?


*************************
G90 ; absolute positioning
G21 ; mm measurements
M03 S1000
G1 X385.710 Y-203.886 Z100.000 F2000 S[(#25015/100)*#4109]
G1 X385.700 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X442.200 Y-203.900 Z0.000 F1800S[(#25015/100)*#4109]
G1 X498.700 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X555.100 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X611.600 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X668.100 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X724.600 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X781.100 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X837.500 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X894.000 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X950.500 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1007.000 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1063.500 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1119.900 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1176.400 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1232.900 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1289.400 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1345.900 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1402.300 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1458.800 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1515.300 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1571.800 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1628.300 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1684.700 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1741.200 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1797.700 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1854.200 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1910.700 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1967.100 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2023.600 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2080.100 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2136.600 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2193.100 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2249.500 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2306.000 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2362.500 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2419.000 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2475.500 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2531.900 Y-203.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2559.300 Y-154.500 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2559.300 Y-98.000 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2559.300 Y-41.500 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2559.300 Y15.000 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2514.500 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2458.000 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2401.600 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2345.100 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2288.600 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2232.100 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2175.600 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2119.200 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2062.700 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X2006.200 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1949.700 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1893.200 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1836.800 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1780.300 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1723.800 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1667.300 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1610.800 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1554.400 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1497.900 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1441.400 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1384.900 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1328.400 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1272.000 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1215.500 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1159.000 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1102.500 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X1046.000 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X989.600 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X933.100 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X876.600 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X820.100 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X763.600 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X707.200 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X650.700 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X594.200 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X537.700 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X481.200 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X424.800 Y49.400 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X385.700 Y8.600 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X385.700 Y-47.900 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X385.700 Y-104.300 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X385.700 Y-160.800 Z0.000 F1800 S[(#25015/100)*#4109]
G1 X385.710 Y-203.886 Z100.000 F2000
M05
M30 ; End of program
cncsnw
Posts: 3763
Joined: Wed Mar 24, 2010 5:48 pm

Re: Synchronize Spindle speed to live feed rate

Post by cncsnw »

That would have to be done in the PLC program, and not in the G codes.

The control interprets the G code before it does any accel/decel calculations, and long before anything actually runs. If you run your program above, and change the feedrate override on the fly while it runs, you will probably see a significant lag before the new feedrate override value affects the spindle speed output.

The PLC program can monitor SV_MPU11_ABS_POS_0 through SV_MPU11_ABS_POS_2 to get the X, Y and Z encoder positions. Using those, you can do some calculations to work out the change in position over time, and use the result to adjust the PLC's computed spindle speed override.
skibum-engineer
Posts: 8
Joined: Thu Feb 11, 2021 9:09 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Synchronize Spindle speed to live feed rate

Post by skibum-engineer »

That sounds quite achievable, would this plc coding be in the area that Centroid could do? I guess I can ask for a PLC programming quote.
Post Reply