MPCNC on Duet Wifi -- configuration sanity check
-
So my COVID project was to build an MPCNC Primo. I built it using an old MKS Gen L board that I had spare, but it seems to have trouble with arc movements, and likes to jerk to a stop when doing those. Besides, I have 2 Duets, and I want the Wifi capability, along with the more powerful processing ability.
The machine is configured with dual endstops for the X and Y axis. I figured that I'm more or less mirror the wiring and configuration that I'm using with the MKS board, which is:
X uses the Z driver and the E0 driver.
Y uses the Y driver and the E1 driver.
Z uses the Z driver.
Endstops are normally closed switches, with a pullup resistor enabled for X and Y axes.
The Z axis is a 0.5mm thick touchplate. My plan is to connect this to the ground and hopefully have a pullup resistor for the Z probe input pin, so that when the grounded tool tip touches the plate, it will register that as a height of 0.5mm.
Assumption: I will need to ensure that the dual endstops are wired to the appropriate connector for the drive motors that I am using.
No extruders. I do not have any on-board control over the spindle, even on/off This might be added later, and I might want to consider laser control and PWM later, too, but for now, I'm happy with the front mounted hardware switch for the router and the top mounted speed control.
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 M569 P0 S1 ; physical drive 0 goes forwards M569 P1 S1 ; physical drive 1 goes forwards M569 P2 S1 ; physical drive 2 goes forwards M569 P3 S1 ; physical drive 3 goes forwards M569 P4 S1 ; physical drive 4 goes forwards M584 X0:3 Y1:4 Z2 ; set drive mapping 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 Z0 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 S0 Y"drivers" A"DRIVERS" ; configure sensor 0 as temperature warning and overheat flags on the TMC2660 on Duet M308 S1 Y"mcu-temp" A"MCU" ; configure sensor 1 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 H0:1 L0.15 X1 B0.3 T25:60 ; set fan 2 value. Thermostatic control is turned on ; Tools M563 P0 D0 F0 ; define tool 0 G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C ; Custom settings are not defined
I haven't monkeyed with the homex.g, homey.g, homez.g, or homeall.g files yet.
homex.g and homey,g will hopefully be fine as-is. I will probably remove the code to home the Z axis from homeall.g, since that is definitely a separate action with the touchplate that requires me to be actively involved in setting up.
I spent some time playing with the fan configuration. I have a 24V 5015 fan aimed over the stepper drivers and will be enclosing the Duet. I want the fan to keep the stepper drivers cool with the relatively high current that I've set (1200mA) in an enclosed space. The fan will direct air mostly at the underside of the board parallel to the drivers. Not sure about this fan for long term use, it seems a little bit unreliable, so I'll probably want to change to something better at some point, which will need a new case, but that's OK.
At present, Fan0 and Fan1 are unused. I'll plan to use the hotend heater output for PWM if/when I implement a laser. Fan1 will probably get used for cooling the diode laser then, too, maybe with a thermistor to monitor heatsink temperature. (Might have to change the MCU/driver temperature drivers from 0 and 1 then.)Anyhow, if anyone spots something that I've done wrong, I'd sure appreciate some feedback!
-
@supraguy I would be putting it in CNC mode using M453 even if you have no spindle control.
Then use the CNC version of DWC -
@supraguy
The meshgrid wouldn't work because the Zprobe expects a metal contact everywhere? -
@jay_s_uk See, this is exactly the sort of thing that I missed with my initial setup. Thank you!
@o_lampe: Well, I could follow the tool around with the touch plate, lol! but I'm not sure how it would work with the workspace coordinate system. I hardly ever want my 0,0 to actually be at the origin of the machine. I defined the grid, but honestly never planned to use it. (Besides, it's a CNC router. I use a 1" surfacing bit and make the spoilboard conform to the rails of the machine.)
-
New 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 M569 P0 S1 ; physical drive 0 goes forwards M569 P1 S1 ; physical drive 1 goes forwards M569 P2 S1 ; physical drive 2 goes forwards M569 P3 S1 ; physical drive 3 goes forwards M569 P4 S1 ; physical drive 4 goes forwards M584 X0:3 Y1:4 Z2 ; set drive mapping 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 Z0 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
Changed the tool section to define a spindle. I've got no spindle control, not even a relay. I might add a relay, at some point. I'd like to be able to swap over to a diode laser at some point, too.
I changed the MCU and driver heaters over to 2 and 3. Not that I plan on putting a hotend or heated bed in, but I was thinking that I might be able to monitor those temps in the DWC, but CNC mode doesn't do that anyway. I do want to keep an eye on them, since I'm running a lot more current through these motors.
-
I have set up a duet 2 wifi board with my MPCNC machine. I have just posted my config and homing files if you are interested. MPCNC firmware forum topic
I was able to get a spindle controller moving with the duet. I got my intial review/showcase video and post here if you are interested:
V1 forum topic on my build -
because I can't post the actual file, here are the different files you might want to look at:
config.g; Configuration file for Duet WiFi (firmware version 3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.2.2 on Wed Feb 03 2021 22:25:58 GMT-0800 (Pacific Standard Time) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"Phobot 2.0" ; set printer name ;M453 ; Network ;M552 S1 ; enable network M552 S2 ; enable access point M586 P0 S1 ; enable HTTP M586 P1 S0 ; disable FTP M586 P2 S0 ; disable Telnet ; Drives ;Drive 2 (Z Motor) = Z ;Drive 1 (Y Motor) = Y ;Drive 0 (X Motor) = X ;Drive 3 (E0 Motor) = Y1 ;Drive 4 (E1 Motor) = X1 M569 P0 S0 ; Drive 0 goes backwards M569 P1 S1 ; Drive 1 goes forwards M569 P2 S0 ; Drive 2 goes backwards M569 P3 S0 ; Drive 3 goes backwards M569 P4 S1 ; Drive 4 goes forwards M584 X0:4 Y1:3 Z2 U4 V3 P3 ; Apply custom drive mapping M350 X16 Y16 Z16 U16 V16 I1 ; configure microstepping with interpolation M92 X100.00 Y100.00 U100.00 V100.00 Z400 ; set steps per mm M566 X900.00 Y900.00 U900.00 V900.00 Z12.00 ; Set maximum instantaneous speed changes (mm/min) M203 X6000.00 Y6000.00 U6000.00 V6000.00 Z180.00 ; Set maximum speeds (mm/min) M201 X500.00 Y500.00 U500.00 V500.00 Z20.00 ; Set accelerations (mm/s^2) M906 X720.00 Y720.00 U720.00 V720.00 Z720.00 I30 ; Set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout ; Axis Limits M208 X0 Y0 Z-20 U0 V0 S1 ; Set axis minima M208 X500 Y500 Z108 U500 V500 S0 ; Set axis maxima ; Endstops ;M574 X1 S1 C0 ;M574 Y1 S1 C1 ;M574 Z2 S1 C2 ;M574 U1 S1 C4 ;M574 V1 S1 C3 M574 X1 S1 P"!xstop" ; X min active high endstop switch M574 Y1 S1 P"!ystop" ; Y min active high endstop switch M574 Z1 S1 P"!zstop" ; Z min active high endstop switch M574 U1 S1 P"!e1stop" ; U min active high endstop switch M574 V1 S1 P"!e0stop" ; U min active high endstop switch ; Z-Probe M558 P0 H5 F120 T6000 ; Disable Z probe but set dive height, probe speed and travel speed M557 X15:195 Y15:195 S20 ; Define mesh grid ; Heaters M140 H-1 ; Disable heated bed ;M305 P1 T100000 B4138 R4700 ; Set thermistor + ADC parameters for heater 1 ;M143 H1 S280 ; Set temperature limit for heater 1 to 280C ; Fans ; Tools ;M563 P1 S"XYZ-Probe" ; Define XYZ Touch Probe Tool ;M563 P0 D0 ; Define tool 1 M563 P0 S"Spindle 1" ;definde spindle as a tool M563 P1 S"XYZ-Probe" ; Define XYZ Touch Probe Tool ;M563 P0 D0 ; Define tool 1 M453 C"e0heat" R13300 Q2000 T0 ; enable CNC mode ;M453 C"exp.heater3+exp.heater4+exp.heater5" Q100 ; spindle PWM on heater 3 pin, on/off on heater 4, reverse/forward on heater 5, PWM frequency 100Hz ; Automatic power saving M911 S10 R11 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" ; Set voltage thresholds and actions to run on power loss ; Custom settings are not configured
here are the homing files:
homez.g; homez.g ; called to home the Z axis ; ; generated by RepRapFirmware Configuration Tool v3.2.2 on Wed Feb 03 2021 22:25:59 GMT-0800 (Pacific Standard Time) G91 ; relative positioning G21 ; Set units to mm G1 H1 Z-500 F1500 ; move quickly to Z axis endstop and stop there (first pass) G92 Z20 ; set height of probe to 15, which is the height of the z touch probe G1 Z3 F2400 ; go back a few mm G1 H1 Z-500 F150 ; move slowly to x axis endstopp once more (second pass) G92 Z20 ; set height of probe to 15, which is the height of the z touch probe G1 Z3 F2400 ; lift z a few mm G90 ; absolute positioning
homex.g
; homex.g ; called to home the X axis ; ; generated by RepRapFirmware Configuration Tool v3.2.2 on Wed Feb 03 2021 22:25:59 GMT-0800 (Pacific Standard Time) G91 ; relative positioning G21 ; Set units to mm G1 H2 Z5 F6000 ; lift Z relative to current position M584 X0 P5 ; split x axis G1 H1 X-1500 U-1500 F2400 ; move quickly to X and Y axis endstops and stop there (first pass) G1 X3 U3 F2400 ; go back a few mm G1 H1 X-1500 U-1500 F150 ; move slowly to X and Y axis endstops once more (second pass) M584 X0:4 P3 ; join x axis G1 H2 Z-5 F6000 ; lower Z again G90 ; absolute positioning
homey.g
; homey.g ; called to home the Y axis ; ; generated by RepRapFirmware Configuration Tool v3.2.2 on Wed Feb 03 2021 22:25:59 GMT-0800 (Pacific Standard Time) G91 ; relative positioning G21 ; Set units to mm M584 Y1 P5 ; split y axis G1 H2 Z5 F6000 ; lift Z relative to current position G1 H1 Y-1500 V-1500 F2400 ; move quickly to X and Y axis endstops and stop there (first pass) G1 Y3 V3 F500 ; go back a few mm G1 H1 Y-1500 V-1500 F150 ; move slowly to X and Y axis endstops once more (second pass) M584 Y1:3 P3 ; join y axis G1 H2 Z-5 F6000 ; lower Z again G90 ; absolute positioning
homeall.g
; homeall.g ; called to home all axes G91 ; relative positioning G21 ; Set units to mm M584 X0 Y1 P5 ; split x and y axis G1 H1 X-1500 U-1500 F2400 ; move quickly to X and Y axis endstops and stop there (first pass) G1 X3 U3 F2400 ; go back a few mm G1 H1 X-1500 U-1500 F300 ; move slowly to X and Y axis endstops once more (second pass) G1 H1 Y-1500 V-1500 F2400 ; move quickly to X and Y axis endstops and stop there (first pass) G1 Y3 V3 F500 ; go back a few mm G1 H1 Y-1500 V-1500 F150 ; move slowly to X and Y axis endstops once more (second pass) M584 X0:4 Y 1:3 P3 ; join x axis M291 P"get ready to home Z-Axis with touchprobe. Click ok when probe in place" R"Home Z-Axis" S3 G1 H1 Z-500 F1500 ; move quickly to Z axis endstop and stop there (first pass) G92 Z20 ; set height of probe to 15, which is the height of the z touch probe G1 Z3 F2400 ; go back a few mm G1 H1 Z-500 F300 ; move slowly to x axis endstopp once more (second pass) G92 Z20 ; set height of probe to 15, which is the height of the z touch probe G1 Z3 F2400 ; lift z a little G90 ; absolute positioning
Pause.g
; pause.g ; called when a print from SD card is paused ; ; generated by RepRapFirmware Configuration Tool v3.2.2 on Wed Feb 03 2021 22:25:59 GMT-0800 (Pacific Standard Time) G91 ; Relative positioning G1 Z5 F180 ; Lift Z to 5mm below the Z maximum G90 ; Absolute positioning M5 ; Turn off the spindle G4 S10 ; Wait for the spindle to stop G1 X0 Y0 F2400 ; 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.2 on Wed Feb 03 2021 22:25:59 GMT-0800 (Pacific Standard Time) M3 R1 ; Restore the spindle speed from before the pause G4 S10 ; Wait for the spindle the get up to speed G1 R1 X0 Y0 Z5 F2400 ; go to 5mm above position of the last print move
you should be able to adjust these to your setup. just be mindful of the end stops and make sure they match your config file. Also, one thing I am trying to figure out is how to set the highest z position. I have had a few instances where my bit was too long and the z-axis moved up to far, skipped a few turns, and then decided it knew where it was. The worm trails it created were amazing I tell you.
-
@leapinglamb Thanks!
I'm replying on the V1 forum now, but the practical upshot is that your resume.g might damage the work if you have plunged more than 5mm into it at the time that you had paused. I see that your pause.g also assumes that you're setting zero tot he top of the machine. I'm guessing that's assuming a height of 20mm + the thickness of your Z probe, at least that's what it looks like from your homeall.g
I still have a few things to tune and tweak with my setup, but it's mostly the tool change that I'm not happy with.
-
ah good point, I just made changes to the pause and resume. I'll give that a try and see what actually happens
-
with my pause, the first step I do is move z all the way to the top of the z travel to get it out the way and then move the spindle away from the workpiece. On resume, I do the opposite