Inconsistent homing results

Home Forums TinyG TinyG Support Inconsistent homing results

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #4877
    JuKu
    Member

    I found that homing speed and results are linked, and the results sometimes unpredictable. Details: In the following, the measures are by eye. Lines starting with ==> are the commands sent, and the log shows the response. My switches are Omron . They are connected so, that in normal state, they connect +3.3V through 100R resistor to the switch input. When switched, the resistor input is grounded. I added capacitors to the switch input (I have v7 hw). I’m sorry, I don’t remember ther value; might be 1uF. (Of several configurations I tried this proved to be the most noise immune.)

    First, here are my settings:

    ==>{"z":""}
    {"r":{"z":{"am":1,"vm":2000,"fr":2000,"tm":80,"jm":2000000000,"jh":2000000000,"jd":0.0100,"sn":3,"sx":2,"sv":500,"lv":500,"lb":6.000,"zb":0.000}},"f":[1,0,9,8566]}
    ==>{"sys":""}
    {"r":{"sys":{"fb":392.65,"fv":0.970,"hv":8,"id":"9H3583-PZP","ja":100000,"ct":0.0010,"st":0,"mt":3.00,"ej":1,"jv":3,"tv":1,"qv":2,"sv":1,"si":200,"ec":0,"ee":0,"ex":0,"baud":5,"":0,"gpl":0,"gun":1,"gco":2,"gpa":2,"gdi":0}},"f":[1,0,11,8615]}
    ==>{"3":""}
    {"r":{"3":{"ma":2,"sa":1.80,"tr":8.000,"mi":2,"po":1,"pm":0}},"f":[1,0,9,744]}

    Repeated homing results: About third of the time, the switch lever stays in touch of the triggering post, about 2/3 of the time, there is about 6mm gap.
    In the following, the first homing cycle resulted to the gap, the second left the lever touching.

    ==>G28.2 Z0
    {"r":{},"f":[1,0,9,4402]}
    {"sr":{"coor":0,"dist":1,"home":0,"cycs":3}}
    {"qr":28}
    {"qr":27}
    {"sr":{"mpoz":-1.393,"stat":9,"momo":1,"macs":5,"mots":1}}
    {"sr":{"mpoz":-3.018}}
    {"sr":{"mpoz":-4.643}}
    {"sr":{"mpoz":-5.958,"hold":4,"mots":2}}
    {"qr":27}
    {"sr":{"mpoz":-4.524,"hold":0,"mots":1}}
    {"sr":{"mpoz":-2.899}}
    {"sr":{"mpoz":-1.274}}
    {"sr":{"mpoz":0.042,"stat":3,"macs":3,"mots":0}}
    {"qr":28}
    {"sr":{"mpoz":0.000,"coor":2,"momo":4,"dist":0,"home":1,"cycs":0}}
    {"qr":28}
    
    ==>G28.2 Z0
    {"r":{},"f":[1,0,9,4402]}
    {"sr":{"coor":0,"dist":1,"home":0,"cycs":3}}
    {"qr":28}
    {"qr":27}
    {"sr":{"mpoz":-1.435,"stat":9,"momo":1,"macs":5,"mots":1}}
    {"sr":{"mpoz":-3.060}}
    {"sr":{"mpoz":-4.685}}
    {"sr":{"mpoz":-6.042,"hold":4,"mots":2}}
    {"qr":27}
    {"sr":{"mpoz":-4.649,"hold":0,"mots":1}}
    {"sr":{"mpoz":-4.292,"hold":4,"mots":2}}
    {"sr":{"mpoz":0.000,"stat":3,"coor":2,"momo":4,"dist":0,"home":1,"hold":0,"macs":3,"cycs":0,"mots":0}}
    {"qr":28}

    My system changes latch and search velocities together (with at least 50ms gap belween the commands). Change them to 100:

    ==>{"zlv":100}
    {"r":{"zlv":100},"f":[1,0,12,5378]}
    ==>{"zsv":100}
    {"r":{"zsv":100},"f":[1,0,12,9597]}

    Result: Always leaves the lever touching. Here is a log:

    ==>G28.2 Z0
    {"r":{},"f":[1,0,9,4402]}
    {"sr":{"coor":0,"dist":1,"home":0,"cycs":3}}
    {"qr":28}
    {"qr":27}
    {"sr":{"mpoz":-0.318,"stat":9,"momo":1,"macs":5,"mots":1}}
    {"sr":{"mpoz":-0.643,"hold":3,"mots":2}}
    {"sr":{"mpoz":-0.645,"hold":4}}
    {"qr":27}
    {"sr":{"mpoz":-0.327,"hold":0,"mots":1}}
    {"sr":{"mpoz":-0.011,"hold":3,"mots":2}}
    {"sr":{"mpoz":-0.009,"hold":4}}
    {"sr":{"mpoz":0.000,"stat":3,"coor":2,"momo":4,"dist":0,"home":1,"hold":0,"macs":3,"cycs":0,"mots":0}}
    {"qr":28}

    Using faster settings (but still easily within the limits of the machine):

    ==>{"zlv":1000}
    {"r":{"zlv":1000},"f":[1,0,13,2994]}
    ==>{"zsv":1000}
    {"r":{},"f":[1,0,16,75]}

    Result: about 1mm gap, always. Log:

    ==>G28.2 Z0
    {"r":{},"f":[1,0,9,4402]}
    {"sr":{"coor":0,"dist":1,"home":0,"cycs":3}}
    {"qr":28}
    {"qr":27}
    {"sr":{"mpoz":-2.578,"stat":9,"momo":1,"macs":5,"mots":1}}
    {"sr":{"mpoz":-3.412,"hold":4,"mots":2}}
    {"qr":27}
    {"sr":{"mpoz":-0.782,"hold":0,"mots":1}}
    {"sr":{"mpoz":0.049,"hold":4,"mots":2}}
    {"sr":{"mpoz":0.000,"stat":3,"coor":2,"momo":4,"dist":0,"home":1,"hold":0,"macs":3,"cycs":0,"mots":0}}
    {"qr":28}

    Faster still:

    ==>{"zsv":2000}
    {"r":{"zsv":2000},"f":[1,0,13,5551]}
    ==>{"zlv":2000}
    {"r":{"zlv":2000},"f":[1,0,13,1200]}

    Result: about 3mm gap; bigger than with 1000, smaller than the long gap with 500. A log:

    ==>G28.2 Z0
    {"r":{},"f":[1,0,9,4402]}
    {"sr":{"coor":0,"dist":1,"home":0,"cycs":3}}
    {"qr":28}
    {"qr":27}
    {"sr":{"mpoz":-4.730,"stat":9,"momo":1,"hold":3,"macs":5,"mots":2}}
    {"sr":{"mpoz":-6.500,"hold":4}}
    {"qr":27}
    {"sr":{"mpoz":-1.968,"hold":0,"mots":1}}
    {"sr":{"mpoz":-0.040,"hold":4,"mots":2}}
    {"sr":{"mpoz":0.000,"stat":3,"coor":2,"momo":4,"dist":0,"home":1,"hold":0,"macs":3,"cycs":0,"mots":0}}
    {"qr":28}

    What might be going on? Debounce not quite working? Did I discover a bug?

    #4879
    alden
    Member

    I’m not sure what’s going on. First, levers are less accurate than buttons as there is a lot of variation in the throw. Is the Z latch backoff long enough to always back off the lever? How much travel does it take to always back off the lever? Can you post your Z settings?

    #4880
    JuKu
    Member

    >First, levers are less accurate than buttons as there is a lot of variation in the throw.

    True, but not this much. And that does not explain the repeatable dependence from speed.

    >Is the Z latch backoff long enough to always back off the lever? How much travel does it take to always back off the lever?

    I haven’t examined the minimum required. The specified 6mm is certainly enough. In all the tests I can hear the switch clicking both ways. It is always clearing the switch, but it seems to have a hard time figuring out when to stop when backing away.

    >Can you post your Z settings?

    Those are at the top of my post. Scroll the window sideways to see all of them.

    • This reply was modified 11 years ago by JuKu.
    #4882
    alden
    Member

    OK. Let me try to reproduce this when I get back to my shop.

    #4886
    JuKu
    Member

    I played with it some more this morning. I found that:

    – Jerk setting has a noticeable effect to where it stops – as expected. When using the fast end of the machine, speed also has an effect. So, when I got different stopping positions at speeds 1000 and 2000, nothing is wrong.

    – At slow latch and search velocities, it does not obey the latch backup setting, but stops as soon as the switch is cleared. This I think is the real issue.

    My 1/3 – 2/3 results at speeds 500 was likely the “right-at-the-limit” setting for yesterday’s star positions. Today, I didn’t get any random results, the machine stopped either at the switch or the specified backup position.

    Workaround: Don’t be ridiculously slow. 🙂 So, while you do want to fix this, it is not urgent for me.

    • This reply was modified 11 years ago by JuKu.
    #4889
    alden
    Member

    The latch move is supposed to stop as soon as the switch clears. The latch backoff value is just there to insure that there is an adequate movement to clear the switch.

    I notice zero backoff is zero. I’d recommend it giving it a couple of millimeters. Otherwise your zero is right on the switch and it may fire during normal operation – and you have the switches set for limit as well.

    #4890
    JuKu
    Member

    I understood that latch backoff means the amount of travel that is done to other direction homing switch trips, and it is my responsibility to set it big enough that it actually clears the switch. Also, I thought that zero backoff is an additional parameter that I can set (if I want to) to make workspace zero different from the hardware limits.

    So, what the latch backoff is supposed to be used for?

    I did some more poking. Empirically, it seems that if latch velocity is small, it is ignored. The machine moves slowly and stops as you say, as soon as the switch clears. If the velocity is large, it moves the full latch backoff amount.

    #4891
    alden
    Member

    You are correct about the latch backoff. It’s just a maximum travel for the latch phase. It’s also used if any switches are tripped during startup to back off those switches before starting the search. It’s really in there as a failsafe so that if the switch transition was not detected the machine would stop on its own.

    I suspect the reason the head gets to the latch backoff distance at high speed is that the jerk needs some time to slow down. The deceleration should be actually starting when the switch transition occurs. Please let me know if you see evidence to the contrary – that would be a bug. The latch phase is designed to run slowly so you get an accurate and repeatable stop.

    The zero backoff is optional, but you should try a rapid return to zero and see if your limits trip. If they do you need to add some backoff as a buffer.

    #4893
    JuKu
    Member

    > The deceleration should be actually starting when the switch transition occurs. Please let me know if you see evidence to the contrary – that would be a bug.

    Unfortunately, I do see the contrary. These are the settings:

    $z
    [zam] z axis mode                 1 [standard]
    [zvm] z velocity maximum       1000.000 mm/min
    [zfr] z feedrate maximum       1000.000 mm/min
    [ztm] z travel maximum           80.000 mm
    [zjm] z jerk maximum           2000 mm/min^3 * 1 million
    [zjh] z jerk homing            5000 mm/min^3 * 1 million
    [zjd] z junction deviation        0.0100 mm (larger is faster)
    [zsn] z switch min                3 [0=off,1=homing,2=limit,3=limit+homing]
    [zsx] z switch max                2 [0=off,1=homing,2=limit,3=limit+homing]
    [zsv] z search velocity        1000.000 mm/min
    [zlv] z latch velocity         1000.000 mm/min
    [zlb] z latch backoff            25.000 mm
    [zzb] z zero backoff              0.000 mm
    tinyg [mm] ok>
    tinyg [mm] ok>
    $3
    [3ma] m3 map to axis              2 [0=X,1=Y,2=Z...]
    [3sa] m3 step angle               1.800 deg
    [3tr] m3 travel per revolution    8.000 mm
    [3mi] m3 microsteps               2 [1,2,4,8]
    [3po] m3 polarity                 1 [0=normal,1=reverse]
    [3pm] m3 power management         0 [0=remain powered,1=power down when idle]
    tinyg [mm] ok>

    Note the long zlb value. On homing, the z travels all 25mm, even though it certainly has enough time to stop. On slower zlv settings, it does stop right after the switch clears. I tried on other axis which have different settings, but their behaviour on my machine is as you say.

    Btw, I was NOT correct about the latch backoff functionality. I thought the machine would start from the “bottom” of the switch and always back off the specified amount (like my z behaves now). I think I get it now, and I need to change my settings – or maybe not, I actually like the current behaviour. Fast settings produce good clearing for the switches (although not as you intended) and the homing is swift.

    And if I may phrase it a bit differently, this is how I now understand homing operation (please correct me if this is (still) not right): When the homing cycle has stopped at the “bottom” of the travel, it starts backing away at the specified speed*. When the switch clears, the machine has picked up some speed, but it stops when it can*. The resulting end position has nothing to do with latch backoff value, but is a function of the speed and jerk settings.

    (*: Latch velocity and jerk homing values are used)

    • This reply was modified 11 years ago by JuKu.
    • This reply was modified 11 years ago by JuKu.
    • This reply was modified 11 years ago by JuKu. Reason: spelling is hard
    #4897
    alden
    Member

    Yes, I think your explanation is correct. Sounds like homing still might have a bug for fast latch velocities. Admittedly, this is something I never tested because it’s not the intended use case, but sounds like a bug none the less.

    #4901
    JuKu
    Member

    Since I have an active thread about homing results, my results might be of interest: We found a bug, but when TinyG is used as intended, the results are not bad. I got new battery to my caliber, and run some experiments:

    Common factors: 8 microsteps, lever based good quality switches; lv= latch velocity, about twenty tries on each setting:

    Z axis, linear screw stepper, 8mm/rev, 1.8deg. step:
    lv 50: homing repeatibility < 0.01mm (under my caliber resolution)
    lv 100 – 500 (still within no bug area, but on the fast side): +0.05 .. -0.05 mm
    lv 1000: +.10 .. -0.10 mm

    X&Y axis: belt driven system, 40mm/rev, 0.9 deg. step. Here, I did not encounter the bug; slow setting is the intended use, fast setting the “stop whenever you can” case:
    lv 1500 (definitely in the fast area): +0.15 .. -0.15mm
    lv 500 (borderline area): +0.05 .. -0.05mm
    lv 100 (slow): under caliber resolution

    The absolute home postion is different in each case. Imo, this is of no importance. A CNC machine is a combination of mechanical design and control electronics settings. If you change something, it is expected that physical things change as well (like where the gantry really is after homing).

    Conclusions: It pays off to use the system as the designer intended. 🙂 Lever switches can be very repeatable, at least when relatively new.

    So, to the contrary to the thread title, homing results are actually very consistent.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.