Friday 16 August 2024

Updating the Centroid Lathe PLC code with ATC turret mods

Previously, I edited the Centroid Lathe PLC code to make it work with my ATC turret. The reason for this is that the generic turret options that come with the wizard expect some form of 3 line Graycode signal (similar to BCD) from the turret to tell the controller what tool position is currently in play. However, my turret (supplier unknown) actually uses 8 individual lines, one per position. I have enough spare digital inputs on the ETHER1616 expansion board to handle those extra signals, so the challenge was to modify the logic code to recognise these inputs rather than the Graycode that is expected by default.

All has been working fine since those mods were made - except from the tool touch-off functions that are required for automatically measuring the tool offsets. Previously I tore out large clumps of my hair trying to make head or tail of the behaviour before concluding that I wasn't going to be able to fix it myself. It would clearly require the Centroid engineers to dig into the code and fix what were evidently some logical errors in the offset calculation. As the lathe users appear to be fairly thin on the ground relative to the number of mill, router and plasma users, this wasn't going to happen any time soon.

That time seems to have come finally. There's a beta release that sounds as if it may have fixed some of these issues, so let's have a go at installing it and trying it out.

The update process for my system is as follows:

  • Open CNC12, run the settings wizard and take screenshots of all the settings screens. NB: For subsequent versions, hitting Ctl-P will automatically save the as PDFs.
  • Save the current (4.80) installation by renaming the C:\cnct folder to something like C:\cnct_4.80. You can easily revert back to this working version at any time by simply renaming it back to c:\cnct
  • Create a fresh install from the downloaded link (5.19 beta in this case)
  • Run the wizard and copy the settings across from the PDF screenshots.
  • Update the ATC-related parameters in the config > parameters screen:
    • P160 >> 1 [enhanced ATC:1 = Nonrandom]
    • P264 >> 7 [rapid rate override display - actually non-ATC]
    • P830 >> 4 [ATC type: 4 = Graycode 1 output]
    • P849 >> 10 [toolchange timeout TimerDefault = 10]
    • P851 >> 0.1 [ATC time before reversing]
  • Using Visual Studio Code or Notepad++, open the acorn_lathe_plc.src source file from the c:\cnct folder and comment out or delete the following content...
=========================================================================
                               ATCGrayCodeStage
;=========================================================================
; Check input based on parameter bits to determine tool location
IF !(ToolTurretPosBit1 ^ P831Bit0) && !(ToolTurretPosBit2 ^ P831Bit1) 
 && !(ToolTurretPosBit3 ^ P831Bit2) && !(ToolTurretPosBit4 ^ P831Bit3)
 && SV_MACHINE_PARAMETER_161 >= 1 THEN CurrentTurretPosition_W = 1
IF !(ToolTurretPosBit1 ^ P832Bit0) && !(ToolTurretPosBit2 ^ P832Bit1) 
 && !(ToolTurretPosBit3 ^ P832Bit2) && !(ToolTurretPosBit4 ^ P832Bit3)
 && SV_MACHINE_PARAMETER_161 >= 2 THEN CurrentTurretPosition_W = 2
IF !(ToolTurretPosBit1 ^ P833Bit0) && !(ToolTurretPosBit2 ^ P833Bit1) 
 && !(ToolTurretPosBit3 ^ P833Bit2) && !(ToolTurretPosBit4 ^ P833Bit3)
 && SV_MACHINE_PARAMETER_161 >= 3 THEN CurrentTurretPosition_W = 3
IF !(ToolTurretPosBit1 ^ P834Bit0) && !(ToolTurretPosBit2 ^ P834Bit1) 
 && !(ToolTurretPosBit3 ^ P834Bit2) && !(ToolTurretPosBit4 ^ P834Bit3)
 && SV_MACHINE_PARAMETER_161 >= 4 THEN CurrentTurretPosition_W = 4
IF !(ToolTurretPosBit1 ^ P835Bit0) && !(ToolTurretPosBit2 ^ P835Bit1)
 && !(ToolTurretPosBit3 ^ P835Bit2) && !(ToolTurretPosBit4 ^ P835Bit3)
 && SV_MACHINE_PARAMETER_161 >= 6 THEN CurrentTurretPosition_W = 5
IF !(ToolTurretPosBit1 ^ P836Bit0) && !(ToolTurretPosBit2 ^ P836Bit1)
 && !(ToolTurretPosBit3 ^ P836Bit2) && !(ToolTurretPosBit4 ^ P836Bit3)
 && SV_MACHINE_PARAMETER_161 >= 6 THEN CurrentTurretPosition_W = 6
IF !(ToolTurretPosBit1 ^ P837Bit0) && !(ToolTurretPosBit2 ^ P837Bit1)
 && !(ToolTurretPosBit3 ^ P837Bit2) && !(ToolTurretPosBit4 ^ P837Bit3)
 && SV_MACHINE_PARAMETER_161 >= 7 THEN CurrentTurretPosition_W = 7
IF !(ToolTurretPosBit1 ^ P838Bit0) && !(ToolTurretPosBit2 ^ P838Bit1)
 && !(ToolTurretPosBit3 ^ P838Bit2) && !(ToolTurretPosBit4 ^ P838Bit3)
 && SV_MACHINE_PARAMETER_161 >= 8 THEN CurrentTurretPosition_W = 8
IF !(ToolTurretPosBit1 ^ P839Bit0) && !(ToolTurretPosBit2 ^ P839Bit1)
 && !(ToolTurretPosBit3 ^ P839Bit2) && !(ToolTurretPosBit4 ^ P839Bit3)
 && SV_MACHINE_PARAMETER_161 >= 9 THEN CurrentTurretPosition_W = 9
IF !(ToolTurretPosBit1 ^ P840Bit0) && !(ToolTurretPosBit2 ^ P840Bit1)
 && !(ToolTurretPosBit3 ^ P840Bit2) && !(ToolTurretPosBit4 ^ P840Bit3)
 && SV_MACHINE_PARAMETER_161 >= 10 THEN CurrentTurretPosition_W = 10
IF !(ToolTurretPosBit1 ^ P841Bit0) && !(ToolTurretPosBit2 ^ P841Bit1)
 && !(ToolTurretPosBit3 ^ P841Bit2) && !(ToolTurretPosBit4 ^ P841Bit3)
 && SV_MACHINE_PARAMETER_161 >= 11 THEN CurrentTurretPosition_W = 11
IF !(ToolTurretPosBit1 ^ P842Bit0) && !(ToolTurretPosBit2 ^ P842Bit1)
 && !(ToolTurretPosBit3 ^ P842Bit2) && !(ToolTurretPosBit4 ^ P842Bit3)
 && SV_MACHINE_PARAMETER_161 >= 12 THEN CurrentTurretPosition_W = 12
IF !(ToolTurretPosBit1 ^ P843Bit0) && !(ToolTurretPosBit2 ^ P843Bit1)
 && !(ToolTurretPosBit3 ^ P843Bit2) && !(ToolTurretPosBit4 ^ P843Bit3)
 && SV_MACHINE_PARAMETER_161 >= 13 THEN CurrentTurretPosition_W = 13
IF !(ToolTurretPosBit1 ^ P844Bit0) && !(ToolTurretPosBit2 ^ P844Bit1)
 && !(ToolTurretPosBit3 ^ P844Bit2) && !(ToolTurretPosBit4 ^ P844Bit3)
 && SV_MACHINE_PARAMETER_161 >= 14 THEN CurrentTurretPosition_W = 14
IF !(ToolTurretPosBit1 ^ P845Bit0) && !(ToolTurretPosBit2 ^ P845Bit1)
 && !(ToolTurretPosBit3 ^ P845Bit2) && !(ToolTurretPosBit4 ^ P845Bit3)
 && SV_MACHINE_PARAMETER_161 >= 15 THEN CurrentTurretPosition_W = 15
IF !(ToolTurretPosBit1 ^ P846Bit0) && !(ToolTurretPosBit2 ^ P846Bit1)
 && !(ToolTurretPosBit3 ^ P846Bit2) && !(ToolTurretPosBit4 ^ P846Bit3)
 && SV_MACHINE_PARAMETER_161 >= 16 THEN CurrentTurretPosition_W = 16

