Auto leveling with two independent Z steppers?



  • My printer has two Z steppers that are connected together to the Z driver. I would like to change it to have two independent Z drives and automatic leveling between them as described here: https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors#Section_Example_for_2_motors

    My question is regarding the M671 command. Currently I have this and use it for manual leveling of the 4 screws:

    M671 X29:29:269:269  Y279:39:39:279 P0.7      ; positions of adjustment screws
    

    However, the procedure in the link says to replace it with this:

    M671 X-20:220 Y0:0 S0.5 ; leadscrews at left (connected to Z) and right (connected to E1) of X axis
    

    Can I still perform manual leveling of the 4 screws while having automatic leveling of the two Z steppers? (trying to avoid complex workarounds)



  • @zapta said in Auto leveling with two independent Z steppers?:

    Can I still perform manual leveling of the 4 screws while having automatic leveling of the two Z steppers? (trying to avoid complex workarounds)

    Sure and you should do that. The auto level of the z takes care that z is parallel to the bed. So you do not need to adjust that. So it is not realy a "bed leveling" more a "Z leveling".

    Cheers, Chriss


  • Moderator

    More specifically, you should be able to define the M671 as needed right before using it. So if you are going to do the tilt correction, issue the M671 for the lead screw positions, then when you are going to do the 4 point adjustments, give it the M671 for that. Keep in mind that when you're changing the tilt of the bed you're also altering the Z0 point, so you should re-establish that afterwards.



  • @Chriss, I am using 'leveling' as 'parallel to the X/Y plane.'.

    The automatic leveling using the two Z steppers still doesn't guarantee 'leveling' and may require manual tweaking the 4 bed screws. My question is how to do that?



  • Thanks @Phaedrux. I see, I don't need to restore any specific M671, just set it before I do auto-z or manual screws leveling. That's simple enough.

    As for Z0 point, I plan to do manual leveling rarely and do auto dual Z leveling and print footprint mesh before every print so I presume this will take care of the Z0 (my config.g is already config for the height difference between the nozzle and bltouch triggering point).


  • Moderator

    That's my understanding anyway. M671 doesn't do anything in particular other than inform the position of the adjustment points. But I could be wrong, so test and report back.



  • Ok, I will give it a try and report. Thanks.

    Will do it in steps. Already split the Z into two drivers. Next will do the two points leveling.



  • @zapta

    I use this on a few of my dual Z machines. here is my G code for one of my chiron's

    M584 X0 Y1 Z2:4 E3 ; Custom drive mapping

    M671 X-40:440 Y206:206 S2 ; Lead screw positions at right and left of the X axis

    I have that in the "drives" section of my config.g

    That works in conjunction with my bed.g file which is executed by G32 Which I set in motion by means of a macro entitled "all in one leveling" it first levels the X gantry ( I do it twice to reduce the amount of error correction) then I have it probe the bed by calling G29 that uses the info from my M557 Command


    contents on my bed.g

    ; bed.g
    ; called to perform automatic bed compensation via G32

    M561 ; Clear any bed transform
    G28 ; Home All
    G30 P0 X15 Y206 Z-99999 ; Probe near a lead screw, half way along the Y axis (1st motor)
    G30 P1 X400 Y206 Z-99999 S2 ; Probe near a lead screw and calibrate 2 motors (2nd motor)
    G30 P0 X15 Y206 Z-99999 ; Probe near a lead screw, half way along the Y axis (1st motor)
    G30 P1 X400 Y206 Z-99999 S2 ; Probe near a lead screw and calibrate 2 motors (2nd motor)
    G1 H0 X20 Y61 F7000 ; Move the head to the front left corner
    G29 ; Carry out mesh leveling


    M557 X12:420 Y10:460 S30 ; define mesh grid



  • @CaLviNx, that's very useful. Do you also perform once in a while manual leveling of the 4 bed's screws? If so, do you use a different M671 and a simpler homing?

    My thinking is that the manual leveling of the 4 screws probably calls for a simpler homing that doesn't level the Z screws.

    BTW, you may want to look at another thread here regarding an auto generated M557 that covers the print area of the current print. It's faster this way and is not distracted by measurements outside of the print area.



  • @zapta

    I used to, but I have since removed the adjusters and made my beds all solidly mounted as there is no need for them to be adjustable. When I did do that I did the full sequence to level the gantry then I just used to use the console to run a G29. I had 5 macro's in a "manual leveling" folder, with 5 other macro's entitled point-1, point-2, point-3, point-4, and "nozzle to the centre of the bed" points 1 to 4 all placed the nozzle above the bed screw adjuster.

    I do still have the "nozzle to the centre" macro so I can check and adjust the clearance between the nozzle and the bed and that allows me to then test the probe dive height if I have messed about with the nozzle or the hot end.

    Then contents of one of my nozzle 1 to 4 macro's


    ; Nozzle Position 1

    G1 Z5 F2000 ; raise the nozzle
    G1 X17 Y55 S2 F2000 ; put the nozzle to position 1
    G1 Z0 F2000 ; lower the nozzle


    ; Place the Nozzle at the centre of the bed

    G1 Z5 F2000 ; raise the nozzle
    G1 X207 Y270 S2 F2000 ; put the nozzle to the centre of the bed
    G1 Z0 F2000 ; lower the nozzle


    And the command to carry out a test dive to get the probe's trigger height for the G31 command in the config.g

    G30 S-1

    Im happy enough with my M557 commands, and my setup's in general.

    The setups I have, I have had on all my machines for years and they do not need any tweaking, my only issue I have ever had was when I gave an iteration of RRF3 firmware a shot, that turned out to be a very bad idea as RRF3 seems very buggy, so for the moment I will stay with RRF2 until such time that I feel RRF3 is mature enough.



  • @CaLviNx said in Auto leveling with two independent Z steppers?:

    I used to, but I have since removed the adjusters and made my beds all solidly mounted as there is no need for them to be adjustable.

    I like this idea. I may do the same. Not actually removing the screws but secure them with a counter nut and forget about them.

    I switched recently to a per print partial auto mesh and now to auto leveling of the two independent Z steppers and between them things seems to be very consistent.



  • @Phaedrux, everything seems to work as advertised. Thanks.

    A suggestions regarding the online documentation of dual Z leveling, for your consideration.

    1. Mention that the E1 drive may need need to be defined (e.g. in case the common Z drive is set as reversed direction).

    2. Mention that things such as stepper current settings are applied automatically to both drives. It's not obvious, I think it's not the case with the E drives.

    3. Have an example or a note regarding a macro to level the mechanical screws and how to handle the conflicting M671.

    4. Add a note regarding the auto level tolerance. (the default 0.5mm was too small for me).

    Thanks for your help.



  • @zapta said in Auto leveling with two independent Z steppers?:

    @Phaedrux, everything seems to work as advertised. Thanks.

    A suggestions regarding the online documentation of dual Z leveling, for your consideration.

    1. Mention that the E1 drive may need need to be defined (e.g. in case the common Z drive is set as reversed direction).

    2. Mention that things such as stepper current settings are applied automatically to both drives. It's not obvious, I think it's not the case with the E drives.

    3. Have an example or a note regarding a macro to level the mechanical screws and how to handle the conflicting M671.

    4. Add a note regarding the auto level tolerance. (the default 0.5mm was too small for me).

    Thanks for your help.

    Re #4 that is a bit of a yes and no scenario, I agree that initially that tolerance is somewhat low, but if the bed is stable and "level" already then you will find that 0.5mm is fine. But you can change the tolerance until you get things set up and running properly.



  • @CaLviNx, currently I have it set to 1.0 and I consider increasing it.

    The printer may gain Z difference, e.g. if I happen to press the bed while it's off.

    Is it possible to apply stall detection to the Z leveling such that instead of breaking something the printer will stop and complain?


  • Moderator

    @zapta said in Auto leveling with two independent Z steppers?:

    Is it possible to apply stall detection to the Z leveling such that instead of breaking something the printer will stop and complain?

    Reduce the motor current such that it stalls when blocked.



  • @Phaedrux said in Auto leveling with two independent Z steppers?:

    @zapta said in Auto leveling with two independent Z steppers?:

    Is it possible to apply stall detection to the Z leveling such that instead of breaking something the printer will stop and complain?

    Reduce the motor current such that it stalls when blocked.

    When you do that, ensure your Z travel speed between points is not too fast.
    Took me a while to work out the reason why I couldn't get consistent results was because the stepper was skipping steps when it tried to raise too quickly at the reduced current.



  • @Phaedrux said in Auto leveling with two independent Z steppers?:

    Reduce the motor current such that it stalls when blocked.

    That's a good idea. Thanks.



  • @OwenD said in Auto leveling with two independent Z steppers?:

    When you do that, ensure your Z travel speed between points is not too fast.

    What speed setting governs the Z adjustment? That is, that is, after the last sampling point, when the adjustment is done?



  • @zapta said in Auto leveling with two independent Z steppers?:

    @OwenD said in Auto leveling with two independent Z steppers?:

    When you do that, ensure your Z travel speed between points is not too fast.

    What speed setting governs the Z adjustment? That is, that is, after the last sampling point, when the adjustment is done?

    M558 F & T parameters, but probably limited by M203
    Not near my machine and can't remember which I ended up using to limit it in bed.g



  • I just did the same but I am pretty sure I do something wrong.

    My printer is not probing ans using the whole bed after I made the change.
    I have a blv cube.

    My config:

    M574 Z1 S2 ; Set endstops controlled by probe
    M307 H1 A370.4 C105.6 D6.2 B0 ; Set PID for hotend values
    M307 H0 A81.6 C189.1 D4.2 B0 ; Set PID for heated bed values
    M558 P5 H5 A20 F300 T9000 I0 R0.5 ; Set Z probe type mini ir sensor
    G31 P500 X-2 Y-16.4 Z0.715 ; Set Z probe trigger value, offset and trigger height
    M557 X30:270 Y30:270 S40 ; Define mesh grid
    M584 X0 Y1 Z2:4 E3 ; two Z motors connected to driver outputs Z and E1
    M671 X52:310 Y116:116 S1.5 ; leadscrews at left (connected to Z) and right (connected to E1) of X axis
    M208 X30:270 Y0:270 ; X carriage moves from -5 to 205, Y bed goes from 0 to 200

    My bed.g file

    ; bed.g
    ; called to perform automatic bed compensation via G32
    ;
    ; generated by RepRapFirmware Configuration Tool on Tue Oct 09 2018 13:27:56 GMT+0300
    M561 ; Clear any bed transform
    G28 ; Home All
    G30 P0 X52 Y106 Z-99999 ; Probe near a lead screw, half way along the Y axis (1st motor)
    G30 P1 X310 Y106 Z-99999 S2 ; Probe near a lead screw and calibrate 2 motors (2nd motor)
    G30 P0 X52 Y106 Z-99999 ; Probe near a lead screw, half way along the Y axis (1st motor)
    G30 P1 X310 Y106 Z-99999 S2 ; Probe near a lead screw and calibrate 2 motors (2nd motor)
    G28 ; Home All
    G29 ; Carry out mesh leveling

    What am I doing wrong here?



  • @Caveman

    I think the P parameter in your M558 command is wrong (Depending on the firmware you are on of course)

    I think it should read P1 instead of P5

    M558 P5 H5 A20 F300 T9000 I0 R0.5 ; Set Z probe type mini ir sensor (THIS IS YOURS)

    M558 P1 F120 H5 T6000 ; set Z probe type to unmodulated and the dive height + speeds (THIS IS MINE)

    As if you follow David's own blog instructions he lists the probe type as P1 see Here


    Testing and commissioning the board

    Testing with Duet electronics

    In your config.g file, use probe type P1 in your M558 command and trigger threshold P500 in your G31 command.

    Start with the hot end and sensor some distance above the bed. Power up the Duet using USB power only. About 4 seconds after power is applied, the LED on the sensor should flash four times, indicating that the board has started in analog output mode. If it does not flash, check the power connections to the board.

    Connect to the Duet from a PC using the web interface. On the Control page you can see a continuous readout of the Z probe reading.

    Send M558 P1 to the Duet, then send G31 P500 Z1.0.

    Move a suitable target (e.g. white paper or glass) up underneath the sensor. Check that you get the following readings:

    With the sensor a long way above any surface, the reading should be close to zero.
    With the sensor close to a surface but slightly further away than the trigger height, the reading should be about 465.
    With the sensor slightly closer to a surface, the reading should be about 535 and the red LED on the sensor board should illuminate.
    If you place a surface right up against the sensor board, then the reading may drop to near zero again. This is normal.
    If you see a reading of around 1000, or if the LED flashes rapidly, this means that there is too much ambient IR for the sensor to function correctly. This normally happens only when direct bright sunlight is reflected from the bed into the sensor, or when you place a highly reflective surface below the sensor such as aluminium foil.
    If you get the expected readings, then you can apply 12V power and continue with commissioning. If not, check your wiring.

    With 12V power applied, send M558 P1 followed by G31 P500 Z1.0 to the Duet again. Note: if your printer does not use the Z probe to home any axes, you also need to add parameters X0 Z0 to the M558 P1 command.

    To calibrate the sensor for Z homing and bed probing, home X and Y, then position the head over the centre of the bed. With the nozzle at operating temperature, lower the head so that it is just touching the bed or just gripping a sheet of paper, then send G92 Z0 to define that position as Z=0. Raise the head 5mm and remove the paper. Then send command G30 S-1 to probe the bed at that point without adjusting the Z height setting. Read off the Z height in the “Head Position” box in Duet Web Control, or from the Z coordinate shown on the Control page of Panel Due, or send M114 to retrieve the head position if using a USB host program on a PC. It should be in the range 0.5 to 2.5mm. Use that value for the Z parameter in your G31 command in config.g. Please note:

    The S-1 parameter may not be supported in the official RepRap Firmware release. It is supported in my fork and dcnewman’s fork.
    Always use a P value of 500. When the probe is triggered, the Z probe reading will be about 535. When it is slightly higher than the trigger height, the reading will be about 465. With a P value of 500, when the Duet sees the reading of about 465, it knows it is getting close to target height and it will slow down the Z motor.
    If you are using my (dc42) fork of RepRap Firmware, then the G31 command in config.g must come after the M558 P1 command. This is because the firmware supports different G31 values for different sensor types.
    After turning your printer on, do not perform any operation that uses the sensor (e.g. X homing on some printers) for 5 seconds, until after the LED has done its 4 flashes.




  • It needs to be P5 I have a prusa pinda probe. The ir sensor and the powdercoated sheet do not work. So I changed the probe.The issue is I guess in my M671 code. I see in examples here the first number is negative. I assume that is becose the screw is outside the limit of the machine?



  • @Caveman

    Then you need to change the description at the end of the M558 command as YOU have it listed as an IR sensor.



  • @Caveman

    If X ZERO is at the Low end of the X axis (i.e the left side of the bed) and the lead screw is further to the left of that then the FIRST number needs to be a negative from the the ZERO point. this is MY code that IS WORKING.

    M671 X-40:440 Y206:206 S2 ; Lead screw positions at right and left of the X axis



  • thanks, you use this on a blv cube?


Log in to reply