MPCNC and Duet 2 Wifi Setup



  • I am building a MPCNC and trying to setup duet 2 wifi with it.
    Duet is on latest firmware 3.x. My configuration would be:
    X1, X2 motors independently controlled.
    Y1, Y2 motors indendentally controlled.
    Z1 motor.

    1. What should configuration look like for such a setup?
    2. Is it also possible to have 2 limit switch configured as end stops on X and Y axes?

    In order to test the board, I connected only one motor to the X stepper pins. When I try to move the motor using the DWC, I get following error. Would anyone be able to point me to where to start looking?

    M120 G91 G1 X0.1 F6000 G90 M121
    Error: G0/G1: insufficient axes homed
    


  • You need to home an axis to be able to move it.
    Either run G92 X0 to set the axis as homed or send M564 H0 to allow movement without homing.

    Yes, you can run multiple motors together as one axis.
    You would map the motors together to the axis using M584 e.g.

    M584 X0:1 Y2:3 Z4
    

    That uses drivers 0 and 1 (X and Y) for X, drivers 2 and 3 for Y (Z and E1) and driver 4 for Z (E2).

    To use multiple endstops, you would map them like this

    M574 X1 S1 P"xstop+ystop"
    

    That uses the X endstop and Y endstop for the X axis, one for each motor. They must be in same order as M584 mapping. You couldn't have driver 0 using the Y endstop etc.
    Have a go and ask if you get stuck



  • @jay_s_uk

    Thanks Jay for the quick reply! It's 3 30 am here, I'll try this in am and will get back to you if I was successful or not. I really appreciate your help!

    Also, what would be a good starting to figure this out, how did you approach it? I'm a Java developer but new to these M and G codes, how and where shall I start looking.

    I'm pretty sure I'll have more questions. Essentially what i want to do is: V1-Engineering MPCNC Dual End Stops
    I was about to almost gives up on duet and buy a Rambo board. After reading your post, I believe it can be done in Duet as well.



  • I run a printNC off the duet firmware.
    That has dual Y axis and a single X and Z axis.
    You'll need something that will generate the gcode. I use aspire but software such as freecad, fusion 360 will do the job.
    You'll also need to look here https://duet3d.dozuki.com/Wiki/Configuring_RepRapFirmware_for_a_CNC_machine



  • @jay_s_uk said in MPCNC and Duet 2 Wifi Setup:

    You need to home an axis to be able to move it.
    Either run G92 X0 to set the axis as homed or send M564 H0 to allow movement without homing.

    I tried this today and it worked. Thanks a bunch!

    Yes, you can run multiple motors together as one axis.
    You would map the motors together to the axis using M584 e.g.

    M584 X0:1 Y2:3 Z4
    

    That uses drivers 0 and 1 (X and Y) for X, drivers 2 and 3 for Y (Z and E1) and driver 4 for Z (E2).

    I am still new to this, but the way you explained it all makes so much sense. Thank you for providing manual commands on how to do this. Now I will be able to manually set these.
    Question: Is there a way to do it from the webconfigurator? Is there a way to automatically set this on duet boot up or will I have to specify these parameters manually via the DWC on every boot. I want to believe there must be a way to automatically set it by modifying some configuration override file, but I just dont know where or how.

    To use multiple endstops, you would map them like this

    M574 X1 S1 P"xstop+ystop"
    

    That uses the X endstop and Y endstop for the X axis, one for each motor. They must be in same order as M584 mapping. You couldn't have driver 0 using the Y endstop etc.

    My end stops are still on the way, Amazon will deliver them on this Tuesday, I will wait till then to try this configuration. Meanwhile I understand the high level concepts now. With M584, I can set which motor drivers I want for the axes. And then with M574 I can assign which endstops I want to use for the assigned axes (with the limitation that I can only use the same endstop for the axes that has been used for the axes). I looked up and found more documentation here:
    M584: Set drive mapping
    M574 - M574: Set endstop configuration - RRF3

    Have a go and ask if you get stuck
    I will keep you posted on how my build goes. I also looked up printNC and it looks pretty cool. How do you like yours?



  • The online configurator doesn't support multiple axis, although it is planned.
    When you have filled it in, it will spit out, amongst other files, a config.g
    Once loaded onto your board, it can be edited through DWC. You will find it under the systems tab.
    Once edited, the interface will ask you if you want to reboot the board. The config.g will then get loaded at reboot.
    Reprapfirmware (which is what the duet runs) is set to a default setting until you tell it otherwise. The config.g file loads all your settings into memory every time the board is booted. This means that virtually any setting can be changed on the fly.



  • @jay_s_uk said in MPCNC and Duet 2 Wifi Setup:

    Once edited, the interface will ask you if you want to reboot the board. The config.g will then get loaded at reboot.

    This is exactly what I was looking for. Thank you!
    Do i need to tell my CAD/CAM software that I have dual endstops? Or does that only work for homing?



  • The firmware handles it all so set and forget



  • @jay_s_uk

    Ah i see. So if I am understanding it right:

    1. I am currently setting up my MPCNC with RAMPS board with Dual endstops where the marlin firmware handles everything.
    2. If I swap RAMPS with Duet board, I have to plug in motors and endstops correctly on Duet, configure the config.g file correctly with Duet board to make it aware of the endstop configuration, and then RepRap firmware will handle it.
    3. The same g-code that was operational on Marlin framework, will work on the RepRap firmware without any change.

    Is my reasoning correct?



  • @mtcl 1 and 2 is correct.
    The 3rd one probably not as most of the gcode for marlin is in mm/s whereas reprapfirmware firmware is in mm/min.
    There may be some gcode that is also not compatible.
    What are you using to generate your gcode?



  • @jay_s_uk

    Till now I have only used ultimaker cura for my 3d printer to create g code. I haven't used cnc before.



  • I'm enjoying my MPCNC quite a bit, but opted not to use a Duet for it. I did most of the configuration though. (Edit: Was going to include my homex.g, but realized that I still have it set up for older firmware, not the latest, which is a little different.)

    First off, if you want to use the dual endstops (Which I like, auto-squaring the machine is a good thing) you will need to define a couple extra endstops. If not, wiring both motors for the X and Y in series makes it really simple.

    My solution when I was looking at the Duet was to separate out the 2 X and Y motors to separate axes for the homex.g and homey.g (and homeall.g) files to U and V (I think) axes, then redefine the X and Y drives back to the 2 motors each after.

    The G code for machining will be fine, though I stopped before I got to the CNC work coordinate stuff on the Duet. Assuming that your machine is set so that your work coordinates are defined before you start cutting the same gcode for cutting will work as expected.



  • @SupraGuy

    My MPCNC is still printing, 3 more days to go.

    May I please know why you did not use duet for it? Any specific reason? I am new to all this so I want to learn from everyone's experiences as much as I can.

    Also, what did you use eventually? I also have a RAMPS 1.4 board with me with drv8825 drivers on them. I noticed that motor makes a humming sound when I use RAMPS board though.

    I also have a creality board from ender 5 v1.1.4, not sure if it is any better than RAMPS or not. Any suggestions/comments are highly appreciated.

    On the side note, I have the regular endstop from AMAZON that looks like this
    61S9RNwlIRL.AC_SL1200.jpg

    Do you know how I would connect this to DUET board? Do I need all three terminals to be connected on the board, or only two?



  • The duet range of boards aren't fully real-time in the way gcode is processed.
    The file gets read and the gcode gets buffered, so if you send a pause request, this queue has to be emptied before the pause takes place.
    Depending on spindle etc as well, it doesn't get full feedback.
    Something like a cheap breakout board for linuxCNC has RS485 support so as well as setting the RPM of the spindle, the board gets fed back the actual RPM so adjustments can be made. The downside of these boards is you need a PC next to your CNC to have control.
    Also, most CNC machines operate at higher voltages than the duet range of boards. 12v-24v is perfectly fine for 3D printing but as CNC is typically higher speeds, higher voltages have to be used to keep the torque high. Therefore, it can be seen as a bit of a waste to use a duet 2 just to run external drivers (assuming you need larger drivers etc).

    You won't gain anything by using the creality board.

    And for those endstops, use the two outer pins.



  • Well, my reason for not using the Duet came down to 2 reasons.

    1. I had an MKS Gen L board with DRV8825 drivers in it. The board is cheap, about 1/10 the price of a Duet Wifi, (Maybe 1/5 including the full graphic controller) and

    2. I could download a pre-configured Marlin distro for the MPCNC, no guesswork required, and then if things eren't going right, I could eliminate software because I'd be using a "stock standard" distribution.

    Though I'm not absolutely adverse to re-inventing the wheel, I figured that I could swap it over later if need be. There are some configuration items that I can do on the Duet that I cannot do with the RAMPS/Marlin, so I might do so. As it happens, though, I fried my printer Duet by running over the hotend wiring harness with the hotend, so at present I don't have a spare

    Yes, the DRV8825 drivers are noisier than the Duet. This is true. Not nearly as noisy as the router chewing through wood though. With my hearing protection on, I can sometimes hear the motors as they move. Without the hearing protection, no chance, the tool drowns it all out.

    In terms of "realtime" I don't think that Marlin is either, as evidenced by the fact that the display shows the current position being somewhat ahead of the actual tool position. This is not a disadvantage to the Duet. There are some macros that I would like to be able to set up for positioning, tool changes and the like that Marlin is a little clunky with.



  • @SupraGuy
    I started configuring with RAMPS board paired with v1Pi (Octoprint and CNCJS). Then I switched to duet within a day. I agree there was a short learning curve but an awesome community here at duet and with @jay_s_uk 's help I was able to get up and running in a day. The duet board is awesome. I really like it.



  • @mtcl The community there is pretty good too. I fried a duet just before completing the MPCNC build though. Ran the hot end of my printer over the cable bundle and short circuited some stuff. Made switching to a Duet a little more difficult than it would otherwise have been.

    I do believe that the Duet would make an excellent platform for the MPCNC. I already did have most of what I'd need to do planned, just not tested live. The macro coding, and particularly with conditionals could make some functions so much better, like tool changes with retries for positioning...

    That all said, the simplicity of "download the pre-configured firmware" has some appeal. (And I'm saying that as a coder.)

    Well, when I get my repaired board back, I might convert it still... But I've started design on the next 3D printer, so... Maybe not.


Log in to reply