Duet Wifi independent dual X & Y Axis + Endstops configuration

Hey,

I’m building a MPCNC and need help with the duet wifi configuration. I have the following hardware:

2 Motors X + 2 Endstops
2 Motors Y + 2 Endstops
1 Motor Z

I have the latest Duet Wifi v1.04. I have just a basic knowledge and need help how to set up the dual axis in the firmware. I connected the second Y motor to the E0 and the second X motor to the E1 slot on the duet. The same for the endstops.

Please help me how to set it up correctly. Thanks.

(Sorry if this dual posts, the forum eat my edit!)

Hey,

In config.g you need to bond together your pairs of X and Y motors but also setup a U and V axis for the second motor of each pair which we will use later:

M584 X1:2 Y3:4 Z0 U2 V4 P3 ; Apply custom drive mapping.

Then if you are running the very latest beta firmware you can remap if your end stops to match. If not you can physically swap them round but that does suck quite a lot so I recommend you upgrade. When remapping end stops the C parmeter names the drive number as per the pictures on the duet3d website.

M574 X1 S1 C1
M574 Y1 S1 C3
M574 Z2 S1 C0
M574 U1 S1 C2
M574 V1 S1 C4

 

Make sure you setup speeds, accelerations and currents for All axis including the U and V (I’ve not tried it myself or looked at the code but I’ve read this is required.)

Then when we home we are going to break that bonding of the motors apart and home the motors independently (but both motors on the axis at the same time.). To do this you need custom homex.g and homey.g files :

; Home x

M584 X1 P5; split x axis
G1 S1 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 S1 X-1500 U-1500 F300 ; move slowly to X and Y axis endstops once more (second pass)
M584 X1:2 P3 ; join x axis

G90 ; absolute positioning

; home y

M584 Y3 P5; split y axis
G1 S1 Y-1500 V-1500 F2400 ; move quickly to X and Y axis endstops and stop there (first pass)
G1 Y3 V3 F2400 ; go back a few mm
G1 S1 Y-1500 V-1500 F300 ; move slowly to X and Y axis endstops once more (second pass)
M584 Y3:4 P3 ; join y axis
G90 ; absolute positioning

 

You could do a home all too and drive all 4 motors at the same time but I’ve not bothered yet.

 

I’d strongly suggest you turn down the motor current to the minimum you can get away. The P3 and P5 parts are important, don’t leave them off they not only affect the access which are displayed on the web interface but I’m pretty sure it doesn’t work without them (but havent retested this since I got it working).

The duet3d G code documentation is very complete and up date and will do a better job at explaining the specifics than I will so you can look up what all the above means :slight_smile:

The hardest part is getting the correspondence between the motors switches right but you’. It’s very confusing but you’ll know when it’s wrong! Make sure your end stops will result in a reasonably square setup before you start! It should be possible to fine tune squareness from software but I’ve don’t fully squared up my machine yet as I can’t find my framing square!

Good luck!

Mike

 

 

3 Likes

Hey,

thanks for your response. I got it almost working except for Z and V (second Y axis). The X axis is working fine on both motors. I updated to the latest beta firmware.

My connection to the board is the following:

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

This is my config.g:

; Configuration file for Duet WiFi (firmware version 1.21)
; executed by the firmware on start-up
;
; generated by RepRapFirmware Configuration Tool v2 on Sat Mar 09 2019 22:37:11 GMT+0100 (Mitteleuropäische Normalzeit)

; General preferences
M584 X0:4 Y1:3 Z2 U4 V3 P3 ; Apply custom drive mapping
G90 ; Send absolute coordinates…
M83 ; …but relative extruder moves

; Network
M550 P"MPCNC" ; Set machine name
M552 S1 ; Enable network
M587 S"XXXX" P"XXXXX" ; Configure access point and IP addresses. You can delete this line once connected
M586 P0 S1 ; Enable HTTP
M586 P1 S0 ; Disable FTP
M586 P2 S0 ; Disable Telnet

