×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Backlash for Moonlite?

  • Posts: 185
  • Thank you received: 28
I have belt-driven DIY focuser which I think has some backlash in the PG27 stepper motor. This is based on the v-curve sort of looking like a V, but returning to a given position seems to not give the same HFR value in the focus module. Is there a way have the focus module go a number of steps beyond the target and move inwards to focus?
5 years 8 months ago #27941

Please Log in or Create an account to join the conversation.

  • Posts: 1029
  • Thank you received: 301

Replied by Eric on topic Re:Backlash for Moonlite?

I had the same issue with my DIY moonlite focuser. I implemented the backlash compensation directly inside the arduino firmware. It's clearly better, but even there, I have different HFR values for the same positions. I suggest drawing the v-curve using incremental or decremental positions, then drawing a new v-curve with min-max position to confirm the issue is backlash and not seeing, or even HFR calculations. Personally that's still on my todo list.

-Eric
The following user(s) said Thank You: Jasem Mutlaq, Richard Beck
5 years 7 months ago #27944

Please Log in or Create an account to join the conversation.

  • Posts: 185
  • Thank you received: 28
Eric,

Have you posted your firmware online? I'd like to look at your setup and either move to the same controller or figure out how to implement backlash compensation on the PnP focuser I'm presently using.

Thanks.
5 years 7 months ago #28131

Please Log in or Create an account to join the conversation.

  • Posts: 1029
  • Thank you received: 301

Replied by Eric on topic Re:Backlash for Moonlite?

Yes, see github.com/TallFurryMan/moonduino.

Look for variable "Backlash". The backlash offset was determined by measuring the lowest reverse movement that makes the focuser move. There is probably still a bug when the focuser moves by a distance smaller than the backlash, but I'm not under the impression that this situation will occur when the Ekos focuser tab runs.

To debug, I set "debug" to 1 and use a serial terminal to execute commands.

-Eric
5 years 7 months ago #28132

Please Log in or Create an account to join the conversation.

  • Posts: 185
  • Thank you received: 28
Eric,

I have successfully used your code to step a 5V 28BYJ-48. I have also successfully changed over to using an A4998 stepper driver and a NEMA 17HS13-0404S-PG27 motor.

I wanted to change the backlash logic so that the stepper is always moving inwards to position. To do that, if the new position is outward, I want to step to the new position plus the backlash compensation and then step inwards to the new position. The code I have implemented is
if(CurrentPosition < TargetPosition && 0 < Backlash)
        {
          TempPosition = TargetPosition + Backlash;
          stepper.moveTo(TempPosition);
          delay(100);
        }
       stepper.moveTo(TargetPosition);

I was hoping to see the display go to target + backlash and then to target. It's not showing up in the INDI control panel. When I set debug to "true", I get strange behavior, including nonsensical temperatures.

Any thoughts or suggestions?

Also, I can get the sketch to load and work on an UNO, but it doesn't seem to behave properly when I try to upload to a LEONARDO (with the appropriate changes in build target). Any ideas there? -- Edit -- I get this error "[ERROR] Handshake Attempt 1, updatePosition response error: Timeout error. "

Thanks.
Last edit: 5 years 7 months ago by Richard Beck.
5 years 7 months ago #28508

Please Log in or Create an account to join the conversation.

  • Posts: 1029
  • Thank you received: 301

Replied by Eric on topic Re:Backlash for Moonlite?

First of all, debug capabilities really depend on your arduino. I had to optimize the original code quite a lot to get it to fit in the memory, and still have free space for the stack. When you don't recognize your code behavior and everything seems weird, out-of-memory is the reason. Also, you can't have debug if you are connecting to INDI as the output will interfere with the protocol.

I'm not sure I understood what you wanted to achieve. The point is that whatever movement you apply to the motor, if it is going on the opposite side from the previous movement, you need to apply backlash to attain proper position.

In your example, I understand the last move was inwards. You're considering going outwards, so the movement must add backlash to get to the right position. So, why going inwards after that?

I don't remember precisely how my code works unfortunately :) Adding backlash causes the position counter to be different for the same physical position depending on the direction the stepper was running in. The problem is that the Ekos focuser maps the position value to the HFR value, so to be efficient the same physical position must return the same stepper position whatever the last rotation direction. I umm think I updated the stepper driver position to take this into account: request move to N+B, reset position counter to N, report position.

