Homing Z in full steps



  • Re: Keep Z axis microstepping but force to only move full steps

    I try to achieve basically the same as what is described in the linked topic. I want to home Z with full steps so that I can make sure from there on to always be on full step positions for maximum accuracy. But I can't get it to work. I do the first homing pass in x16 microstepping including backing up a little. Then I switch to full steps and try to hit the endstop again but I just get rattling noises from the motors and an error message that homing failed.

    I tried reducing jerk and also reduced speed from 180mm/min to 30mm/min but it does not make any difference.

    Following my homez.g

    G91               ; relative positioning
    G1 H1 Z-300 F900  ; move quickly to Z axis endstop and stop there (first pass)
    G1 Z2 F3000       ; go back a few mm
    
    M350 Z1           ; Switch to full steps so we will land on a full step when switch is triggered
    M566 Z1           ; Reduce maximum instantaneous speed changes (i.e. jerk) (mm/min)
    G1 H1 Z-300 F30   ; move slowly to Z axis endstop once more (second pass)
    M350 Z16 I1       ; Go back to x16 interpolated to be more quiet again
    M566 Z24          ; Set maximum instantaneous speed changes (i.e. jerk) (mm/min)
    
    G90               ; absolute positioning
    

    Also a M122 after failed homing

    M122
    === Diagnostics ===
    RepRapFirmware for Duet 2 WiFi/Ethernet version 2.02RC1(RTOS) running on Duet WiFi 1.02 or later
    Board ID: 08DGM-956GU-DJMSN-6J1F4-3S86R-1BR7G
    Used output buffers: 3 of 20 (15 max)
    === RTOS ===
    Static ram: 28460
    Dynamic ram: 99628 of which 0 recycled
    Exception stack ram used: 388
    Never used ram: 2596
    Tasks: NETWORK(ready,328) DHTSENSOR(blocked,132) HEAT(blocked,1232) MAIN(running,3548)
    Owned mutexes:
    === Platform ===
    Last reset 07:05:49 ago, cause: power up
    Last software reset time unknown, reason: User, spinning module GCodes, available RAM 2580 bytes (slot 1)
    Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0041f000 BFAR 0xe000ed38 SP 0xffffffff Task 0x4e49414d
    Error status: 0
    Free file entries: 10
    SD card 0 detected, interface speed: 20.0MBytes/sec
    SD card longest block write time: 6.2ms, max retries 0
    MCU temperature: min 29.7, current 30.0, max 30.3
    Supply voltage: min 13.6, current 13.6, max 13.8, under voltage events: 0, over voltage events: 0
    Driver 0: standstill, SG min/max not available
    Driver 1: standstill, SG min/max not available
    Driver 2: standstill, SG min/max 162/324
    Driver 3: standstill, SG min/max not available
    Driver 4: standstill, SG min/max not available
    Date/time: 2018-09-04 15:54:49
    Slowest loop: 11.36ms; fastest: 0.08ms
    === Move ===
    Hiccups: 0, StepErrors: 0, LaErrors: 0, FreeDm: 240, MinFreeDm: 239, MaxWait: 288026ms, Underruns: 0, 0
    Scheduled moves: 17, completed moves: 17
    Bed compensation in use: none
    Bed probe heights: 0.000 0.000 0.000 0.000 0.000
    === Heat ===
    Bed heaters = 0 -1 -1 -1, chamberHeaters = -1 -1
    Heater 1 is on, I-accum = 0.0
    === GCodes ===
    Segments left: 0
    Stack records: 1 allocated, 0 in use
    Movement lock held by null
    http is idle in state(s) 0
    telnet is idle in state(s) 0
    file is idle in state(s) 0
    serial is idle in state(s) 0
    aux is idle in state(s) 0
    daemon is idle in state(s) 0
    queue is idle in state(s) 0
    autopause is idle in state(s) 0
    Code queue is empty.
    === Network ===
    Slowest loop: 173.14ms; fastest: 0.08ms
    Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0) Telnet(0)
    HTTP sessions: 1 of 8
    - WiFi -
    Network state is running
    WiFi module is connected to access point 
    Failed messages: pending 0, notready 0, noresp 0
    WiFi firmware version 1.21
    WiFi MAC address 60:01:94:73:54:2c
    WiFi Vcc 3.31, reset reason Turned on by main processor
    WiFi flash size 4194304, free heap 17072
    WiFi IP address 192.168.178.22
    WiFi signal strength -58dBm, reconnections 0, sleep mode modem
    Socket states: 0 0 0 0 0 0 0 0
    === Filament sensors ===
    Extruder 0 sensor: position -0.02, ok, framing errors 0, parity errors 0, no calibration data
    === Expansion ===
    


  • @wilriker I use G30 for homing so may not be able to help. But if you use G1, don't you have to include an S1 parameter so it know when to stop? What is the H1 parameter that you are using? can't see any reference to that in the Wiki.



  • @deckingman H is the new S. This has been changed in the last beta release though for anything but Laser Mode they are treated equal. The change was introduced to be able to use Snnn in laser mode to provide the power of the laser therefore another parameter for checking the endstops was introduced and it is Hnnn.

    And as I am picky on "intended usage" I already changed all my G0/1 Snnn to G0/1 Hnnn. But as I said for anything but laser mode it does not make a difference. 😁



  • Is it possible you're hitting mechanical resonance with full-stepping? Screws rigidly coupled to the motor can be a MAJOR resonance issue with full-stepping or half-stepping.

    Another question is whether your commanded move rate is hitting a step-doubling frequency -- if you are commanding full steps and the Duet is sending two step pulses at a time due to high frequency, that's not going to work at all. But I don't imagine this is happening at low speeds.

    Overall though, I'm not sure I think there is any benefit to what you're trying to do. What's important to Z quality is setting your layer heights to a multiple of full steps so every layer occurs at the same microstep index, not necessarily only doing layers at full step positions. Angle errors attributable to microstepping (eg driver current control issues and detent torque variation) are fully repeating by microstep index. Microstep 7 always has the same error, microstep 13 always has the same error, etc. And torque doesn't vary by a meaningful amount: every microstep position provides about +/-5% as much torque as the full steps.



  • @rcarlyle said in Homing Z in full steps:

    Is it possible you're hitting mechanical resonance with full-stepping? Screws rigidly coupled to the motor can be a MAJOR resonance issue with full-stepping or half-stepping.

    I have them coupled with one of these flexible aluminium couplings. I would not count this as being too rigid. But as a matter of fact I ordered new parts today to switch this to a 1:2 geared belt-driven assembly. 🙂

    Another question is whether your commanded move rate is hitting a step-doubling frequency -- if you are commanding full steps and the Duet is sending two step pulses at a time due to high frequency, that's not going to work at all. But I don't imagine this is happening at low speeds.

    At the lowest limit of RRF 30mm/min I cannot imagine this to be the cause.

    Overall though, I'm not sure I think there is any benefit to what you're trying to do. What's important to Z quality is setting your layer heights to a multiple of full steps so every layer occurs at the same microstep index, not necessarily only doing layers at full step positions. Angle errors attributable to microstepping (eg driver current control issues and detent torque variation) are fully repeating by microstep index. Microstep 7 always has the same error, microstep 13 always has the same error, etc. And torque doesn't vary by a meaningful amount: every microstep position provides about +/-5% as much torque as the full steps.

    Now this is very interesting. I always understood this recommendation that the motor should be used at its native full-step positions.

    But the only real problem that could arise from not following this assumption would be when the printer lost power and you want to resume. Because even with very precisely repeating endstop switches it is rather likely that it will trigger at another microstep then before. But yeah, this would be off then a worst case of a half full step which is to be ignored anyway.

    So, thanks for clarifying! This saves me from a lot of trouble. 🙂



  • @wilriker said in Homing Z in full steps:

    But the only real problem that could arise from not following this assumption would be when the printer lost power and you want to resume. Because even with very precisely repeating endstop switches it is rather likely that it will trigger at another microstep then before. But yeah, this would be off then a worst case of a half full step which is to be ignored anyway.

    So, thanks for clarifying! This saves me from a lot of trouble. 🙂

    I might have got this wrong but I seem to recall reading in another thread that DC42 said on power up, the difference between motors could change by as much as 4 full steps. Can't remember the reason and apologies to DC if I have misquoted him.



  • @deckingman I remember this as well. But in any way there is a rehoming necessary after power loss and in that case 1 full step off is the same as 120 full steps off because in the end it only counts on which microstep the endstop is triggered and you can never be more than +-0.5 full steps away from the previous homing-trigger-microstep.



  • One of the potential benefits of using StallGuard to home the Z axis was that it should ideally stall out on a full step. However, in practice, the suitability for implementation is very printer specific. (i.e. Stiff bed, high steps per mm, single Z motor.)



  • @phaedrux said in Homing Z in full steps:

    (i.e. Stiff bed, high steps per mm, single Z motor.)

    And I'm out. 😂



  • @wilriker Don't feel bad. I would consider my printer to qualify on all those counts, but I would have to switch from a 3 point bed mount to a 4 point to make the bed solid enough to stall consistently across the bed surface.

    Thinking about the problem, and the way the motors behave, if you really wanted to ensure a fullstep position at the start of your print you could maybe do it manually with a rather unorthodox homing macro.

    • Home the printer as normal to allow safe movement of all axis
    • Use M291 Z1 to move the print head down until it touches the bed
    • Cycle power to the Z motors with M84 Z to force them to jump to the nearest full step
    • Use G92 Z0 to set the z position and re-home Z
    • Start your print


  • @phaedrux No worries, I don't feel bad. I knew that the printer I started out was acceptable at best with some parts being... less than that. 😁 This machine is for tinkering and I will continue to upgrade it probably until I quit this whole 3D printing and switch to 4D into-existence-thinging. 😂

    Re unorthodox homing macro: I thought of something similar already but after @RCarlyle's clarification I just stopped with this endeavor. 😉 I will just make sure to always use multiples of my full steps (currently 0.04mm and changing to half of that soon). I adjusted all related settings in Cura and also made some macros with appropriate Z hop presets. 🙂



  • Power loss is an interesting case. The detent torque of the motor will make it try to turn to the nearest full step (one coil 100%) position on power loss. So it would power down to full step +A,+B,-A, or -B in the cycle. (Assuming a fine leadscrew thread pitch that is self-locking so the motor is not overhauled by the bed/gantry weight. All bets are off with Tr8x8 and ball screws.) If you're at a half step position, the detent torque is unstable and could send you in either direction. Friction and gravity load may stop you anywhere though.

    Then on power-up enable, the driver energizes to whatever it considers the index 0 microstep position. Could be +A(100%) full step or on some drivers it could be a +A(71%)+B(71%) half step. (I'm too lazy to check what the older 498x and newer 2660 Duet drivers do but I think it's the latter.) At this point the motor will snap backwards or forwards up to +/-2 full steps from the powerdown position. If you have multiple motors, and one snaps +2 while another snaps -2, there's your 4 full step maximum relative error.

    Sidenote: terminology on full step vs half step positions is inconsistent. For the physical motor (rotor/stator teeth aligned) the "full step" positions are single-coil-on-100% positions. However, when modern microstepping drivers "full step" they actually use the four half step positions (two-coils-on-71%), because this is a superior way to run the motor. (Less torque ripple, less resonance.)



  • @rcarlyle said in Homing Z in full steps:

    At this point the motor will snap backwards or forwards up to +/-2 full steps from the powerdown position.

    I don't get why it would move up to +/- 2 full steps even though I at least think I understood all of the rest.



  • @wilriker bipolar two-phase steppers have 50 rotor teeth and four distinct places those teeth can line up with the stator poles. That's how you get to 200 steps per rev. (400 steps/rev motors have 100 teeth instead.) So there are four full step positions for each rotor tooth and the microstepping sequence repeats four times before it starts over for the next rotor tooth. So with 1/16th microstepping there's actually 64 distinct microstep angles with different +/- signs for the coil energization. When you do more than four full steps, that sequence repeats.

    When you stop the motor, it can stop anywhere in the four step range. But when you power-on enable the driver, it will ALWAYS energize to a particular microstep in that four step range. The motor will jump to the power-on position from wherever it stopped. That means it pulls to the nearest rotor tooth, which can be up to 2 full steps away from the current location. (Half of the four-step sequence.)



  • @rcarlyle Thanks! Your detailed explanation plus the animation of a stepper on Wikipedia (visual clues often help me understand things better) I think I got it now. Or at least this will iterate in the back of my mind until I finally understood it. 🙂 👍



  • @RCarlyle I just realized that I probably had my motors running at only a little over 25% of their rated current (because I rewired them in parallel and did not double the motor current - see this thread).

    I guess that would (also) explain why they where just rattling when switching to full steps, wouldn't it?


  • administrators

    @wilriker, you may also need to reduce acceleration when using full steps.


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.