; Drives
M569 P0 S1 ; Drive 0 goes forwards
M569 P1 S1 ; Drive 1 goes forwards
M569 P2 S1 ; Drive 2 goes forwards
M569 P3 S0 ; Drive 3 goes backwards
M569 P4 S0 ; Drive 4 goes backwards

M350 X16 Y16 Z16 E16 I1 ; Configure microstepping with interpolation
M92 X100.00 Y100.00 U100.00 V100.00 Z1600.00 ; 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 X2000.00 Y2000.00 U2000.00 V2000.00 Z2000.00 I30 ; Set motor currents (mA) and motor idle factor in per cent
M84 S30 ; Set idle timeout

; Axis Limits
M208 X0 Y0 Z0 U0 V0 S1 ; Set axis minima
M208 X731 Y731 Z108 U731 V731 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

; 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 P0 D0 ; Define tool 1

; 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

And this is homex.g:

M584 X0 P5; split x axis
G1 S1 X730 U730 F500 ; move quickly to X and Y axis endstops and stop there (first pass)
G1 X3 U3 F500 ; go back a few mm
G1 S1 X730 U730 F150 ; move slowly to X and Y axis endstops once more (second pass)

M584 X0:4 P3 ; join x axis
<code></code>G90 ; absolute positioning

 

homey.g

M584 Y1 P5; split y axis
G1 S1 Y-730 V-730 F500 ; move quickly to X and Y axis endstops and stop there (first pass)
G1 Y3 V3 F500 ; go back a few mm
G1 S1 Y-730 V-730 F150 ; move slowly to X and Y axis endstops once more (second pass)
M584 Y1:3 P3 ; join y axis
G90 ; absolute positioning

Where’s the difference between the x and y axis? Why is x working and y not?

I assume that’s a typo on the first axis and you mean the Y axis doesn’t work. I can’t see anything obviously wrong with your config. Your motor currents are pretty high but I don’t now what steppers you have or how hot you like them! Keep an eye on driver temperatures, if they shutdown you could have issues.

Assuming both motors are moving ok you can test the endstops by splitting the axis manually by issuing “M584 Y1 P5” and then going to Settings->machine properties tab. If you poke at the switches you should the endstop hit column change. With the axis split you can also job the motors a mm or two to check you have them wired they way you think.

It could even be mechanical, trying to force the machine two far away from it’s natural resting “squareness” will result in a running out of torque and motors skipping. If that’s the case, sort out the physical squareness best you can first.

If that doesn’t reveal the issue try and post a bit more detail about exactly what the symptoms are.

~

Mike

 

 

1 Like

Thanks, but unfortunately that doesn’t really help with the problem, so I’ll post more details in the following:

When I try to home the axis both X Axis (X+U) are working fine. They are moving simultaneously and the endstops are working fine.

At the Y Axis (Y+V) only one (Y) motor is moving. The other (V) isn’t moving at all. I did a motor test, after that and the motor is working correctly.

 

I got these motors: https://www.omc-stepperonline.com/de/nema-17-bipolar-1-8deg-65ncm-2-1oz-2-1a-3-36v-42x42x60mm-4-drahte.html

So I think the current should be ok, what are you thinking? I have an eye on the temperature and if they rise to high I will add active cooling.

 

I didn’t try the “M584 Y1 P5” command yet, but I’ll try this later and wanted to give you more information first.

 

The issue with Z is it isn’t moving at all. When I try to home it I just hear the sound of skipping steps. But when I move it by hand, there’s no binding and it’s really smooth.

I don’t understand why the X axis is working as it should be and the Y axis is not, with the same settings in the config.

Easy one first, your Z-axis steps per mm look wrong they should be 400 if you have a T8 screw like me. At 1600 that motor will be trying to go ungodly fast and running out of torque so it looses steps.

I notice this difference to my config :

M350 X16 Y16 U16 V16 Z16 I1 ; Configure microstepping with interpolation

I configure microstepping for U and V, not sure if that’s bull or not but you are only doing X, Y, Z and E So you’re missing at least one axis there.

