Monday 27 May 2019

Bridgeport Z axis v2 - simpler and better?

Where we are now:
Back in March I finished the fettling ("machine fitting") and assembly of the Z axis components. It all seems to have worked out reasonably well but I wouldn't do it the exact same way next time. 

First thoughts:



  • The yoke connecting the ballnut to the quill is a thing of beauty (see drawing below) and gave me loads of experience in applying the various Fusion 360 toolpaths. It came out very nicely and the dimensions of the machined part were pretty much spot on to the drawing, which is not bad for a 35 year old machine. However, if you wanted to make hundreds of the things, you'd want to spend "some time" removing as many of the complicated (and unnecessary) features as possible. The Aussie guy BMS250 approached this from the other direction - how to take a simple lump of steel and achieve the required functionality with a minimum of machining. 
  • I have ended up with more lost movement than I could have achieved with a bit more thought. There's about 170mm between the cast features on the head that limit any possible movement of the yoke - while the yoke on my last design was about 36mm long in the axial direction. So on the face of it, I could have achieved something like 134mm of travel, less any safety margin for the travel limit at each end. However, you could imagine something like 125mm being possible on a good day. My current implementation allows only 95mm of soft limited travel. That 30mm of lost movement is hardly impressive, particularly when limited Z axis travel is the Achilles Heel of CNC turret mills. That movement has to accommodate the total difference between all tool lengths and total Z axis movement and any Z axis setup distance. It's bad enough on The Shiz, where I have ~150mm and use a spreadsheet to set the table height. But with less than 100mm total Z movement possible, it's lost a lot before I even start.


A better yoke?
  • For one thing, the ballscrew doesn't need to be supported at both ends. With a decent thrust bearing at the bottom end, next to the drive pulley, there is no obvious benefit to having another bearing at the top of the ballscrew. Currently, I'm losing 20mm at the top end due to the bearing and its housing. I can safely ditch the top bearing, which is the approach used by other CNC machines including The Shiz itself. The original BP feed trip mechanism results in some loss of movement, as the feed stop adjusters take up ~40mm, resulting in a specified movement of 127mm ("5 inches").
  • I can simplify the basic shape of the yoke by going for a more rectilinear profile, rather than the fundamentally cylindrical form. I managed to pre-machine the bore of the yoke (on the lathe) to a deadly accurate tolerance, which then required only a minute tightening of the pinch bolt to hold the ballnut secure. This in turn avoided the need for any bolts to hold the ballnut to the yoke. Using M6 bolts (as BMS250 did) results in ~6mm in travel due to the increased overall length of his ballnut / yoke assembly. In the case of BMS250, his overall yoke length appears to be ~48mm, compared to my 36mm. That's potentially 1/2" more travel.
  • I had a large (M8) pinchbolt which could more conveniently be changed to 2 smaller (M6) pinchbolts. This would reduce the stickout of the yoke. No big deal but it would make things more compact and require marginally less work.
  • It seemed that my yoke dimensions were 0.27mm wrong, requiring me to remove that amount of material on the lathe. I'd based them on measurements of the original trip mechanism yoke and some approximate measurements from the machine. That needs to be rectified, although I should try to understand where the error lies. Perhaps some means of adjusting the radial position of the bottom bearing relative to the quill would be pragmatic. An additional benefit of removing the top bearing would be this simple(?) ability to adjust the ballscrew position.