-Eric
5 years 7 months ago #28511

Please Log in or Create an account to join the conversation.

  • Posts: 185
  • Thank you received: 28
Eric,

I missed any code to correct the position so that given physical tube position is always at the same number of ticks. This is the reason to move out past the target and then back. If backlash is always added to move out, the backlash going inwards must be taken out to have the gears in full contact. If the gears are in full contact, there will be minimal slippage of the focuser outwards. Without the inward backlash taken out, the focuser can slip out up to the amount of backlash. As programmed, I'm moving out dist+actual_backlash+extra and moving back actual_backlash+extra. (Backlash is defined as actual_backlash+extra.)

Since the Uno version seems to be working, I'll take it out the next time I have a chance and will see if it works better than the original version I had. I already like AccelStepper over the simple stepper that was in the other code.

Thanks.
5 years 7 months ago #28512

Please Log in or Create an account to join the conversation.

  • Posts: 1029
  • Thank you received: 301

Replied by Eric on topic Re:Backlash for Moonlite?

Aah yes, slippage, understood. I didn't cater for slippage at all on my setup, the stepper controls the micro knob of the scope focuser, which doesn't slip at all, even with stepper backlash. But "at all" might be a little presomptuous here, thanks for reminding me.

I'll try to use your patch if my setup, that seems a very good idea. But don't you need to do the same on both sides? Else the position value will be wrong when the Ekos focuser looks for the local minimum and there will be some sort of dead zone I'm not sure it is able to manage.

-Eric
5 years 7 months ago #28524

Please Log in or Create an account to join the conversation.

  • Posts: 185
  • Thank you received: 28
My thinking is to always focus inward. Even when going to a higher number of ticks, the number of ticks goes up by the backlash, the focuser moves out extra+ y (y is the desired movement outward) ticks, the number of ticks goes down by the backlash and the focuser moves in the extra ticks to leave the focuser at +y with backlash compensated.

In my normal usage, I go to a preset which requires inward focus to get to the minimum. After the minimum is reached, which is defined by drawing in past the minimum, the focuser commands an outward movement. Using your logic, I compensate for the backlash and go out the number of ticks. An unfortunate side effect is the focuser could slip on out the outward backlash. Using my logic, we command the focuser to move as described above and return to the target position.

To move the focuser inwards, the backlash was compensated on the outward movement. Think of this as being equivalent to biasing the RA axis east heavy.
The following user(s) said Thank You: Eric
Last edit: 5 years 7 months ago by Richard Beck.
5 years 7 months ago #28549

Please Log in or Create an account to join the conversation.

  • Posts: 1029
  • Thank you received: 301

Replied by Eric on topic Re:Backlash for Moonlite?

That's clear. Do you manage movement requests smaller than the backlash value?

-Eric
5 years 7 months ago #28550

Please Log in or Create an account to join the conversation.

  • Posts: 185
  • Thank you received: 28
Any movement outward, no matter how small, should be compensated with this logic.

For example, I'm using 24 for the backlash plus extra value. A command to move outward 4 ticks would result in unwinding the true backlash and moving outwards by an amount of 28 ticks (24 + 4). After that, the default command outside the if() block would move the focuser inward 24 ticks (unwinding the true backlash and moving the extra included in the 24), leaving the focuser at a true 4 ticks outward.

I am concerned the if() never evaluates as true. I need to see what I can do to confirm it does and the focuser responds as intended. I was thinking increasing the delay to 1000ms might give me a simple chance to see the move past and then the move back in INDI. The alternative would be to include a print that "outward test is true, moving out plus backlash". Your thoughts?
5 years 7 months ago #28556

Please Log in or Create an account to join the conversation.

  • Posts: 185
  • Thank you received: 28
I now have code that implements the backlash compensation, but I don't get progress information until the scope moves forward.

Here is the code:
        if(TargetPosition > CurrentPosition) 
        {
          Backlash = BACKLASH_FPTN;
          TempPosition = TargetPosition + Backlash;
          stepper.moveTo(TempPosition);      
          while (stepper.targetPosition() != stepper.currentPosition()) stepper.run();
        }
        stepper.moveTo(TargetPosition);

Any suggestions on how to get the position to update while going outward? There will be no feedback moving from all the way in to a defined preset.

Thanks.
5 years 7 months ago #28620

Please Log in or Create an account to join the conversation.

Time to create page: 0.362 seconds