Menu

Direction change issue

2019-12-16
2019-12-18
  • Alan Townshend

    Alan Townshend - 2019-12-16

    Hi Robert, I have been playing with autofocus in INDI, and have been getting inconsitent results.

    Long story short on change of direction the focuser seems to go in the wrong direction for a couple of steps, then changes direction and starts to move in the right direction, I am using a 0.01mm dial indicator to see this. I have measured 0.0046mm/step

    So lets assume I have just moved IN 100 steps, if I move IN 100 more steps then the dial inidcator shows travel in the same direction. If I then move OUT 100 steps, I see the dial indicator blip inward and then move outward, and if I know move back in I see the dial inidiactor blip out ward then move in.

    It is almost like the backlash is being applied in the wrong direction. I am using your winodws controller to do these tests, but cannot tell if backlash is being applied or not from the interface, and when selecting set the backlash step, I'm not sure where I am enetering the value?

    I found doing a +1,+1,+1,+1........ would move approximately 3 steps in the wrong direction, then no apparent movement for approximately 4 more steps (probably now moving in the right direction, taking up backlash), then start moving in the right direction.

    I am using full step, and tried with coil power both on and off, speed low, FW 292 (also tested on a previous version)

    Is it possible to debug the driver, with the focuser working, actually driving the stepper?

     

    Last edit: Alan Townshend 2019-12-16
  • brownrb

    brownrb - 2019-12-16

    Hi Alan
    Backlash enable and steps is set on the extra settings page before connecting to the controller. if UOC is checked, these values are sent to the controller when connecting. If you need to change then disconnect, change, then reconnect.

    You could try setting backlash to 200 steps (for a nema17 at full steps that is one revolution) and would be easy to see if backlash was being applied in the wrong direction.

    Remember you can have backlash enabled in, out or both. Normally you would set backlash in enabled as that is the way most auto-focus routines would operate.

    About debugging the driver with the focuser working - not really as there is only one serial port.
    I don't think the backlash code has not changed since finalized way way back (like 26x)

    Does your focuser have an OLED display (or any display).
    If so I could generate a test version that would display the backlash messages on the oled display and scroll them as they happen?

    Regards
    Robert

     
  • Alan Townshend

    Alan Townshend - 2019-12-17

    Thanks for the feed back, it took me a little while to find those settings (didn't realise there were "Extra Settings" under the Extra settings!). I played with the backlash for awhile, eventually completely disabsling it, but still seeing exactly the same behaviour!

    I have checked my wiring, it is the standard PG27, and it seems fine. I rebuilt the firmware with backlash disabled, and still the same behaviou, so I turned my attention to the code, whcih I am muddling my way through.

    I beleive it has a loop that runs as fast as possible, with no interrupts, and only moves the stepper by one step each time through the loop, so to move 10 steps the loop will need to be executed 10 times?

    At the start of the loop some variables are initialised as shown here


    void loop()
    {
    static byte MainStateMachine = State_Idle;
    static byte backlash_count = 0;
    static byte backlash_enabled = 0;
    static byte updatecount = 0;

    ifdef HOMEPOSITIONSWITCH

    static byte stepstaken = 0;

    endif

    Which to me looks like regardless of what state machibe was doing, it will always go back to state_idle for each loop, and the back lash count is reset to zero, so the code that decrements the backlash_count will have no effect.

    I moved the above block of code outside the loop, but it had little to no effect on the issue I am seeing, so not convined they are initialised on every loop, but can't see why they wouldn't be.

     
  • Alan Townshend

    Alan Townshend - 2019-12-17

    OK, done some googling, and it appears static variables are only initialised once, when the function is called. So that explains that!

    I'll keep trying to get to the bottom of this and I do have an LC 2004 connected.

    I assume if my wiring was wrong to the stepper, that every request to move would be bad? But I only see "funnies" on change of direction.

     
  • brownrb

    brownrb - 2019-12-18

    Hi Alan
    Sorry for the delay in replying, just finished a mammoth code sprint for new features into the esp32 wifi controller.

    Cannot be the wiring- as stepper would not be moving

    Static - that is why those variables are static

    the ino file is myFP2_DRV8825HW203_2xx right?
    With an LCD 2004 right?

    Attached - shouold be ready to program - no need to change anything
    -normal lcd page update is turned off
    debug messages on moves and backlash sent to lcd2004

     
  • Alan Townshend

    Alan Townshend - 2019-12-18

    Hi Robert, thank you for test code, but I think I may have been wasting yout time, very sorry.

    You know how they say "by measuring it, you change it", well in this case it appears to be true.

    I removed the stepper (PG27), and bracket from the rack of the focuser, and switched the PG27 with a PG5 that I originally had, and put tape on the output shaft.
    I then ran some tests, without the dial inidcator, just a bit of tape on the shaft, and it looked great. So I switched back in the PG27, and it too looked great. So I put it back on the focuser and tried it again, still without the dial indicator, and again it sounded good (I could hear the backlash change in note as the stepper changed direction.) So far so good!

    So I then MAGNETICALLY clamped the dial gauge onto the stepper bracket to get a better look at small steps, and this is when starnge things started happening. So I think the root of my issues has been the dial indicator using a magnetic clamp, interfering with the stepper direction. This is my current working theory.

    I shall try to mount the dial clamp some other way, just to prove this to myself, but with Christmas on the horizon, it may have to wait until the new year.

    Something I did spot was the wiring colours in the text document"Stepper wiring and DRV8825.txt" do not match the colors in the "myfocuserpro2.pdf"

    Hope you have a very Happy Christmas, Alan.

     
  • brownrb

    brownrb - 2019-12-18

    Hi Alan
    Ok, our limited panel of experts will step down.

    The wiring - yes, it is hard to keep up. The wire colors sometimes differ now from stepper online - especially from the models I purchased a few years back from stepper online. Often there is some outlier document that did not get updated. Thanks for the pointer, I will take a look

    Regards
    Robert

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.