If that doesn’t fix it this is the order I’d attack it in: Disconnecting the belt from the V motor and see if it moves then to rule out binding and try turning the motor by hand. Failing that, You can check the motor winding with a multimeter I’d do this at the duet end to rule out cable issues too, they should be about 1.6 ohms according to those specs. From memory the pairs are side by side on the duet connector the notation is confusing on their diagram - If you have your pairs crossed it won’t work or maybe you have a bad connection. Watch out for the crimp connections, bad crimps are the bane of my life and can be hard to spot. If that doesn’t solve, try swapping the Y and V motors, see if the problem moves. If it looks like it’s the port at fault it’s either a config problem I can’t see yet or a dead driver.

Just in case you’ve not already read this, it’s a bad plan to plug or unplug motors with the board powered because you can (apparently) kill stepper drivers this way. (I’ve killed FETs this way but never a stepper driver)

As for motor current, those motors are indeed rated to 2.1Amps but that’s normally with the max rated temperature rise which is 80C looking at the specs. The motors should in theory survive at 80C - I doubt your plastic mounts will :-). I run at 1.3A and don’t find I’m torque limited but whatever people on here recommend really - I’m an MPCNC novice. I test my homing at 0.6A to avoid breaking anything. You will not have noticed a heat problem so far because you have your idle current set to 30% of your 2A max or 0.6amp when they have been stationary for a few seconds. Once you start making chips they get’ll get hot pretty quick if they are anything like steppers.

~

Mike

1 Like

I changed the Z axis steps/mm to 400, but it’s still skipping steps. I found out that no matter which direction I want it to go, it always goes down.

I also changed the microstepping to M350 X16 Y16 Z16 U16 V16 I1

I sended a “M584 Y1 P5” to split the axis and also a G92 to avoid homing. Independently the motors are running, but when I bridge them together only one motor is moving. I also changed the plugs on the duet and the issue is moving with it.

I didn’t check the pairs and the crimps, because the motor is working. So I think it should be software related.

Here’s my homez.g if that’s any good:

; homez.g
; called to home the Z axis
;
; generated by RepRapFirmware Configuration Tool v2 on Sat Mar 09 2019 22:37:11 GMT+0100 (Mitteleuropäische Normalzeit)
G91 ; relative positioning
G1 Z5 F6000 S2 ; lift Z relative to current position
G1 S1 Z-113 F1800 ; move Z down until the endstop is triggered
G92 Z0 ; 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 S2 Z5 F100 ; lift Z relative to current position
;G90 ; absolute positioning

I don’t think diagnosing two separate issues at the same time is doing us any favors. Let’s focus on the Y axis for now as that’s the most complex and we’ll come back to Z once Y is working.

You seem to have contradictory results there, which is very interesting.

a) You say both motors can be jogged from software if the axis are split. - Which indicates the hardware is all good and this is a software setup issue when axis are combined.

b) You say if you move the plugs for these motors the fault follows the plug - Which indicates there is faulty wiring and/or motor. (Most likely wiring)

Am I misunderstanding something ? When you say plug, you do mean the bit attached to the wire ? (Some may call that a socket as it’s female)Is the

motor that’s not turning vibrating or totally dead ?

 

What commands are you using to test it ? Are you jogging it around or asking it to home ? Asking it to home requires both the motors and the endstops are setup correctly both physically and in software so just testing with jogging is the best place to start. Once we know we can do simple moves we can attack homing with end stops.

Almost incidentally, your max instantaneous speed changes for X and Y (and U V) look a little aggressive, even your acceleration is pretty high but my machine isn’t on right now so I can’t double check the exact values I have. I’d suggest halving these while we test, you can always chase speed later. Next time I have my machine on I’ll get my values which I took from the values in the marlin code V1Engineering use.

I would definitely check the crimp pairs if I where you. If you split the phases you’ll end up with a motor that will vibrate but not rotate! (Don’t ask how I know). The coils pairs should be adjacent on the duet connector.

~

Mike

 

 

 

 

I made a mistake, sorry :wink:

