Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    reference the X-axis on both rails

    Scheduled Pinned Locked Moved
    Using Duet Controllers
    4
    59
    2.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • axiomundefined
      axiom
      last edited by

      My X-axis runs on two linear rails with two motors.
      I would like to reference the X-axis on both rails. I also have an endstop input available on the board.
      Is that possible and if so, how do I have to edit it in config.g?
      Here is my current config.g :

      ; Configuration file for Duet WiFi (firmware version 3.3)
      ; executed by the firmware on start-up
      ;
      ; generated by RepRapFirmware Configuration Tool v3.3.16 on Sun May 28 2023 15:23:44 GMT+0200 (Mitteleuropäische Sommerzeit)

      ; General preferences
      M575 P1 S1 B57600 ; enable support for PanelDue
      G90 ; send absolute coordinates...
      M83 ; ...but relative extruder moves
      M550 P"DUKA1300" ; set printer name

      ; Network
      M552 S1 ; enable network
      M586 P0 S1 ; enable HTTP
      M586 P1 S1 ; enable FTP
      M586 P2 S1 ; enable Telnet

      ; Drives
      ;M569 P4 R-1 ; Treiber 4 deaktivieren
      ;M569 P3 R-1 ; Treiber 4 deaktivieren
      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 S0 ; physical drive 3 goes forwards
      ;M584 X0 Z2 E1 ; set drive mapping
      M584 X0:4 Y1 Z2 E3 ; set drive mapping
      M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
      M92 X80.00 Y80.00 Z640 E322.58 ; set steps per mm
      M566 X900.00 Y900.00 Z100.00 E120.00 ; set maximum instantaneous speed changes (mm/min)
      M203 X6000.00 Y6000.00 Z300.00 E1200.00 ; set maximum speeds (mm/min)
      ;M201 X500.00 Y500.00 Z20.00 E250.00 ; set accelerations (mm/s^2)
      M201 X500.00 Y500.00 Z40.00 E250.00 ; set accelerations (mm/s^2)
      M906 X1900 Y2300 Z1800 E1600 I30 ; set motor currents (mA) and motor idle factor in per cent
      M84 S30 ; Set idle timeout

      ; Axis Limits
      M208 X0Y0 Z0 S1 ; set axis minima
      M208 X750 Y640 Z1220 S0 ; set axis maxima

      ; Endstops
      M574 X1 S1 P"xstop" ; configure switch-type (e.g. microswitch) endstop for low end on X via pin xstop
      M574 Y1 S1 P"ystop" ; configure switch-type (e.g. microswitch) endstop for low end on Y via pin ystop

      ; Z-Probe two of them
      M558 K0 P1 C"!zprobe.in" H5 F120 T6000 ; set Z probe type to unmodulated and the dive height + speeds
      M558 K1 P8 A2 S0.2 C"!zstop" H5 F80 T3000
      G31 P1000 K0 X-1 Y-61 Z0.484 ; set Z probe trigger value, offset and trigger height
      G31 P1000 K1 X0 Y0 Z12.664 ; Second Z-offset
      M557 X0:735 Y-27:573 S35 ; define mesh grid

      ; Heaters

      ; Bed
      M308 S0 P"bedtemp" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin bedtemp
      M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0
      ;M307 H0 B1 S1.00 ; enable bang-bang mode for the bed heater and set PWM limit
      M307 H2 R0.283 K0.463:0.000 D7.17 E1.35 S1.00 B0 ; enable bang-bang mode for the bed heater and set PWM limit
      M140 H0 ; map heated bed to heater 0
      M143 H0 S280 ; set temperature limit for heater 0 to 120C

      ;Hotend
      M308 S1 P"e0temp" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor on pin e0temp
      M950 H1 C"e0heat" T1 ; create nozzle heater output on e0heat and map it to sensor 1
      M307 H1 R1.797 K0.742:0.000 D7.57 E1.35 S1.00 B0 V23.8 ; disable bang-bang mode for heater and set PWM limit
      M143 H1 S400 ; set temperature limit for heater 1 to 400C

      ; 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 F2 C"fan2" Q350 ; create fan 2 on pin fan2 and set its frequency
      M106 P2 S1 H1 T60 ; set fan 2 value. Thermostatic control is turned on

      ; Tools
      M563 P0 D0 H1 F0 ; define tool 1
      G10 P0 X0 Y0 Z0 ; set tool 1 axis offsets
      G10 P0 R0 S0 ; set initial tool 1 active and standby temperatures to 0C

      ; Filamentsensor
      M591 D0 P1 C"e1-stop" S1 ;R40:120 E3.0 S1 Filament Sensor

      ;Auto Z-Offset
      Custom settings are not defined
      M501

      fcwiltundefined 1 Reply Last reply Reply Quote 0
      • fcwiltundefined
        fcwilt @axiom
        last edited by

        @axiom

        Do you mean you wish to have a endstop switch on both of the X axes?

        I don't believe that is supported in the firmware BUT I am using 3.4.6 and have not done anything with 3.5.x which has new features.

        How would the second endstop switch benefit you?

        Frederick

        Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

        axiomundefined 1 Reply Last reply Reply Quote 0
        • axiomundefined
          axiom @fcwilt
          last edited by

          @fcwilt said in reference the X-axis on both rails:

          Frederick

          I've noticed that in several jobs where there are a lot of small, short movements, the axes shift a little bit...they're also 800mm long...so far I've been adjusting this by hand every 20 jobs...but if that... If it could take place in small steps through referencing, that would be great

          fcwiltundefined 1 Reply Last reply Reply Quote 0
          • fcwiltundefined
            fcwilt @axiom
            last edited by

            @axiom

            Now that I think back it is possible to have multiple endstops on the Z axis so perhaps it would work on the X axis as well.

            On the Z axis it is done like this...

            M574 Z1 S1 P"estop1 + estop2 + estop3" ; configure endstops for low  end on Z
            

            where estop1, estop2 and estop3 would be the actual pin names of the endstop switch connections.

            Frederick

            Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

            axiomundefined 1 Reply Last reply Reply Quote 1
            • axiomundefined
              axiom @fcwilt
              last edited by

              @fcwilt Doesn't the endstop have to assign to a special motor? If a motor is on driver 0 and one on driver 4...both defined together as the x-axis...don't I also have to assign the endstops?

              fcwiltundefined 1 Reply Last reply Reply Quote 0
              • fcwiltundefined
                fcwilt @axiom
                last edited by

                @axiom

                For the example I posted the motor assignment would look something like this:

                M584 Z5:6:7
                

                The order of the endstop assignments would have to match the order of the motor assignments:

                M574 Z1 S1 P"estop1 + estop2 + estop3" ; configure endstops for low  end on Z
                

                Frederick

                Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                axiomundefined 2 Replies Last reply Reply Quote 0
                • axiomundefined
                  axiom @fcwilt
                  last edited by

                  @fcwilt I understand, then I'll try it out and report back...it'll take a few days because I still have to draw and print an endstop bracket!

                  axiomundefined 1 Reply Last reply Reply Quote 0
                  • axiomundefined
                    axiom @axiom
                    last edited by

                    @axiom So, the campaign was a complete success!!! Thank you Frederick

                    1 Reply Last reply Reply Quote 1
                    • axiomundefined
                      axiom @fcwilt
                      last edited by

                      @fcwilt Now, after this experience, a new idea comes.
                      I have 4 Z axes. If I buy the Due5 expansion board (it's not cheap) I would have 4 additional drivers and 4 more endstops. If I now control each Z-axis with an end stop... manually compensating for heights would also be less stressful. The only question then is, how can I do bed leveling with the Z probe? So far I have also used the Z-probe as a Z-endstop....is that even possible and do you know that or should I write this as a new topic in the entire forum?

                      fcwiltundefined 1 Reply Last reply Reply Quote 0
                      • fcwiltundefined
                        fcwilt @axiom
                        last edited by

                        @axiom

                        Take a look at this quick-and-dirty video of my 3 Z axis printer with auto-bed leveling.

                        3 Z Steppers Level Demo

                        I have intentionally put the bed way out of level for this video to demonstrate, what are to me, the benefits of Z axis endstop sensors.

                        I home the Z axis as you would the X or Y axis relying on the endstop sensors to stop the motion of each of the Z axis steppers motors.

                        The endstop sensors are precisely adjustable and I adjust them (a bit of trial-and-error) so homing the Z axis gets the bed very close to level.

                        Then I use the auto bed leveling feature of the firmware (reference G32) to get the bed as level as possible.

                        Now you are not likely to have the bed get as far out of level as in this video but it does show that the Z axis endstop sensors make getting the bed close to level quick and easy.

                        You could have trouble doing that with a Z probe alone.

                        Just my opinion - your mileage may vary.

                        Frederick

                        Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                        axiomundefined 2 Replies Last reply Reply Quote 0
                        • axiomundefined
                          axiom @fcwilt
                          last edited by

                          @fcwilt That looks very good....my question now is how I have to declare the probe for homing (axes) in the code in comparison to the sensor for the mesh bed compensation on the head...can you help me?
                          This is necessary for me because my bed is 800 x 700mm and the glass plate has 1.5mm fluctuations

                          fcwiltundefined 1 Reply Last reply Reply Quote 0
                          • axiomundefined
                            axiom @fcwilt
                            last edited by

                            @fcwilt Do you also have a link to the sensors you used?

                            1 Reply Last reply Reply Quote 0
                            • fcwiltundefined
                              fcwilt @axiom
                              last edited by

                              @axiom

                              The Z probe is configured (reference M950, M558 and G31) just one way for all uses which are:

                              • setting the Z=0 Datum
                              • auto leveling the bed
                              • creating the height map

                              There are of course other settings that need to be made for:

                              • auto leveling the bed - reference M671 and G30 P#
                              • creating the height map - reference M557 and G29

                              I can help with the details as needed.

                              The sensors I used for the Z axis endstops where typical slotted "beam break" detectors:

                              These are like the ones I use but, as typical with Amazon, the specific ones I order are "no longer available":

                              Optical Limit Sensors

                              I would avoid this style as the connector on the same side of the board as the slotted sensor makes them a bit harder to mount:

                              Another style


                              Again I can help with the details when you have need.

                              Frederick

                              Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                              axiomundefined 2 Replies Last reply Reply Quote 0
                              • axiomundefined
                                axiom @fcwilt
                                last edited by

                                @fcwilt ;That sounds super interesting! Your “Optical Limit Sensors” are available from German Amazon and I have ordered them and they will arrive tomorrow.
                                Then I will replace the mechanical endstops (2 pieces on the x-axis and 1 piece on the y-axis) and try to adjust them and of course first construct brackets for them. To test the z-stop variant (I can't order the expansion board until next week) I would simply connect a sensor. I currently use the capacitive sensor both as an endstop and for bed leveling (G29). If I now connect the optical sensor for the Z axis, I only want to use the capacitive sensor for compensation (G29). So what do I need to change in my code? Here is my current code without the optical sensors:

                                Endstops
                                M574 X1 S1 P"xstop + e0stop" ; configure switch-type (e.g. microswitch) endstop for low end on X via pin xstop
                                M574 Y1 S1 P"ystop" ; configure switch-type (e.g. microswitch) endstop for low end on Y via pin ystop

                                ; Z-Probe two of them
                                M558 K0 P1 C"!zprobe.in" H5 F120 T6000 ; set Z probe type to unmodulated and the dive height + speeds
                                M558 K1 P8 A2 S0.2 C"!zstop" H5 F80 T3000
                                G31 P1000 K0 X-1 Y-61 Z0.484 ; set Z probe trigger value, offset and trigger height
                                G31 P1000 K1 X0 Y0 Z12.664 ; Second Z-offset
                                M557 X0:735 Y-27:573 S35 ; define mesh grid

                                fcwiltundefined 1 Reply Last reply Reply Quote 0
                                • axiomundefined
                                  axiom @fcwilt
                                  last edited by

                                  @fcwilt I can first comment out the second Z-offset in the code "K1"...that is for a later project to use a puck instead of a sheet of paper and is not relevant at the moment...so I also use the z-stop sensor Insert "!zstop" into C

                                  1 Reply Last reply Reply Quote 0
                                  • fcwiltundefined
                                    fcwilt @axiom
                                    last edited by

                                    @axiom

                                    As previously posted you have to have a M574 command for all 4 Z endstop sensors:

                                    M574 Z1 S1 P"pin_name_for_z_sensor_1 + pin_name_for_z_sensor_2 + pin_name_for_z_sensor_3 + pin_name_for_z_sensor_4"

                                    Remember that the order of the pin names must match the order of the steppers in your M584:

                                    So lets assume your drive assignments for the Z steppers is like this:

                                    M569 P5  S0       ; drive  5 - normal - Z at left front
                                    M569 P6  S0       ; drive  6 - normal - Z at left rear
                                    M569 P7  S1       ; drive  7 - normal - Z at right rear
                                    M569 P8  S1       ; drive  8 - normal - Z at right front
                                    
                                    M584 Z5:6:7:8    ; set what motors do what
                                    

                                    And let's also assume sensor 1 will be for drive 5, sensor 2 for drive 6, sensor 3 for drive 7 and sensor 4 for drive 8.

                                    The M574 will be as above

                                    M574 Z1 S1 P"pin_name_for_z_sensor_1 + pin_name_for_z_sensor_2 + pin_name_for_z_sensor_3 + pin_name_for_z_sensor_4"
                                    
                                    

                                    If the order is not correct the sensor activated will stop the wrong motor.

                                    It is easy to check once everything is wired up and configured, asumming the bed is not yet mounted and each Z axis is free to move independently from all the others.

                                    • Jog Z down near limit of travel
                                    • Start a Z homing move at a nice slow speed
                                    • Trigger by hand each sensor and verify that it stops the correct stepper

                                    Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                                    axiomundefined 1 Reply Last reply Reply Quote 1
                                    • axiomundefined
                                      axiom @fcwilt
                                      last edited by

                                      @fcwilt I understand that, this is for the Enstops...but what do I write for the capacitive sensor for the Meshbed compensation?

                                      fcwiltundefined 1 Reply Last reply Reply Quote 0
                                      • fcwiltundefined
                                        fcwilt @axiom
                                        last edited by

                                        @axiom

                                        As mentioned the configuration of the Z probe does not change.

                                        What you have to do is include the commands that tell the firmware how to create the height map

                                        M557

                                        Xaaa:bbb : Minimum and maximum X coordinates to probe
                                        Yaaa:bbb : Minimum and maximum Y coordinates to probe
                                        Pxx:yy : Number of points on X axis, number of points on Y axis

                                        So for example let's say the min/max limits of your bed on the X axis is -150 to 150 and on the Y axis -100 to 100. I always place X=0 and Y=0 at the center of the bed so the min/max limits are as you see.

                                        Now you have to determine where in that area your probe can reach - this is determined by the X and Y offsets of the probe and the possible range of motion outside of the min/max limits.

                                        So let's assume your probe has an X offset of 0 and a Y offset of +25.

                                        Let us also assume your probe can reach from -150 to +150 on the X axis and from -90 to +100 on the Y axis.

                                        You could have an M557 like this:

                                        M557 X-150:150 Y-90:150 P20:15
                                        

                                        Which means the mesh would have 20 points along the X axis and 15 points along the Y axis, for a total of 300 points. And the mesh would span from -150 to 150 on the X axis and from -90 to +100 on the Y axis.

                                        So to create the height map you would:

                                        • Move to Z=5
                                        • Move the probe to the center of the bed, taking into account the probe offset in Y
                                        • Execute a G30 to set the Z=0 Datum
                                        • Execute a G29 S0 to probe the bed and create the height map

                                        Feel free to ask any questions.

                                        Frederick

                                        Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                                        axiomundefined 2 Replies Last reply Reply Quote 0
                                        • axiomundefined
                                          axiom @fcwilt
                                          last edited by

                                          @fcwilt Can I also place the Z-probe 10mm below the nozzle and then still move the bed closer to the head...if so, where and how can I enter this in the code?

                                          1 Reply Last reply Reply Quote 0
                                          • axiomundefined
                                            axiom @fcwilt
                                            last edited by

                                            @fcwilt Sorry, I don't mean the probe but the endstops

                                            fcwiltundefined 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA