Changing G-Code To Control 6 Stepper Motors



  • I am using a DuetWifi and Duet 2X Board to connect 6 stepper motors for a robotic arm project. So far i can control the X, Y and Z axis as usual but i want to be able to control the other 3 stepper motors in the same way without treating them as extruders.

    Can someone please explain how i am able to do this?

    Here is my current Config.g

    ; generated by RepRapFirmware Configuration Tool v2 on Thu Feb 21 2019 16:57:55 GMT+0000 (Greenwich Mean Time)

    ; General preferences
    G90 ; Send absolute coordinates...
    M83 ; ...but relative extruder moves

    ; Network
    M550 P"RoboticArm Firmware 1.1" ; Set machine name
    M551 P"<my password name>." ; Set password
    M552 S1 ; Enable network
    M587 S"BTHub3-F8KX" P"<my password name>" ; Configure access point. 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
    M350 X16 Y16 Z16 I0 ; Configure microstepping without interpolation
    M92 X200.00 Y200.00 Z200.00 ; Set steps per mm
    M566 X50.00 Y50.00 Z50.00 ; Set maximum instantaneous speed changes (mm/min)
    M203 X1000.00 Y1000.00 Z1000.00 ; Set maximum speeds (mm/min)
    M201 X10.00 Y10.00 Z10.00 ; Set accelerations (mm/s^2)
    M906 X2000.00 Y2000.00 Z2000.00 I30 ; Set motor currents (mA) and motor idle factor in per cent
    M84 S30 ; Set idle timeout

    ; Axis Limits
    M208 X-300 Y-300 Z-300 S1 ; Set axis minima
    M208 X300 Y300 Z300 S0 ; Set axis maxima

    ; Endstops
    M574 X1 Y1 Z1 S1 ; Set active high endstops

    ; Z-Probe
    M558 P5 H5 F120 T6000 ; Set Z probe type to switch and the dive height + speeds
    G31 P500 X0 Y0 Z2.5 ; Set Z probe trigger value, offset and trigger height
    M557 X-285:85 Y-285:10 S20 ; Define mesh grid

    ; Heaters
    M140 H-1 ; Disable heated bed

    ; Fans

    ; Tools

    ; Automatic saving after power loss is not enabled

    ; Custom settings are not configured


  • administrators

    You can create up to 6 additional axes using M584, see https://duet3d.dozuki.com/Wiki/Gcode#Section_M584_Set_drive_mapping.



  • @dc42 Thanks so much for your help! this is exactly what i need!

    M584 U0 V1 W2 X3 Y4 Z5 would do the trick??


  • administrators

    @mattling9 said in Changing G-Code To Control 6 Stepper Motors:

    M584 U0 V1 W2 X3 Y4 Z5 would do the trick??

    Yes, except you should add something like E10 to that command to prevent drivers 3 4 and 5 being assigned to extruders as well as axes (see the Important Note in the M584 description). Or you can use M584 X0 Y1 Z2 U3 V4 W5 E10. Or any other axis-to-driver assignment you want.



  • @dc42 said in Changing G-Code To Control 6 Stepper Motors:

    M584 X0 Y1 Z2 U3 V4 W5 E10

    Adding the E10 does make a lot of sense! I didn't think it would be that easy to get it working!

    Thanks so much for your help 🙂



  • One last question, Is there a way to bypass the homing?

    i understand motors will not move until homed, so can i just leave the homex.g files blank or does there have to be some sort of movement to make it a valid home?


  • administrators

    You can use a G92 command to bypass homing. For example, if you don't yet have a U axis homing switch, you can put G92 U0 in homeu.g and in homeall.g, to tell the firmware that the U axis is assumed to be at coordinate 0.0.


Log in to reply