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

    Microswitch for Z-probing

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    3
    18
    2.9k
    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.
    • DocTruckerundefined
      DocTrucker
      last edited by

      I'm trying to use a microswitch for bed level correction.

      I've seen this guide on z-probing on the wiki. I've been referencing the duet gcode and reprap gcode guides With this in mind I would be looking to set up my normally open z-probe microswitch connected to E1 with the following command:

      In the config file I would have the following:

      M558 X0 Y0 Z0 P6 I1 ; Set probe type to microswitch on E1 connector. Don't use the probe for homing axis. Is I1 valid for setting it to normally open?
      G31 X20 Y20 Z0.1 ; Set the switch X and Y location relative to the nozzle and the z level at which the switch triggers.
      M557 P0 X95 Y5 ; Four…
      M557 P1 X95 Y95 ; ...probe points...
      M557 P2 X5 Y95 ; ...for bed...
      M557 P3 X5 Y5 ; ...levelling

      The on the gcode terminal I would run:

      G32

      ...is that all there is to it? Is I1 the right parameter to us to use and active low switch or should I be using something like the S0 from M574?

      Edit: Would this then store the bed correction values until the next power cycle? How do you see these values as calling G32 would repeat the bed probe?

      Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

      1 Reply Last reply Reply Quote 0
      • number40fanundefined
        number40fan
        last edited by

        M558 looks good.

        Not sure why you have M557. You can put the points in your Bed.g file, and use more points and run G32.

        Bed.g

        ; Auto calibration routine for delta printers
        ; Before running this, you should have set up your zprobe Z offset to suit your build, in the G31 command in config.g.

        M561 ; clear any bed transform, otherwise homing may be at the wrong height
        G31 X0 Y0 ; don't want any probe offset for this
        G28 ; home the printer

        ;*** Remove the following line if your Z probe does not need to be deployed
        ;M98 Pdeployprobe.g ; deploy the mechanical Z probe

        ; The first time the mechanical probe is used after deployment, it gives slightly different results.
        ; So do an extra dummy probe here. The value stored gets overwritten later. You can remove this if you use an IR probe.
        ;G30 P0 X0 Y0 Z-99999

        ; Probe the bed and do 6- or 7-factor auto calibration
        G30 P0 X-73.6 Y-42.5 Z-99999 ; X tower
        G30 P1 X0 Y-85 Z-99999 ; between X and Y towers
        G30 P2 X73.6 Y-42.5 Z-99999 ; Y tower
        G30 P3 X73.6 Y20 Z-99999 ; between Y and Z towers
        G30 P4 X0 Y67 Z-99999 ; Z tower
        G30 P5 X-73.6 Y20 Z-99999 ; between Z and X towers
        G30 P6 X-36.8 Y-21.25 Z-99999 ; half way to X tower
        G30 P7 X36.8 Y-21.25 Z-99999 ; half way to Y tower
        G30 P8 X0 Y42.5 Z-99999 ; half way to Z tower
        G30 P9 X0 Y0 Z-99999 S6 ; centre, and auto-calibrate 6 factors

        Once done, M500 will save the results in a config-override.g folder and will be called up on restart if you have M501 at the bottom of your config.g.

        1 Reply Last reply Reply Quote 0
        • DocTruckerundefined
          DocTrucker
          last edited by

          Thanks for your comments. Isn't M574 the only way to define limit switches? I've three limits at maximum travel set up with M574 as follows:

          M574 X1 Y1 Z1 S1 ; Define active high microswitches

          Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

          1 Reply Last reply Reply Quote 0
          • number40fanundefined
            number40fan
            last edited by

            Yep, sorry for confusing you.

            I was reading the Mode 4 directions and saw " In firmware 1.16 and later, use I1 in the M558" and had myself convinced you didn't need M574. Didn't bother to look what I had.

            But, the M574 deals with just the endstops, not Z probe,

            1 Reply Last reply Reply Quote 0
            • DocTruckerundefined
              DocTrucker
              last edited by

              No worries, you've given me plenty to look at with regards the override config, M500, and bed.g. Only been away form the machines for three years and loads has changed - although I didn't dive too deep back then.

              Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

              1 Reply Last reply Reply Quote 0
              • number40fanundefined
                number40fan
                last edited by

                I did some editing, so make sure you catch it all. I have successfully use a micro switch for Z probing using P4 and E0 and it worked great. Bad thing is I had to remove it after each use. I then tried sandwiching a couple between the effector and hotend and got great probing results, but the hotend wobbled just enough while printing to make it not worth it. Went back to using the IR probe which worked great, but I had some thoughts on the switches.

                1 Reply Last reply Reply Quote 0
                • DocTruckerundefined
                  DocTrucker
                  last edited by

                  Good to hear. The main application for this is the home project where I've cut out a dead Up Plus 2 driver card and replaced it with a Duetwifi. This has a clip on micro switch for bed level correction. It also has a little assembly where the nozzle pushes a piece of spring steel across some contacts to detect bed level, and a high end end stop. The end stop was the only device permanently connected, the others relied on the user moving a jack lead.

                  Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

                  1 Reply Last reply Reply Quote 0
                  • number40fanundefined
                    number40fan
                    last edited by

                    That should work out good then. Don't mind my bed.g that I posted, it is for a Delta, but it should give you the idea of how to set up the probing area for your printer.

                    1 Reply Last reply Reply Quote 0
                    • DocTruckerundefined
                      DocTrucker
                      last edited by

                      Ok, been a while since I was able to do some work on this but I thing things are nearly sorted. This is a board swap on a Up Plus 2 printer that comes with a nozzle height detection switch on the platform and a microswitch that is used for bed level correction.

                      Homing runs on the end of axis limit switches.

                      The bed.g is as follows:

                      M561
                      ; Use a normally open (I1) switch connected to E1 limit (P6).
                      ; Probe speed of 500mm/min and travel between points of 6000mm/min
                      M558 P6 X0 Y0 Z1 H5 I1 F500 T6000
                      ; Set up the offsets for the switch.
                      G31 X0 Y10 Z18.1
                      ; Four clockwise probe points and centre.
                      G30 P0 X10 Y10 Z-99999
                      G30 P1 X41.25 Y10 Z-99999
                      G30 P2 X72.5 Y10 Z-99999
                      G30 P3 X103.75 Y10 Z-99999
                      G30 P4 X72.5 Y63.75 Z-99999 S0
                      ; Move to the head.
                      G1 Z20 F6000

                      I've a macro that I run after that sets the zero level by touching the head on the platform switch as follows:

                      G1 X0 Y63.75 Z10 F6000
                      ; Use a normally open (I1) switch connected to E0 limit (P4).
                      ; Probe speed of 500mm/min and travel between points of 2000mm/min
                      M558 P4 I1 X0 Y0 Z1 F500 T2000 H30
                      G31 X0 Y0 Z0
                      G30
                      G92 Z0
                      G1 X72.5 Y63.75 Z80 F6000

                      So my start up procedure for the user is:
                      G28 to home all axis
                      Fit the bed level microswitch
                      G32 to run bed level compensation
                      Remove the bed level microswitch
                      M98 P/macros/NozzleHeight

                      How do you add more points to the bed level correction for averaging?

                      Edit: thought the -99999 was a dive height on the G30. It's not. Goes screwy with z-20!
                      Edit2 Needed a G92 Z0 in the nozzle height macro.

                      Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

                      1 Reply Last reply Reply Quote 0
                      • dc42undefined
                        dc42 administrators
                        last edited by

                        I don't understand why you needed a G92 Z0 command in your macro. A successful G30 command with no other parameters will set the Z height to the configured trigger height, which you have set in the preceding command to zero.

                        You are using the old 5-point bed compensation scheme. This has been superseded by mesh bed compensation (G29).

                        Duet WiFi hardware designer and firmware engineer
                        Please do not ask me for Duet support via PM or email, use the forum
                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                        1 Reply Last reply Reply Quote 0
                        • DocTruckerundefined
                          DocTrucker
                          last edited by

                          After the G30 command the web control was reporting a Z position of 0.52mm. I'll have another look this evening but that is why I added the reset to 0.

                          I'll read up on the G29. I thought this was for correcting for an uneven beds? If so how does it deal with a wonky bed. Does it remap the head path to move relative to the bed surface then gradually move back to moves parrallel to the x-y plane? In other words if I printed a solid block would the final surface match the debiations detected by the G29 process?

                          If the G32 or G29 does detect a tilt on the bed plane does it realign the z-axis to be equal to normal of the tilted bed, or keep the centre of each layer in the same position relative to the machine's x/y axis?

                          Feel free to answer with a webpage for further reading!

                          Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

                          1 Reply Last reply Reply Quote 0
                          • DocTruckerundefined
                            DocTrucker
                            last edited by

                            I've repeated the tests and not seen the same issue that led me to believe I needed the z=0 current position reset, Not sure what was going on but I can't repeat that. Other questions about the build platform normal and whether the layers gradually corret from a wonky bed still stand.

                            Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

                            1 Reply Last reply Reply Quote 0
                            • dc42undefined
                              dc42 administrators
                              last edited by

                              See https://duet3d.com/wiki/G-code#M376:_Set_bed_compensation_taper.

                              Duet WiFi hardware designer and firmware engineer
                              Please do not ask me for Duet support via PM or email, use the forum
                              http://www.escher3d.com, https://miscsolutions.wordpress.com

                              1 Reply Last reply Reply Quote 0
                              • DocTruckerundefined
                                DocTrucker
                                last edited by

                                Thanks, I'll make sure that is in my configuration file.

                                Is that being applied to both correction for unevenness and z-axis to build surface normal correction? Is the axis to normal correction corrected for by rotating the whole dataset or a skew where only the z-component gets altered?

                                Does the build simulation warn if build surface normal, buid surface unevenness, or the octagonal correction shift data out of the buildable volume? Bit of a delay to the build process but it would appear advisable to run the simulation after G32 if these warnings are presented.

                                Edit: Strikes added because found bed mesh correction is applied to z only.

                                Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

                                1 Reply Last reply Reply Quote 0
                                • DocTruckerundefined
                                  DocTrucker
                                  last edited by

                                  The wiki would appear to suggest the mesh bed compensation is a correction to the nozzle z-position only.

                                  This bit concerns me though: "On a Cartesian printer, you can use either mesh levelling (G29) or G30/G32 probing, not both."

                                  Does this mean that I can't run a single G30 to set the z=0 plane after G29? If the G30 resets the height map can I run g29, then g30, then g29 S1 to reload the height map? I appreciate hardware changes would simplify this but that is not an option at this juncture.

                                  For other readers here is the wiki page: https://duet3d.com/wiki/Using_mesh_bed_compensation

                                  Edit: Lack of sleep, but questions self answered! Strikes added.

                                  Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

                                  1 Reply Last reply Reply Quote 0
                                  • DocTruckerundefined
                                    DocTrucker
                                    last edited by

                                    This is a good read through for others learning bed mesh compensation:

                                    https://www.duet3d.com/forum/thread.php?id=499&p=1

                                    I understand now why G30 and G29 don't play well together. I need my nozzle height macro to define an offset rather than reset the global position. I need to read up on the macros and gcode a bit more.

                                    Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

                                    1 Reply Last reply Reply Quote 0
                                    • DocTruckerundefined
                                      DocTrucker
                                      last edited by

                                      Here is a video of the two switches in action: https://m.youtube.com/watch?v=kpatyPvD5oU

                                      I was hoping to avoid the need for the user to read and write gcode strings but I think the following is the best procedure:

                                      (user)
                                      Load bed level switch.
                                      (macro1)
                                      Home machine
                                      Move to over nozzle height switch and run g30 to reset on bed level switch trigger.
                                      Run g29
                                      (user)
                                      Unload bed level switch
                                      Connect nozzle height switch.
                                      (macro2)
                                      Move to over nozzle height switch and run g30 s-1 to move until nozzle height swith is triggered
                                      (user)
                                      Use value from m114 to set tool z offset.

                                      Edit: added user/macro sections for clarity.

                                      Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

                                      1 Reply Last reply Reply Quote 0
                                      • DocTruckerundefined
                                        DocTrucker
                                        last edited by

                                        Macro - init1

                                        M80
                                        M561
                                        G28
                                        M558 P6 X0 Y0 Z1 H5 I1 F500 T6000
                                        G31 X0 Y0 Z0
                                        G1 X0 Y53.75 Z25 F6000
                                        G30
                                        G1 Z15
                                        M558 P6 X0 Y0 Z1 H5 I1 F500 T6000
                                        G31 X0 Y10 Z0
                                        G29
                                        G1 X0 Y53.75 Z25 F6000

                                        Macro - init2

                                        G1 X0 Y63.75 Z-10 F6000
                                        M558 P4 I1 X0 Y0 Z1 F50 T2000 H30
                                        G31 X0 Y0 Z0
                                        G30 S-1

                                        User tool offset (applying -1 * value reported to console eg: "Stopped at height -17.587 mm")

                                        G10 P0 X0 Y0 Z-17.587

                                        Ok, redoing the full G29 each time seems a little extreme but the build surface is removed for each build and isn't extremely rigid. Besides the build surface heater is underpowered and it takes over 15 min to reach temperature, so the time cost of the g29 doesn't seem too bad!

                                        Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

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