Motor bracket:
  • I made the motor bracket from bright mild steel and, like the yoke, I made a point of including as many features as possible up front. There's really no need for steel, so loominum would be a more machine-friendly choice.
  • The motor pulleys were specified as 18t (motor) and 22t (ballscrew). I used the imperial "XL" size toothed belt which resulted in a reasonably narrow (9.53mm - 3/8") belt but even so, it's still way over-specified. I can sensibly reduce the motor pulley to 10t and the ballscrew pulley to 18t. This would marginally increase the reduction ratio (from 1.22 to 1.8) and reduce the pulley sizes, which would make the belt housing smaller. I'd be able to make a one-piece bracket / belt housing, with a simple, flat cover plate to keep crap out.
  • I stupidly designed the bracket with a motor aperture that was smaller then the pulley diameter. So I can't get the motor out without removing the pulley first. Doh. 
  • Although I like having a jockey tensioner, rather than using slotted holes to tension the belt, it makes the bracket rather busy and fussy. I may simply swallow my design pride and try to be a bit more sensible.
Overall assembly:

If I do this sensibly, I could end up with a complete motor/bracket/belt/bearing/ballscrew assembly that would simply fit into the feed trip screw hole and bolt into place with a couple of cap heads. Obviously "simply fitting" would include threading the ballscrew into the ballnut but there's no simple way around that.

Ideally, I'd arrange for the bracket / bearing etc to be held (fastened) together before it's offered up. Currently, the assembly is only held together once the bracket is bolted in place. This is the current arrangement:


How about this?
A (slightly) simpler bracket:


A self contained motor/bracket/bearing/ ballscrew etc:




An upshot view:



Section view:



The motor bracket:




And the bracket drawing:




Belt length?

I've ended up with the same distance between pulley centres, since I don't want to move the motor closer to the machine. I'll need to obtain a shorter belt, as the pulleys are 12 teeth less in total. Originally I used the rather nifty belt / chain function in Solidworks but Fusion 360 doesn't have that yet. However, pulley centre distance calculators are readily available such as this one from HPC.

Setup for CAM:
I've found a fine piece of 2"x3" loominum in the stock box. Looking inside it with the aid of Fusion 360, I can see my motor bracket buried within:


I just need to dig it out now...

Sunday 19 May 2019

VFD control with low ratio gear selected on the Acorn controller

As noted last time, the motor is being set to the commanded speed, ignoring the 0.167 low gear ratio that I have so cleverly and seamlessly engaged. So now, if I ask for 100rpm spindle speed, the motor itself spins at 100rpm and the spindle then turns at something dumb like 17rpm. I'll need to dig into the manual a bit further to see how to take account of the gear ratio. Clearly the motor would need to be spinning at around 600rpm or so in this example, to achieve the required 100rpm spindle speed in low ratio. 

On the face of it, I could possibly look at the status of the low ratio input (ie parameter #50002) and multiply the magnitude of the VFD control voltage by the gear ratio. That could almost be included in the existing M3 / M4 macros but it all sounds a bit messy. Besides, this issue seems to be taken care of already within the existing controller setup, so why reinvent the wheel, especially as I am no wheelwright of any note.

Having run through the complete list of system configuration parameters, this seems to be the relevant part of the CNC12 manual:


Basically, it looks at PLC inputs 63 and 64 to determine which of the 4 speed ranges the machine has set. The assumption seems to be that the the range will be set manually by the operator and the controller will figure it out from the status of those 2 inputs. No problem in my case, assuming my range selection macro doesn't get its knickers in a twist, up against this PLC logic, although it should only need to look at one of the inputs to figure out what to do.

It's handy that I already have Input 1 (low ratio, variable #50002) and Input 2 (high ratio, variable #50001) reporting the status of the gears. On the face of it, all I need to do is connect up variable #50002 to this "INP64" somehow, then it will see when the low ratio is engaged and compensate for the gear reduction with an appropriate increase in the motor speed. I've posted a query on the forum - let's see what transpires....

The (partial) solution:
The solution is given at the bottom of this page - a PLC source file provided by CNCKeith that allows the wizard to configure the inputs for use with a backgear. That's pretty much what I have, the only difference being that my backgear does not cause reversal of the spindle direction, as it's fully geared, whereas the Bridgeport backgear does, due to the combination of belt and gear reduction stages. So my ratio is 0.167, as opposed to -0.120 or whatever it is on a BP.

Once the revised .SRC file has been pasted into the c:\cncm \WizardResources \Template directory (replacing the original), you run the wizard and reselect Input 1 function as "Backgear", then save, reboot the Acorn etc

It's only a partial solution because the main display screen doesn't report the spindle rpm - it just shows 0 all the time. However, it shows the correct current range (high or low) in the VCP area and my custom M3 and M4 macros continue to work correctly. And this is in the new, super luvvin' 4.16 updated version.

I've now posted again, to see if the rpm (not)display can be fixed.

Automatic gear selection macro M3 for The Shiz (Centroid Acorn)

The problem:
When I updated to 4.12, I posted on the Acorn forum about an issue with my M3 macro. Before the update it appeared to work fine but after the update, trying to force the machine to change gear ratio caused the CNC12 software to crash and dump me on the desktop. Not something you want to see in the middle of a machining operation. The explanation was going to be fairly obvious, namely The Fat Stupid Bloke up to his tricks again.

This is what I had. The initial bit is what ships with CNC12. The stuff below "My stuff" is my addition:
;M3 macro - Spindle CW
; Displays message to select auto spindle mode if it is not set
; See 13-8 M94/M95 Output On/Off etc
;-------
IF #4202 || #4201 THEN GOTO 200
M95 /2  ;variable SV_M94_M95_2 off - M04 spindle CCW OFF
M94 /1  ;variable SV_M94_M95_1 on - M03 spindle CW ON
IF #61058 THEN GOTO 200 ;skip the check if AutoSpindle is on - Output1058 is VCP "Autospindle" button LED.
G4 P.1; Dwell 100ms
#140 = 1.5 
N100
IF !#61058 THEN M225 #140 "Please Select Auto Spindle To Continue!" ;61058 = JPO2/SpindleAutoManualLED
G4 P.5; Dwell 500ms
IF !#61058 THEN GOTO 100
N200
;
; My stuff
;
IF #4119 >= 1000 THEN GOTO 1000     ; HIGH range required...
GOTO 2000                           ; ...otherwise LOW range required

N1000                               ; HIGH range selection
IF #50002 THEN GOTO 5000            ; Engaged in HIGH correctly, so finished
M05                                 ; check spindle stopped!
G04 P3                              ; spindle slow down - was in LOW
M94 /62                             ; energise HIGH solenoid - OUTPUT #2
M03                                 ; START SPINDLE - CW
G04 P0.2                            ; PAUSE to engage gears
M05                                 ; STOP SPINDLE
M95 /62                             ; de-energise HIGH solenoid
GOTO 1000                           ; recheck HIGH gears correctly engaged

N2000                               ; LOW range selection
IF #50001 THEN GOTO 5000            ; Engaged in LOW correctly, so finished
M05                                 ; check spindle stopped!
G04 P1.5                            ; spindle slow down - was in HIGH
M94 /61                             ; energise LOW solenoid - OUTPUT #1
M03                                 ; START SPINDLE - CW
G04 P0.2                            ; PAUSE to engage gears
M05                                 ; STOP SPINDLE
M95 /61                             ; de-energise LOW solenoid
GOTO 2000                           ; recheck LOW gears correctly engaged

N5000                               ; In correct range and gears engaged now
M95 /62                             ; check de-energise HIGH solenoid
M95 /61                             ; check de-energise LOW solenoid
M03                                 ; spindle enable CW

As ever, Blogger has screwed up the character spacings. The logic is fairly simple - if a gear change is required, energise the appropriate gear solenoid and then tickle the spindle motor just enough to allow the gears to engage, then check the gear position inputs. These tell the controller if the correct gear is actually meshed - without this test, the gears could grind if the motor is set off full chat before the gears have managed to engage fully.

The issue was the M03 commands (in bold above). Seems this command caused a recursive(?) loop which in turn would crash the CNC12 program.

There's another problem, namely that somewhere along the line, I managed to accidentally change the LOW gear selection input from #50001 to #50006. Fuck nose how that happened - TFSB again, undoubtedly.

And finally, there was a (now) redundant M95 /2 and M94 /1 at the start, which was in the original macro but is now superseded by my content.

M94 / M95 output control:
At this point I got rather confused about the commands for enabling and disabling the spindle, selecting FWD / REV etc. This is somewhat relevant:



So, M94 is used to turn an output ON and M95 is used to turn it OFF. At this point it's rather helpful to know which output is controlled by which variable. The first 16 are allocated already. I'm guessing that the wiring of these system outputs to physical outputs is mapped somewhere, such as the spindle CW and CCW, which are mapped to Acorn's real outputs 4 (purple wire, Yaskawa S1 input, FWD) & 5 (blue wire, Yaskawa S2 input, REV) respectively.


And it seems that outputs 1 (low solenoid) & 2 (high solenoid) are variables 61 & 62 respectively. 
  • So, to turn on the spindle in a FWD (CW) direction using M3, you'd issue a command such as M94 /1 inside the M3 macro and to stop the spindle, you'd issue M95 /1.
  • To turn on the spindle in a REV (CCW) direction using M4, you'd issue a command such as M94 /2 inside the M4 macro and to stop the spindle, you'd issue M95 /2. 
  • To energise the low ratio solenoid (output 1), you'd issue a command such as M94 /61 inside a macro and to de-energise it, you'd issue M95 /61. 
  • To energise the high ratio solenoid (output 2), you'd issue a command such as M94 /62 inside a macro and to de-energise it, you'd issue M95 /62. 
Got that? Good.

The solution:

;-------
; M3 macro - Spindle CW 4.14
; Murray's mods to automatically select high or low ratio.
; Displays message to select auto spindle mode if it is not set
; See 13-8 M94/M95 Output On/Off etc
; See CNC12 manual 13-8 M94/M95 Output On/Off etc - M94 = On, M95 = Off
; M94 /1 turns spindle CW ON
; M95 /1 turns spindle CW OFF
; M94 /2 turns spindle CCW ON
; M95 /2 turns spindle CCW OFF
; M94 /61 turns O/P 1 (Low ratio solenoid) ON
; M95 /61 turns O/P 1 (Low ratio solenoid) OFF
; M94 /62 turns O/P 2 (High ratio solenoid) ON
; M95 /62 turns O/P 2 (High ratio solenoid) OFF
; etc
;-------
IF #4202 || #4201 THEN GOTO 6000 ; skip to end if graphing or searching
IF #61058 THEN GOTO 200         ;skip check if AutoSpindle on - Output1058 is VCP "Autospindle" button LED.
G4 P.1; Dwell 100ms
#140 = 1.5 
N100
IF !#61058 THEN M225 #140 "Please Select Auto Spindle To Continue!" ;61058 = JPO2/SpindleAutoManualLED
G4 P.5; Dwell 500ms
IF !#61058 THEN GOTO 100
N200
;
; Murray's stuff
;
IF #4119 >= 1000 THEN GOTO 1000     ; HIGH range required...
GOTO 2000                       ; ...otherwise LOW range required

N1000                               ; HIGH range selection

IF #50002 THEN GOTO 5000            ; Engaged in HIGH correctly, so finished
M05                                  ; check spindle stopped!
G04 P3                              ; spindle slow down - was in LOW
M94 /62                            ; energise HIGH solenoid - OUTPUT #2
M94 /1                              ; START SPINDLE - CW
G04 P0.2                           ; PAUSE to engage gears
M05                                  ; STOP SPINDLE
M95 /62                            ; de-energise HIGH solenoid
GOTO 1000                       ; recheck HIGH gears correctly engaged

N2000                               ; LOW range selection

IF #50001 THEN GOTO 5000            ; Engaged in LOW correctly, so finished
M05                                  ; check spindle stopped!
G04 P1.5                           ; spindle slow down - was in HIGH
M94 /61                            ; energise LOW solenoid - OUTPUT #1
M94 /1                              ; START SPINDLE - CW
G04 P0.2                           ; PAUSE to engage gears
M05                                  ; STOP SPINDLE
M95 /61                            ; de-energise LOW solenoid
GOTO 2000                       ; recheck LOW gears correctly engaged

N5000                               ; In correct range and gears engaged now
M95 /62                            ; check de-energise HIGH solenoid
M95 /61                            ; check de-energise LOW solenoid
M94 /1                              ; spindle enable CW

N6000 ; jumping out point if graphing or searching

Note also the suggestion from "swissi" (on the Acorn forum) to branch directly to the end of the program if #4201 or #4202 are true, in which case the macro is being called in graphical or searching mode ie the machine is not actually moving. That seemed like a good idea, so I've implemented it (jump to N6000), even if I haven't bothered to test it exhaustively.

Next steps:
I need to finish what I started, namely replicate the same macro for CCW operation. I thought I'd bottom it out for CW rotation firstly (M3), then modify it for CCW (M4). 

So now to modify the M4 macro, like this:
;-------
; M4 macro - Spindle CCW 4.14
; Murray's mods to automatically select high or low ratio.
; Displays message to select auto spindle mode if it is not set
; See 13-8 M94/M95 Output On/Off etc
; See CNC12 manual 13-8 M94/M95 Output On/Off etc - M94 = On, M95 = Off
; M94 /1 turns spindle CW ON
; M95 /1 turns spindle CW OFF
; M94 /2 turns spindle CCW ON
; M95 /2 turns spindle CCW OFF
; M94 /61 turns O/P 1 (Low ratio solenoid) ON
; M95 /61 turns O/P 1 (Low ratio solenoid) OFF
; M94 /62 turns O/P 2 (High ratio solenoid) ON
; M95 /62 turns O/P 2 (High ratio solenoid) OFF
; etc
;-------
IF #4202 || #4201 THEN GOTO 6000 ; skip to end if graphing or searching
IF #61058 THEN GOTO 200 ;skip the check if AutoSpindle is on - Output1058 is VCP "Autospindle" button LED.
G4 P.1; Dwell 100ms
#140 = 1.5 
N100
IF !#61058 THEN M225 #140 "Please Select Auto Spindle To Continue!" ;61058 = JPO2/SpindleAutoManualLED
G4 P.5; Dwell 500ms
IF !#61058 THEN GOTO 100
N200
;
; Murray's stuff
;
IF #4119 >= 1000 THEN GOTO 1000     ; HIGH range required...
GOTO 2000                           ; ...otherwise LOW range required

N1000                                  ; HIGH range selection
IF #50002 THEN GOTO 5000            ; Engaged in HIGH correctly, so finished
M05                                     ; check spindle stopped!
G04 P3                                 ; spindle slow down - was in LOW
M94 /62                               ; energise HIGH solenoid - OUTPUT #2
M94 /2                                 ; START SPINDLE - CCW
G04 P0.2                              ; PAUSE to engage gears
M05                                     ; STOP SPINDLE
M95 /62                               ; de-energise HIGH solenoid
GOTO 1000                          ; recheck HIGH gears correctly engaged

N2000                                 ; LOW range selection
IF #50001 THEN GOTO 5000 ; Engaged in LOW correctly, so finished
M05                                    ; check spindle stopped!
G04 P1.5                             ; spindle slow down - was in HIGH
M94 /61                              ; energise LOW solenoid - OUTPUT #1
M94 /2                               ; START SPINDLE - CCW
G04 P0.2                            ; PAUSE to engage gears
M05                                   ; STOP SPINDLE
M95 /61                             ; de-energise LOW solenoid
GOTO 2000                        ; recheck LOW gears correctly engaged

N5000                               ; In correct range and gears engaged now
M95 /62                             ; check de-energise HIGH solenoid
M95 /61                             ; check de-energise LOW solenoid
M94 /2                              ; spindle enable CCW


N6000 ; jumping out point if graphing or searching

Good stuff - that tested out OK. It automatically selects the right gear range in either direction (M3 or M4), depending on whether the required spindle speed is above or below the threshold speed - which I have arbitrarily set to 1000rpm. The spindle motor is capable of decent torque down to around that speed but a low ratio makes sense below that for operations such as tapping and large drilling.

Next issue:
The VFD is being set to the commanded speed, ignoring the low gear ratio. So if I ask for 100rpm, the motor itself spins at 100rpm and the spindle then turns at something dumb like 20rpm. I'll need to dig into the manual a bit further to see how to take account of the gear ratio. Clearly the motor would need to be spinning at around 500rpm(?) or so in this example. It may be because fitted an encoder to the motor for rigid tapping perhaps?

Saturday 18 May 2019

Uh-oh. Another Centroid Acorn update (4.16). Gah, bollocks!! ## FIXED ##

Centroid updates - some history:
I forget what version number I first installed (4.10, in March 2018??) but periodically Centroid have released updates that address bugs and annoyances. I struggled to configure the Renishaw probe and electronic tool setter (ETS) when I first installed them and found that subsequent "updates" required a fair degree of buggerage before I could reinstate the previous functionality. This was becoming rather tedious, requiring me to print out and manually compare the myriad parameter settings. Although the documentation is reasonably comprehensive, there are various parameters hidden away that seem to interact in ways that aren't at all obvious.

I've been running a stable version 4.14 for a couple of months now (March 2019?), so am loath to screw things up. However, the upgrade process has become more robust and (dare I say) successful over the most recent upgrades. This version seems to have a lot of thought put into it and doesn't require any obvious risk to the existing, stable installation. You create a "report" (backup file), rename the folder and use the various settings / config files from your existing setup to configure the CNC12 update (via the utility menu) and the Beaglebone Green settings (via the Wizard tool). On the face of it, it's fairly simple and idiot proof. However, as I seem to recall some (relatively minor) issues with the last update, there may need to be some minor fiddling required. I documented them on this blog, so if I find any loss of functionality, I'll refer back to those notes - that's the main reason I keep this blog.

Let's have a go at this:

Update to v4.16:
The update process is explained here on the Centroid Acorn forum.

Keith's done a video on Pootube. Looks pretty straightforward on the face of it:



Ah well, I can report that the installation went pretty smoothly. It's a vast improvement on the previous experiences. However, with the new version, I have completely lost ALL probing and tool setting functions. On the last update (to 4.14 from 4.10), pretty much everything worked out of the box. Bummer.

Opening the "report" text file for each version, side by side in a text editor, it's pretty easy to compare the parameters. I can't see any obvious differences, which may be because the "backup" procedure in the update process actually loads the parameter values from the last install. But if they have been fiddling around under their hoods (fnnnaaar!!), those original parameter values may now be incorrect, ie applied in a different way.

Well that was a waste of the best part of 2 hours.

Posted the issue on the Acorn forum and will have to see if anyone else has had the same issue. Or if the Stupid Fat Bloke has been at large again.

Time will tell......

The fix:
Well, I got lucky. Marty suggested I disable one of the probe inputs (eg either the probe or the TTS) to see if this told us anything about the underlying issue. I half-randomly chose to change Input 4 from "Probe Tripped"to "Unused" and as if by magic all the functionality returned. That clearly involved a great deal of luck, given that I could have chosen either of the other 2 probe-related inputs and / or selected NC vs NO switch polarity. But fortune favours the brave!

I tested Zref, tool length ofsfets and the Renishaw probe functions. I haven't done full validation testing by any means but it's got me reasonably convinced that we have a goer.

Sunday 12 May 2019

Tool length offset (M886) and WCS Z0 (M887) macros sorted

Tool length offset macro - done:

Notwithstanding the annoying way Blogger screws up the spacings when you paste text into a post, this macro seems to work for my purposes. Most of the changes seem to me to be adding comments and messages in English - simply understanding what needed to be done and how the simple BASIC-like macro language works was the main challenge.

STATUSINFO(Stop tool at tool setter top and "redeem" length offset);
MOVE(G90,F#386,Z#382);         // Move to machine coordinate Z#382
IF (+#387) THEN;                 // Setter is in "fixed" position
STATUSINFO(Moving to tool setter location);
MOVE(G90,F#386,X#380,Y#381);         // Move to machine coordinate X#380, Y#381
ENDIF;
// Now seek the tool setter
STATUSINFO(Seeking tool setter);
MOVE(G90,F#383,Z#388,W+25); // Move to Z#388, stop once X25 goes high
PAUS160;                          // Pause for 160ms
IF (-X25) THEN;                  // Error - didn't see X25 go high....
MESSAGEBOX(Fault: The tool setting signal wasn't detected!)
ERREXIT;                         // End macro due to error
ENDIF;                 // 
// Now back off and release the tool setter
STATUSINFO(Backing off from tool setter);
MOVE(G90,F#384,Z#382,W-25);         // Move towards Z#382 (Zmax) until X25 goes low
IF (+X25) THEN;         // Error - didn't see X25 go low again
MESSAGEBOX(Fault: The tool setting signal wasn't released!)
ERREXIT;                         // End macro due to error
ENDIF;
// Tool is now touched off on tool setter - need to "redeem" this tool length in the table
MESSAGEBOX("Enter" to clear message, "Redeem" > select tool # > "A" to save tool length offset)
RETURN;

To make it work, run it (M886 in the MDI interface), then close the final message and "redeem" the current position into the tool table as a length offset, making sure the correct tool his highlighted in the table first. Like this:



Macro M887 to set G54 etc Z0 coordinate:
Next, use the tool setter to find WCS (G54 etc) Z0. The tool setter height is stored in Other #389 (currently measures 42.240 mm), so it's a simple(?!) matter to touch off on the setter, subtract the tool setter height ("gap") and set the WCS Z0 height.

Need to make sure:

  • The correct tool is loaded ie it corresponds to the tool number shown on the main display.
  • We are in the correct WCS ie the WCS called up by the program you intend to run. This is also shown on the main display.
  • The setter height is correctly saved to Other #389.

Then:

  • Use same the seek function from above to locate the top surface of the tool setter.
  • Use SETWK(Z#389), which should set the current WCS Z0 at the bottom of the tool setter.
It's the same result as pressing the "Setup" button and touching off on the workpiece, with the added convenience(?) of automatic touchoff and reduced risk of The Stupid Fat Bloke damaging tools and/or work by touching off a fragile tool onto a hard surface.


Let's try that - M887:
STATUSINFO(Stop tool at tool setter top and set current G5# Z0 at tool setter base);
MESSAGEBOX(Ensure current Tool#, WCS and setter height are correctly set)
IF (+#387) THEN;            // Setter is in "fixed" position
STATUSINFO(Moving to tool setter location);
MOVE(G90,F#386,X#380,Y#381);      // Move to machine coordinate X#380, Y#381
ENDIF;         // 
                                                        // Now seek the tool setter
STATUSINFO(Seeking tool setter);
MOVE(G90,F#383,Z#388,W+25);       // Move to Z#388, stop once X25 goes high
PAUS160;                 // Pause for 160ms
IF (-X25) THEN;         // Error - didn't see X25 go high....
MESSAGEBOX(Fault: The tool setting signal wasn't detected!)
ERREXIT;                 // End macro due to error
ENDIF;         // 
                                                        // Now back off and release the tool setter
STATUSINFO(Backing off from tool setter);
MOVE(G90,F#384,Z#382,W-25); // Move towards Z#382 (Zmax) until X25 goes low
IF (+X25) THEN; // Error - didn't see X25 go low again
MESSAGEBOX(Fault: The tool setting signal wasn't released!)
ERREXIT;                  // End macro due to error
ENDIF;
// Tool is now touched off on tool setter - need to subtract setter height to find Z0
MESSAGEBOX(Current WCS Z0 is now set at base of tool setter with current tool)
SETWK(Z#389); // #389 is the height of the tool setter

RETURN;

That work nicely (finally!!). Placing the tool setter on the top surface of the workpiece and running 

A Few Issues:
That was a royal PITA, not least figuring out which variables to call up. Particularly frustrating to be struggling with something so simple but making such slow progress.

Without getting specific, it's clear that the macro documentation is missing a few details and contains a few errors. 

Tool Setter Hysteresis:
Occasionally I was getting the "Fault: The tool setting signal wasn't released!" error message at the end of the "backing off" phase. This is due to noise on the contact signal. The tool is backed off until the tool loses contact with the setter at which point input X25 is released. However, if the signal at X25 is intermittent / noisy, it can reappear in time to cause trouble with the next line ("IF (+X25) THEN;"). The simplest solution would be to have some mechanical hysteresis in the detector switch. But my Toytown tool setter has no such sophistication and isn't about to any time soon.

At this point, The Stupid Fat Bloke piped up with a typically dumb idea, namely why not implement some form of hysteresis in the macro? Cue the best part of an hour trying to compare the current machine height with the target height (#382), all to no avail. Finally I saw sense and told him to fuck off and leave me alone. I then simply removed the test of X25 and associated error message (bold in the last macro code above). Quite simply, if the tool manages to reach the top of travel, it clearly hasn't triggered the X25 input. That shouldn't have gone unnoticed by the operator, as it will have taken ages to get there. So the final part of the macro is now:

......
// Now back off and release the tool setter
STATUSINFO(Backing off from tool setter);
MOVE(G90,F#384,Z#382,W-25);  // Move towards Z#382 (Zmax) until X25 goes low
// Tool is now touched off on tool setter - need to subtract setter height to find Z0
MESSAGEBOX(Current WCS Z0 is now set at base of tool setter with current tool)
SETWK(Z#389);          // #389 is the height of the tool setter

RETURN;

Sometimes it's best to cut out the smartass buggerage and make a pragmatic judgement. 

Phew - so now I have M886 (tool length offsets) and M887 (set Z0 in current WCS).

Friday 10 May 2019

More probe fodder - ruby/ceramic stylus from AliExpress

Given the recent probing activity, I finally got round to obtaining some spare tips for my Renishaw probe. For simplicity, I chose to go with styli of the same size as the one that came with the probe, namely:

  • M4 thread
  • 6mm ruby ball
  • 50mm length (to centre of ball)
  • Ceramic shaft (5mm dia)
After a bit of buggering about I found some on AliExpress for ~£30 each. Ordered a couple and they arrived today. Ordered on 19th April, so took 3 weeks to arrive.

They look OK. Unless they are grossly non-spherical or made of plastic, what could go wrong here? You have to dial them in to remove any runout, regardless of where you buy them and the other dimensions and materials look pukka. 

Here's one of the new styli alongside the original. Apart from some grubby fingermarks, there's no obvious difference. Oh, wait, the cross hole is in a slightly different place.


I expect I'll now enjoy my first breakage shortly....

Tool length offsets - basics

Tool length offset conventions:
Although it's far from rocket science, you need to be clear in your mind what is going on before you can write a macro to do what you need of it. For instance, you could get into a fine old state if you started mixing up machine coordinates (G53) and work coordinates (G54 etc). Generally, tool length offsets are created using machine coordinates so that they are not screwed up by changes in work origins etc. However, work coordinates are obviously set relative to a particular workpiece setup. You want to get your tool offsets set up so that they work with any subsequent work setup. On a good day, you'd not want to have to reset your tool length offsets each time you move the work. 

Use of the "Reference tool" for tool length offsets:
Whether or not you have either a Renishaw-type probe tool or a touch pad tool setter, the approach to determining tool length offsets is fairly well established. Indeed, you don't even need to use any specialised gadgets at all to get the work done.

The concept is fairly simple. You choose a "reference tool" as a standard to compare tool lengths against. In the tool table, this tool will usually have a length offset of zero. There needs to be some fixed height surface for measuring tool lengths to be measured against during the offset measurement process. The Z position of the spindle (G53 coordinates) of the "reference tool" when in touch-off with the reference surface is referred to as "Zref" and as mentioned, it should not change during the subsequent measurement activity. If the reference tool tool is now changed out for a real tool and the touch-off spindle position remeasured, the difference between the current Z coord and the Zref coord is the tool length offset for that tool. A tool that is shorter than the ref tool will have a negative offset length in the tool table and vice versa. Pretty simple really.
  • If you move the table height or use a different surface to touch off against, you will need to reacquire a new Zref value using the same ref tool as before before measuring any further tool length offsets. The existing offsets should then remain valid.
  • If you change the ref tool length, you somehow need to recalibrate it against the existing tools in the table. Presumably you could do this manually by touching off both it and a known tool and frigging the length offset for the reference tool.
  • You can add new tools or change the tools allocated to a position in the table without having to remeasure all the other existing tool offsets.
So for a tool length setting macro, you need to create / nominate a fixed reference tool as the basis for the calculations. Then determine the Zref height with that tool fitted. Then determine the length difference from Zref to each subsequent tool. On the Newker controller, the "Redeem" (tool offset) screen allows you to save the current machine Z coordinate as the length offset, so the macro could simply park the tool at the touch-off position and get you to save the resulting change in machine position to the correct tool number offset. Even better, though, would be to save the value directly to the table. Is there a way to tell it which tool number we are currently measuring though?

Work Coordinate System (WCS) setting:
Once the tool length offsets are taken care of, the rest is fairly straightforward. The Newker controller allows the current machine position to be stored as the current WCS (press the "Setup" panel button) - and the G43 tool length offset command automatically compensates for tool changes. 

I really just need to create a macro to take care of setting up tool length offsets and the rest should follow. Given that the Newker system comes with pre-existing user programmable macros M880 - M885 and claims to recognise up to M889, it looks as if there is room for at least 4 additional macros of my own design, starting with M886.

Game on.

Newker macros - baby steps...

Loading a modified macro:
Let's try editing an existing macro (M882, aka UserProgram2) and restoring it to the controller. For one thing, it would be helpful to translate the status and error messages to something I can read and understand.

Let's try this:
STATUSINFO(Tool Z axis setting is a-happening);
IF (+#387) THEN;
MOVE(G90,F#386,Z#382);
MOVE(G90,F#386,X#380,Y#381);
ENDIF;
MOVE(G90,F#383,Z#388,W+25);//#1925
PAUS160;
IF (-X25) THEN
MESSAGEBOX(Bollocks - no closing signal seen!)
ERREXIT;
ENDIF
MOVE(G90,F#384,Z#1929,W-25);
IF (+X25) THEN
MESSAGEBOX(Bollocks - no release signal seen!)
ERREXIT;
ENDIF
#50=#5023;
MESSAGEBOX(Well done fat boy. Now run M883!)
RETURN;

Loaded this into the machine and ran it. 
That seems to work. And the error messages come out if you create the right conditions. The "MESSAGEBOX" instruction creates a popup which then requires you to clear it, whereas the "STATUSINFO" instruction simply appears in the green banner thing at the bottom. 

Worth knowing: you can plug in a UFD with only one single file (ProgramUser2 in this case) and the "restore" operation will only upload that file into the system. The subsequent STATUSINFO message tells you to restart the system but in fact it doesn't seem to need it. 


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...