Tool Change Routine Help!
-
Okay, so I admit to having little experience with CNC.
I built an MPCNC machine, and was running it with Marlin on an MKS Gen L board. Actually I was pretty happy with it overall that way, except that the poor little 8bit CPU seemed to bog down on arc commands, which get used a lot with the CAD that I'm using.
Anyway, I thought that the Duet would be a nice upgrade.
So a few things that I need help with.
-
The first time I tried to machine anything it told me that the target coordinates were out of range, because it didn't want to go below Z=0. I want to set my workplace coordinates to the top of the work, so that's where I home the machine. This is apparently not the way to do it, but then... what IS the way to do it?
-
My workaround so far was to set the axis minima to -25.4mm to allow a maximum plunge of 1". This seems awfully hackish to me, and though I don't see wanting to do much more than that, there might be a reason to at some point., and I would rather be able to set it to be able to go maybe 1mm into the spoilboard, just I don't know how to set the workplace zero well.
So my questions are:
*Can I home the machine to the spoilboard using the touchplate, then set the workspace Z=0 to the top of the material using the touchplate? What command would do this?
- When I change tools, I need to reset the workspace Z=0 for the new tool length? How do I do that?
Currently in Estlcam, my tool change routine looks like this:
M05 G00 X0 Y0 Z30 F2400 M291 P"Change Tool: <n>" R"Tool Change" S3 ;Change tool: <n> G30 ; home Z G00 Z3 M291 P"Power on, Tool: <n>" R"Power On" S3 ; Wait for power on M03
I tried this to change from a cutting bit to an engraving bit, and the engraving bit wants to move through the air 5mm or so above my work piece. I know that the G30 probe works to set the zero to the top of my workspace with the cutting bit, but midway through the job, it seems to not work.
-
-
Oh yeah, one more thing...
During the M291 pause, I want to be able to maintain holding current to the motors, since I'll be using the wrench on the spindle to change tools, and I don't want it to move. In testing, I've had it lose position a couple of times, and then I have to re-home the machine to the endstops in order to find the position again, which I can't do in the middle of a job.(Or can I?)
Edit: More ,machine info.
config.g:
; Configuration file for Duet WiFi (firmware version 3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.2.3 on Tue Apr 20 2021 01:19:12 GMT-0600 (Mountain Daylight Time) ; Monkeyed with by SupraGuy because obviously I know better than the configuration tool, lol! ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"MPCNC Primo" ; set printer name ; Network M552 S1 ; enable network M586 P0 S1 ; enable HTTP M586 P1 S0 ; disable FTP M586 P2 S0 ; disable Telnet ; Drives M669 K0 ; set Cartesian kinematics M569 P0 S0 ; physical drive 0 goes backwards M569 P1 S1 ; physical drive 1 goes forwards M569 P2 S1 ; physical drive 2 goes forwards M569 P3 S0 ; physical drive 3 goes backwards M569 P4 S1 ; physical drive 4 goes forwards M584 X0:3 Y1:4 Z2 ; set drive mapping: X on drives 0 and 3, Y on 1 and 4, Z on 2 M350 X16 Y16 Z16 I1 ; configure microstepping with interpolation M92 X100.00 Y100.00 Z400.00 ; set steps per mm M566 X900.00 Y900.00 Z60.00 ; set maximum instantaneous speed changes (mm/min) M203 X3000.0 Y3000.0 Z180.00 ; set maximum speeds (mm/min) M201 X250.00 Y250.00 Z20.00 ; set accelerations (mm/s^2) M906 X1200 Y1200 Z1200 I25 ; set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout ; Axis Limits M208 X0 Y0 Z-25 S1 ; set axis minima M208 X762 Y940 Z90 S0 ; set axis maxima ; Endstops M574 X1 S1 P"^xstop+^e0stop" ; configure active-high endstop for low end on X via pin ^xstop+^e0stop M574 Y1 S1 P"^ystop+^e1stop" ; configure active-high endstop for low end on Y via pin ^ystop+^e1stop ; Z-Probe M558 P5 C"!^zprobe.in" H5 F120 T6000 ; set Z probe type to switch and the dive height + speeds G31 P500 X0 Y0 Z0.5 ; set Z probe trigger value, offset and trigger height M557 X15:715 Y15:915 S100 ; define mesh grid ; Heaters M140 H-1 ; disable heated bed (overrides default heater mapping) M308 S2 Y"drivers" A"DRIVERS" ; configure sensor 2 as temperature warning and overheat flags on the TMC2660 on Duet M308 S3 Y"mcu-temp" A"MCU" ; configure sensor 3 as thermistor on pin e1temp for left stepper ; Fans M950 F0 C"fan0" Q500 ; create fan 0 on pin fan0 and set its frequency M106 P0 S0 H-1 ; set fan 0 value. Thermostatic control is turned off M950 F1 C"fan1" Q500 ; create fan 1 on pin fan1 and set its frequency M106 P1 S1 H T45 ; set fan 1 value. Thermostatic control is turned on M950 F2 C"fan2" Q500 ; create fan 2 on pin fan2 and set its frequency M106 P2 H2:3 L0.15 X1 B0.3 T25:60 ; set fan 2 value. Thermostatic control is turned on ; Tools M453 C"exp.heater3" Q100 ; Set CNC Mode spindle on heater 3, frequency 100Hz ; Custom settings are not defined G54
pause,g
; pause.g ; called when a print from SD card is paused ; ; generated by RepRapFirmware Configuration Tool v3.2.3 on Tue Apr 20 2021 01:19:13 GMT-0600 (Mountain Daylight Time) ;M83 ; relative extruder moves ;G1 E-10 F3600 ; retract 10mm of filament ;G91 ; relative positioning G1 Z25 F360 ; lift Z above work ;G90 ; absolute positioning G1 X0 Y0 F6000 ; go to X=0 Y=0
resume.g
; resume.g ; called before a print from SD card is resumed ; ; generated by RepRapFirmware Configuration Tool v3.2.3 on Tue Apr 20 2021 01:19:13 GMT-0600 (Mountain Daylight Time) G1 R1 X0 Y0 Z5 F6000 ; go to 5mm above position of the last print move G1 R1 X0 Y0 ; go back to the last print move ;M83 ; relative extruder moves ;G1 E10 F3600 ; extrude 10mm of filament
And while on the subject...
homeall.g; homeall.g ; called to home all axes ; ; generated by RepRapFirmware Configuration Tool v3.2.3 on Tue Apr 20 2021 01:19:12 GMT-0600 (Mountain Daylight Time) G91 ; relative positioning G1 H2 Z5 F6000 ; lift Z relative to current position G1 H1 X-767 Y-945 F1800 ; move quickly to X and Y axis endstops and stop there (first pass) G1 H2 X10 Y10 F6000 ; go back a few mm G1 H1 X-20 Y-20 F360 ; move slowly to X and Y axis endstops once more (second pass) ;G1 H1 Z-95 F360 ; move Z down stopping at the endstop ;G90 ; absolute positioning ;G92 Z0.5 ; set Z position to axis minimum (you may want to adjust this) ; Uncomment the following lines to lift Z after probing ;G91 ; relative positioning ;G1 Z5 F100 ; lift Z relative to current position ;G90 ; absolute positioning
I notice that if I use the "home all" button, it still tries to home Z, even though it's not in this file. I copies this same to a macro "autosquare.g" which does as I expect, that is, it homes the X and Y axes, and leaves the Z alone, since that requires manual intervention.
-
The lack of response makes me think that I might not have asked the question well.
I have been looking at the CNC parts of the Duet and trying to figure out how it's supposed to work. It reads like something that makes sense if you already understand what it's talking about. Unfortunately I don't, so obviously I need more reading there.
I think that I need to set up the machine's homed limits to the actual bed of the machine, and set the machine limits to a reasonable cut into the spoilboard, maybe 2mm or so. I generally try to keep 1mm or less into the spoilboard setting up my CAM.
The problem comes setting up the work coordinate system. Setting X and Y is easy enough with the CNC DWC, jog the machine to position and hit the "Set X" button (Or "Set Y") it's the Z that I'm having trouble with.
I'd rather not have to manually jog to a Z=0 position. This is the reason why I set up the touchplate in the first place, to automate the task of finding Z=0 to the workpiece.
I was hoping there would be a way to use something like G30 to probe the workpiece and set the workspace Z coordinate to zero without resetting the machine coordinates.
I saw references to G10, but that looks like setting a static tool offset for a defined tool. This won't work, because every time I put my base endmill in, it might be a different length, depending on where it sits in the collet, even though it will again be "tool 0" Or am I misunderstanding?
M585 looks like it might be what I'm looking for, so I'm going to set up some code to try that. I hope that I can use the touch plate for it, it appears like it is expecting though that there be a separate Z endstop. I'd really rather not have to add more to the machine itself though at this point.
-
Well, it's 90% working.
My Estlcam tool change routine looks like this now:
; Send the code to turn off the spindle. It doesn't do anything, but leave it there. M05 ; Send the machine to 30mm about the workspace origin to leave room to change the tool G00 X0.0 Y0.0 Z30.0 F2400 M291 P"Change Tool: <n>" R"Tool Change" S3 Z1 ;Change tool: <n> ; Probe the work, and stop when the Z probe is triggered. (reports the machine position, but I don't care.) G30 S-1 ; Set the work coordinate Z to 0.5mm (the touch plate thickness) G10 L20 Z0.5 ; Lift Z to allow the touch plate to be removed G00 Z5 F450 M291 P"Power on, Tool: <n>" R"Power On" S3 ; Wait for power on OK ; Turn the spindle back on. Well, it would if the Duet had any control over the spindle, which it doesn't M03
The problem with this is that it's possible that with a shorter tool in the spindle that I could end up moving outside of the allowable limits of the machine, since it does not reset machine coordinates.
I think that M585 is the answer to this, but I can't get it to work, as it just tells me "no tool selected"
-
@supraguy said in Tool Change Routine Help!:
with a shorter tool in the spindle that I could end up moving outside of the allowable limits of the machine,
I believe those tool commands ignore limits.
I read through M585 and it seems to do the right thing, when you already 'know' the offset you expect. It doesn't overwrite the offset. You have to do that after the endstop is hit.
AFAI understand, in RRF3 it can be the regular endstop, no new endstop or Z-probe required. -
@supraguy said in Tool Change Routine Help!:
The lack of response makes me think that I might not have asked the question well.
More likely you're in a league of your own.
-
@supraguy probing files are here https://forum.duet3d.com/topic/19698/rrf3-2-request-to-enable-g43-g44-tool-height-offset/3?_=1619983109398
Typically, the Z homing switch is on the top of the travel for z, that way it homes away from the workpiece.
My machine has about 95mm of travel from the top to spoilboard and I have my axis limits set as such.
I then use a probe plate to either set the workplace 0 as the top of the piece to be machined or the spoilboard depending on what I'm doing.I need to rewrite my probing procedures now that variables are available but I've not got round to doing this yet.
-
@o_lampe said in Tool Change Routine Help!:
@supraguy said in Tool Change Routine Help!:
with a shorter tool in the spindle that I could end up moving outside of the allowable limits of the machine,
I believe those tool commands ignore limits.
No what I mean is this:
Say I define that I want my machine to not be able to move more than 2mm below the "home" position, which I probe to be the top of the spoilboard. I might want to cut into the spoilboard, but never more than 2mm, this is to be sure that I've cut all the way through the work material.
I start with some features that require removing a lot of material. No problem, this is the tool that I homed with, so it won't cause a problem.
Then I change to a smaller tool, which also happens to be shorter. I reset the work position to the top of the work, but now, instead of (for example) 12mm above the spoilboard, the machine coordinates say I'm only 8mm above the spoilboard. When I try to plunge down to cut through the piece (ie, moving to Z=-13) the firmware will say that I'm trying to move to machine Z=-5. I've set the axis minima to -2, so the firmware will stop the machine, say that the motion is out of limits, and abort the job.
Therefore, what I want to do is reset the tool length, so that it knows that the new bit is 4mm shorter when I change it. This way, if I do something dumb with my CAM and tell it to plunge 19mm into a 12mm work piece, the Duet will say "uh, NO!" before it cuts into one of the T nuts built into my spoilboard and ruins the cutting bit.
@Phaedrux : Oh I hope not. I've always believed that if you're the one that knows the most about what people talk about somewhere, you're in the wrong place. (More commonly, I put it as "If you're the smartest person in the room, you're in the wrong room." but around here, no way I'm the smartest one.) I believe that there are people here who know the answer I'm looking for, but I've probably got terminology entirely wrong.
@jay_s_uk: Thanks, those are very useful. The tool change script that I am using does reset the workspace to the top of the material (Assuming that I don't remove stuff from the origin until after the final tool change, which tends to suit my work flow, since a cut-out operation is pretty much always last.)
I suppose that another possibilty for a tool change is to switch to machine coordinates, re-home the machine after a tool change, thereby resetting the machine coordinates, then switch back to the workspace coordinates, which I believe are stored as a set of offsets from the machine coordinates. In order to do this, I'd have to leave the spoilboard top exposed at a homing location, I guess. I'm not sure that I can always do this though, and for large work pieces, that's when I'm most likely to need to change tools.
I'm going to need to look up those meta commands, to see what is available.
-
@supraguy
I think there is only one save way to try out a new workflow:
Do some dummy stuff with tool 1, change it to shorter tool2; rehome Z and remove tool2 afterwards. Then do some work with the new coords and see what happens... -
@supraguy that's why you should home at max, not at the spoilboard
-
@jay_s_uk said in Tool Change Routine Help!:
@supraguy that's why you should home at max, not at the spoilboard
That doesn't help with different tool lenght's ? Or did I get you wrong?
-
@o_lampe you home at the top with maximum travel. Your maximum height is set so you can plunge as deep as your spindle will allow.
Your height is then always the same, your spoilboard is then always in the same place. You can then use the touchplate to calculate tool length, easily allowing different tools to be used. As soon as you start messing with the homed length you might as well not bother -
@supraguy I think I see the problem. You need two Z min limits. One is for the motion mechanics and apples even if no tool is loaded. The second depends on the tool Z offset and is to stop the tool tip going too low.
M208 commands currently support the following format to specify both minimum and maximum limits:
M208 Z-1:200
I was already considering supporting a third optional value, which would be the position when the homing switch is triggered, useful if that is different from both the minimum and maximum limits. I could add additional parameters to allow setting of limits relative to the tool tip, on the assumption that you specify the tool tip offset using G10 when you change tool.
-
@jay_s_uk Where homing at the top makes sure that I remain within the limits of the machine, it won't keep be from plunging into the T nuts in the spoilboard. Since there is a variety of lengths that the tools could be. I recognize that this makes sense from the machine point of view, and this is the way that the machine currently on the drawing board is going to operate, but I'd have liked to be able to use the firmware axis limits as a safety/sanity check.
@dc42 I'm not sure that it would help. The problem with swapping bits in a router is that the amount of bit sticking out from the collet is different every time I change it, and in fact the router position within the gantry has a certain amount of variability as well, so if I take the router out of the clamp to clean or service it and put it back in, even the collet is in a different position relative to the machine limits. I'm not sure that I want to spend time chasing the machine limits every time I change a bit or service the router.
I believe that in general use, it's safe to say that I am not running any jobs, certainly not creating any jobs that are pushing the envelope of the motion limits of my machine. While homing the tool to the spoilboard isn't optimal, it provided a way (or so I hoped) to use the axis limitations of the machine to give me a convenient way to do a sanity check on my CAM work.
I will get the same end results (or close enough) to homing hte machine at the top and seting axis limits to the machine motion limits if I simply allow the axis limits of the machine to plunge into the spoilboard approximately as much as the most commonly used tool length, which will (most probably) keep the router collet off of the spoilboard, and depend on reasonable CAM to keep from damaging a bit, or T nut. I can actually safely lift the Z axis well beyond its usable range. The bearings on the Z axis slide will lose contact, but they will just contact again as I lower it.
Anyway, this is the first project I completed with the Duet connected to the CNC. It's carved from a piece of 3/4" pine, and houses my PanelDue 5i