IF TRUE THEN SV_PLC_CAROUSEL_POSITION = CurrentTurretPosition_W
  • ...then paste the following section to replace the content you just commented out or deleted:
;===========================================================
                               ATCGrayCodeStage
;===========================================================
; EME 2024-08-09 ATC control trials
; Input 1 on Ether1616 with A0 address = CNC12 input 33 etc
; IF Tool1Input THEN CurrentTurretPosition_W = 1
; IF Tool2Input THEN CurrentTurretPosition_W = 2
; etc...
IF TRUE THEN CurrentTurretPosition_W = 0
IF INP33 THEN CurrentTurretPosition_W = 1
IF INP34 THEN CurrentTurretPosition_W = 2
IF INP35 THEN CurrentTurretPosition_W = 3
IF INP36 THEN CurrentTurretPosition_W = 4
IF INP37 THEN CurrentTurretPosition_W = 5
IF INP38 THEN CurrentTurretPosition_W = 6
IF INP39 THEN CurrentTurretPosition_W = 7
IF INP40 THEN CurrentTurretPosition_W = 8
IF TRUE THEN SV_PLC_CAROUSEL_POSITION = CurrentTurretPosition_W
; EME end of substitution
  • Change to the cnct folder and compile the modified acorn_lathe_plc.src file to create the mpu.plc file using the following commands in a CMD window:
    • cd c:\cnct
    • mpucomp acorn_lathe_plc.src mpu.plc
  • Run CNC12 and follow the instructions - you will need to let it reflash the Beaglebone and cycle the Acorn before you can expect it to work consistently.
That should do the trick. And sure enough it works - once you remember to update the parameters that is. So: install new CNC12, update parameters and modify the plc code.

Friday 9 February 2024

Final assembly and test of the spindle nose adaptor - RESULT!!

After the recent distraction caused by the 3D scanner, resurrecting the 3D printer and buggering about with the throttle bodies for my Honda S800 engine, the spindle nose adaptor has seen no action.

On the face of it, there should be little more left than to assemble the parts and test the runout. The big, big question is - is the runout remotely acceptable? I will be more than just slightly pissed off if there's any noticeable runout after all the time and care I've put into this thing. 

Last time round, I was preparing to finish machine the taper and face while mounted in place on the lathe spindle. Here's what happened.

Finish machining:

Let's go Fatty.




Phew - no cockups yet. We will leave it there:


There's a slight burr at the join of the taper and the face that fouls the register on the chuck backplate. I manually machined that off:


Now the face needs to be skimmed back, as there is still a rattle fit on the taper. How much? Plastigauge to the rescue. The taper is 7.125 degrees, so each mm of reduction in the radius of the taper will result in an 8mm needing to be removed from the axial position of the face, since Tan(7.125) = 1/8. I ensured the gap was on the Plastgauge side when squashing the backplate up against the spindle tape, so the 150um represents the total diametric gap.


With a radial gap of 150um/2 = 75um, I need to skim the face about 0.6mm axially (=75um x 8). Perhaps a bit more than I'd planned but there's not much I can do. Obvs if that gap were too big, I'd find problems getting the cams to tighten up...


How's that looking?


Really rather good!

There. Job done. Good tight fit on the taper and no cockups along the way.

What about the runout?

The next (final?) step is to do the final assembly and check the runout. Firstly, the grubs screws that hold the cams need to be ground back a little. Skimming 0.6mm off the face of the adaptor has made them stick out slightly proud of the adap[tor body so that the chuck can't sit flush. A quick spell on the belt sand does the trick


The Multisize collet chuck is probably the most accurate chuck I have, so let's use it to do a proper runout test. This is the internal taper that the collets locate against. The runout barely registers on this 10um DTI, so is of the order of 1um or so and most of this is surface roughness rather than actual runout.


And here's the proof:

I think we can call that a success. Thank fuck for that. And woohoo - I've actually finished a job for once in my life!

Updating the Centroid Lathe PLC code with ATC turret mods

Previously, I edited the Centroid Lathe PLC code to make it work with my ATC turret . The reason for this is that the generic turret options...