So in the normal setting the Y axis is working, while the V axis isn’t. If I swap the sockets of Y and E0 (V axis) on the board, the V axis is working, while the Y axis isn’t. The issue seams to stay at the E0 drive.

First I used homing and the endstops were working, then I used a G92 command to ignore homing and used the machine control to move the axis.

I will check the crimp pairs, but I think they should be fine since both motors are rotating. Could be the issue with Z.

As long as the Y axis is combined with the V axis the motor of V is totally dead. But when I split them with M584 and ignore homing with G92 both of them are working just fine.

Cool, that makes sense. Agree, Z could be wiring.

 

Given it looks like E0 seems to be the issue I reexamined your config and noticed you define a drive for an extruder :

 

; Tools
M563 P0 D0 ; Define tool 1

 

I think you still need to define a dummy tool but don’t give it a drive - My bet is you can’t use a drive as an axis if it’s already setup as an extruder. With that said it doesn’t seem to be set to the problematic drive but I don’t have time this morning to check the docs. Worth a look.

 

~

Mike

 

1 Like

Thank you. I really appreciate your help.

I removed the drive from the tool, but still wasn’t able to home. There was also a loose crimp on the Z-stepper and also on the socket of an Y-endstop. Everything is working now.

Estlcam seems not to work with Duet. What program are you using for your CNC?

The firmware will not but the CAM/ Gcode should if you select the correct output type.

Okay, which one is the correct output type for the duet wifi?

The board does not matter it is what firmware you have on it, if you are not using Marlin I am not sure what you should be using, there is a long list built into Estlcam, just find your firmware.

All I see is the controller hardware. Is it this or where can I set the firmware and what is it for RepRap?

4th picture down on this page, https://www.v1engineering.com/estlcam-basics/

I have zero experience with the duet, you need to know what firmware you are running and some of the settings, to make a choice from this list.

 

I use Estlcam, works great just save the g-code, upload it using the Duet web interface and go for it! You can use marlin settings (and can even put duet in marlin compatibility mode) if you want. Right now I just use the “Default” setting in Estlcam and have some custom commands for doing a pause with a message for tool changes etc. but that’s going to get very specific to my machine. To be honest the g-code used by Estlcam is pretty strait forward and duet supports spindle commands (when in cnc mode), curves etc. I have not had any problems so far.

I even use z probing and have machine coordinate frame setup which has the advantage that software machine limits work correctly and you can set the work origin on the duet web interface, but my advice would be to start simple.

I don’t attempt to control the duet in real time from Estlcam. I use the duet web interface for that.

~

Mike

1 Like

Awesome info thanks Mike!

Ok got it, but when I try to run the gcode I only get errors like “Outside machine limits” or “finished printing in 0h 0m”. I also set the machine in CNC mode with M453. What can I do?

Caution, this will sound sarcastic: You are trying to move the tool outside machine limits :wink:

 

You have limits setup in the config you pasted last week:

; Axis Limits
M208 X0 Y0 Z0 U0 V0 S1 ; Set axis minima
M208 X731 Y731 Z108 U731 V731 S0 ; Set axis maxima

You can home x/y with limits easily enough but :

a) are you homing Z ?

b) It kind of depends but I bet you your estlcam gcode is moving Z negative - and your lower limit is 0.

You need to set your lower limit to some sensible (or crazy huge) negative number.

I have my lower z set to something sane (and negative) for my machine. Then I manually home z to “up high”, then home x and y automatically.

That would kind of work if I left it there but you don’t have a sane 0 for your work piece top surface. Gcode support multiple coordinate systems and

I set machine coordinates and then zero workplace with a z-probe and manually set x,y 0 with a web interface button via a macro but IMHO you should walk before you run.

 

If you have your limits set sanely you can just jog around the machine and move the bit to just touch the surface then set Z to be 0 with a “G92 Z0” (Please note I haven’t tested this!!).

Then when you run your gcode it should plunge to the depth you gave estlcam…

 

You may want to test this with a fake surface “up in the air” so if it falls you have some time to stop it before things get nasty…

~

Mike