MPCNC Duet 2 Wifi Configuration/Setup

So in another thread here https://forum.v1e.com/t/mpcnc-with-duet-2-wifi-burly-20-x20-x3-5-work-area/26855 I have showcased how to use the duet 2 wifi board with the MPCNC. Some folks were interested in seeing the configuration files. I finally got around to pulling them off the board and saving them here. for those that are interested in getting one of the boards and trying it out, I found a cloned version of the open-source duet 2 wifi board on aliexpress
[https://s.click.aliexpress.com/e/_AlRo0C ]

After you get the duet to firmware version 3.2 you can use the attached config.g file, as well as the homeing, pause and resume g files to get your own mpcnc working. You can look through the files and adjust things like axes limits, stepper motor currents and so on. The files are set up to work in dual endstop mode. If anyone wants a full walkthrough on how to get the duet working, let me know and I’ll type it up.

cheers
Alex

Duet 2 Wifi MPCNC firmware.zip (4.0 KB)

1 Like

Thanks for sharing!

I’ve got mine sorted now, and in the process of doing so, I found some things that RepRap Firmware 3.2 does much nicer. For example, when you set the drive mapping so that you get 2 X drives and 2 Y drives, you can configure 2 endstops, (for example ^xstop+^e0stop) and homing X or Y will associate the 2 end stops with the 2 separate drives, so you don’t need to separate out the second X or Y to U and V in your homing files. More convenient.

One of the places that I’m still hoping for a better solution is tool changes. Because I’m homing Z to the spoilboard, I was hoping to be able to use the software stops to limit axis travel to -2mm machine coordinates, but if I change tools, it doesn’t update the machine coordinates, so there’s a possibility that those software stops will limit the machine from going down to the spoilboard. As such, I currently have it set up to allow more plunge than I should need for any tool change. I’m also considering just arranging my CAM to one tool per file, and not doing tool changes, and this seems to make a lot of sense.

The internal pullup resistor on my Z probe input seems a little weak, and I get readings up to about 550 or so analog on the touch plate if I’m touching it with a finger. I bumped up the trigger value to 800 which resolves the problem. Seems really consistent now.

I’ll be re-writing my pause.g and resume.g since I made a rather glaring error in them which results in bad things if you pause in the middle of a deep cut. In fact, your resume.g file still has the same issue. I would suggest a re-write as follows:

; 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
G1 R1 X0 Y0 F2400             ; go above position of the last print move
M400                          ; Wait for all movement to be completed
G1 R1 Z5 F450                 ; Go down to 5mm above position of last cut move

Assuming that the spindle is turning at this point, descending diagonally to 5mm above the last cut if you were more than 5mm down into the material would result in a gouge in the work towards the machine 0,0 location. The original logic works well for 3D printing, but less so for machining, so you do not want any plunging to happen while the tool is still moving in the XY plane.

For pausing, though I did not specify, it does seem to move to the 0,0 machine coordinates, and not the work coordinates for me. I don’t know what you’ve found. Using the machine coordinates works for me though, so I don’t mind, as it tends to clear the work area, and gives me room to clean out the chips, or whatever it was that I wanted to pause for.

very good point, I’ll make the edits to my pause file. I have been doing one gcode file per tool as i like to just take a breather inbetween. That way I also sometimes home the x and y again just to make sure that i didn’t push things around.

I did find that the pause script goes to machine 0,0. Regarding the 5mm height, that is a very good point. I just posted over on the duet forum to see if there is anyway to set the max z height prior to the job. that way instead of using a relative move, we could use an absolute move to the highest point, which would definitely clear the work piece.

regarding the 2X and 2Y axis, I think i used an older RRF vesion as a template and it seemed to be working fine for me but I see your point of making it more convenient. do you mind sharing your config.g file? I am curios to see how you have set it up.

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                                         ; explicitly set Cartesian kinematics, even if I should not need to
M569 P0 S0                                      ; physical drive 0 goes backwards (oops, made the connector the wrong way)
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) 5 centimeters per second, lol
M201 X250.00 Y250.00 Z20.00                     ; set accelerations (mm/s^2)
M906 X1200 Y1200 Z1200 I75                      ; set motor currents (mA) and motor idle factor in per cent. Idle is high to keep it in place when I change tools.
M84 S30                                         ; Set idle timeout

; Axis Limits
M208 X0 Y0 Z-12.5 S1                            ; set axis minima (I want to lower Z to -2.5 when I can get tool change sussed)
M208 X635 Y940 Z90 S0                           ; set axis maxima (25 by 37 inches)

; Endstops
M574 X1 S1 P"^xstop+^e0stop"                    ; configure active-high endstop for low end on X via pin ^xstop+^e0stop with pullup resistors enabled
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 P850 X0 Y0 Z0.5                             ; set Z probe trigger value, offset and trigger height
M557 X15:615 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 Should cool the driver chips if the MCU temp exceeds 25 degrees or thermostatic trigger on the drivers goes off

; Tools
M453 C"exp.heater3" Q100                        ; Set CNC Mode spindle on heater 3, frequency 100Hz not that it's connected.

; Custom settings are not defined
M575 P1 S1 B57600                               ; Enable PanelDUE at 57600 BPS
G54                                             ; Select Workspace Coordinate 1 for DWC CNC mode display

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

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 Z65 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)
; Monkeyed with by SupraGuy after carving a gouge in a nice piece of poplar
; 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
M400                  ; Wait for move to finish
G1 R1 Z5              ; Go to 5mm above last move

As far as setting the max Z height… What I got was to home your machine upwards. Makes sense, I guess, set the machine limits in the soft stops, and it also means that if you then use Z-5 in your pause.g file, it will go to 5mm below the homed height, which ought to be as safe as it gets. I can see a number of good reasons to do this, but don’t want to run another home switch through my freshly re-wired machine to set up another Z homing switch, which also does not have a mounting provision already in place, and is rather difficult to set up on a Primo in the first place, due to the fact that nothing at the top of the core gets closer together as the Z axis goes up, only more distant. I suppose that I could put a screw into one of the Z tubes and trigger when it reaches the top. I’ll need to think on a good solution.

I also have some macros which are useful. Need these more because of the PanelDue, the DWC CNC version already has functionality like this:

ProbeWork.g:

; Probe the work, and set the workspace Z coordinate
M291 P"Attach Z Probe" R"Probe Work" S3 Z1          ; Display message with Z jog buttons
G30 S-1                                             ; Probe the work, (report machine position)
G10 L20 Z0.5                                        ; Set workspace position to 0.5mm
M400                                                ; Wait for save to finish
G00 Z5 F450                                         ; Move 5mm above work piece

ZeroWorkspace.g:

; Set the workspace X and Y to the current machine coordinates
G10 L20 X0.0000 Y0.0000

I have a couple of other macros for dealing with workspace setup, too. The biggest one that I want to get working is a tool change routine that adjusts the tool offset so that the machine coordinates get updated for the current tool. Not a problem with separate files for separate tools, but one of the very nice things with the Duet is the ability to set up the different workspaces and just stamp cuts out, and that tends to mean not walking the machine out of its usable work area.

Here is the latest config files for those that are interested. These are for my rebuilt primo and they use a z-max end stop.

PHOBOT PRIMO.zip (7.9 KB)

2 Likes