Pause.g and Resume.g with VFD Router Spindle.
-
Hi - I am using a VFD powered router spindle on my CNC machine.
To get it working in the config file I have enabled CNC mode with the M453 command, and disable heater 1 to use for the PWM with a M307 H2 A-1 C-1 D-1 command. I also disabled extruder heater 0 and in used a M42 P1 S1 command in the post processor to enable the spindle.
To turn my spindle on I have to write two macros M3; M42 P1 S1; and to turn it off M5; M42 P1 S0;
It all seems to be working providing I use the custom post processor apart from pausing and resuming.
The job spindle speed is not saved during a job pause, so after resuming it doesn't turn until the next segment in the code where the M3S# code appears. I can add an arbitrary M3S# command in the resume file but this will not reflect original speed - which may be material specific such as slower for plastics or faster for MDF.
-
@EducatingSavvas said in Pause.g and Resume.g with VFD Router Spindle.:
To turn my spindle on I have to write two macros M3; M42 P1 S1; and to turn it off M5; M42 P1 S0;
Why do you need to do that? RRF understands M3 and M5 when in CNC mode.
-
@dc42 My VFD needs a M3[S] command otherwise it won't know what speed to turn.
My frequency drive needs a spindle enable signal to turn the spindle on, and a PWM to set the RPM. Two signals to control the frequency drive.
At the moment if I pause a job the tool completes it's line of g-code, then raises and turns off the spindle. If I resume the without writing a specific m3[S] in the resume.g file the job just plunged back into the cut, moves along the line of g-code until a new segment where the M3[S] command turns it back on.
If I had material there it would have either broken the bit or pulled the material off the wasteboard.
-
@EducatingSavvas said in Pause.g and Resume.g with VFD Router Spindle.:
My frequency drive needs a spindle enable signal to turn the spindle on, and a PWM to set the RPM. Two signals to control the frequency drive.
OK, I see the problem now.
Can you use M3 to set the PWM, and another command to turn the spindle on/off? RRF saves the M3 spindle speed when you pause, and it can be restored using M3 R1.
-
@dc42 Sorry for the late reply - I only just had a chance to test this. I'm still using RRF 2.03 and it didn't work. Is this a feature in RRF3?
My Pause.g file look like:
G91 ; Relative positioning
G1 Z5 F500 ; Slowly move z axis to safe location clearing material
G90 ; Absolute positioning
M5 ; Turn off spindle PWM
M42 P1 S0 ; Turn off spindle enable
M117 Turning off and Raising spindle ;
G4 p1000 ; Dwell while spindle slows to stop
G53 G1 F1000 Z-1 ; move z axis to safe zand Resume.g like:
M3 R1 ; Turn on spindle PWM
M42 P1 S1 ; Turn on spindle enable
G4 P4000 ; Dwell
M291 P"STAND CLEAR! Job Resuming." R"Warning" S3Thanks again.
-
You might need RRF 2.04 to get that functionality.
-
Hi - I just updated the firmware to RRF2.04 but still no luck.
I tried adding M5 G60 R1 to the pause.g file and and M3 R1 but this doesn't seem to send the PWM command to the frequency drive. I even tried putting a M42 P2 R1 command in to see if that works, but that didn't either.
-
@EducatingSavvas said in Pause.g and Resume.g with VFD Router Spindle.:
Hi - I just updated the firmware to RRF2.04 but still no luck.
I tried adding M5 G60 R1 to the pause.g file and and M3 R1 but this doesn't seem to send the PWM command to the frequency drive. I even tried putting a M42 P2 R1 command in to see if that works, but that didn't either.
What M453 command are you using in config.g?
-
I changed the M453 command from M453 S0 P2 I0 R24000 F300 T1 to M453 P2 R24000 in the config file but that didn't change anything. The M3 R1 command in the resume.g file still doesn't seem to recall the PWM signal from P2 after being paused. I tried M3 R0 and M3 in pause.g M5 G60 R0 and M5 in resume.g, but again no luck.
When the job is paused I can see the XYZ coordinates in the console, but I can't see the PWM state.
I did get it to sort of work by commenting out the M5 command in the pause.g file and using the M42 P2 S0 disable the frequency drive - but I'm not happy with that. If something goes wrong with the third party PWM to analoge convert I'm using between the Duet and frequency drive, the spindle is still receiving the PWM speed during a pause and could turn on.
-
@EducatingSavvas Did yyou ever find a solution to this issue?
-
Surely with the conditional code and object model we must be getting close to making this possible through rs485/modbus?
-
@jlipavsky79 Not really. I found some work around where during a pause I sent a M42 P2 S0 to turn off the spindle enable command, but didn't send a M5 to turn off the PWM signal. I'm in the process of updating to RRF3 on a test rig so hopefully I'll test this again and see if there's any differences.
-
When you get to RepRap firmware R3, you can "capture" the PWM from the object model in pause, turn it off in pause, and then re-establish it in resume.
The clean way to do that is a global variable. These are not shipping, yet, in RRF3. HOWEVER... there are unused 'harmless' spots that can be updated in the object model. So those can be used, right now today, to accomplish the same goal.
RRF2 to 3 conversion is a fair amount of work and learning... yet... you could deal with VFD freq today in an OK way, and make it even cleaner when variables ship (which is pretty soon, per David).
-
@Danal Thanks Danal for the pointers - I've just finished converting my config.g and associated files to work with RRF3 and it's behaving as I had previous left it. I'd like to now learn how to implement some of the new features but it's like you say it's a sharp learning curve. Where do I start?
I'm guessing here: https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Using_conditional_GCode_commands_in_bed_g_to_calibrate_a_delta_printer
Does this mean we'd be able to eventually write scripts which can process g-code in real time? For example to enable a 4th or 5th axis for following vectors angles for a tangential knife cutter?
Cheers, Savvas
-
@EducatingSavvas said in Pause.g and Resume.g with VFD Router Spindle.:
Does this mean we'd be able to eventually write scripts which can process g-code in real time?
Yes.
I'd phrase it as "actions that occur interleaved with G-Code statements as they complete", but I think we are saying almost the same thing.
-
Currently the spindle speed is usually not saved in restore point #1 when you pause the print. I will try to fix that in the next 3.01RC. Meanwhile the following may work, but I have not tested it:
- At the start of pause.g use G60 S0 to save the spindle speed in restore point #0. After that you can turn the spindle off.
- In restore.g use M3 R0 to restore the spindle speed, then a G4 command to allow the speed to be reached.
-
@dc42 Thanks that worked. For reference my pause.g file now looks like:
G60 S0 ; Save Spindle Speed
G91 ; Relative positioning
G1 Z5 F500 ; Slowly move z axis to safe location clearing material
G90 ; Absolute positioning
M5 ; Turn off Spindle PWM
M42 P0 S0 ; Turn off spindle enable
M117 Turning off and Raising spindle ;Display message
G4 p1000 ; Dwell while spindle slows to stop
G53 G1 F1000 Z-1 ; move z axis to safe zand resume.g like:
M3 R0 ; Turn on PWM
M42 P0 S1 ; Turn on spindle enable
G4 P4000 ; Dwell
M291 P"STAND CLEAR! Job Resuming." R"Warning" S2 ; Display message and wait prompt -
@Danal said in Pause.g and Resume.g with VFD Router Spindle.:
interleaved
So much to learn... so little space in my head.
-
I've put a fix in the firmware source so that in future the spindle speed will be saved in restore point 1 along with the other parameters when you pause.
-
@EducatingSavvas In RRF3.01 RC6 you can now remove the line G60 S0 ; Save Spindle Speed from the pause.g file and change M3 R0 to M3 R1; Turn on PWM in the resume.g file.