Get get autofocus to work


I have followed the settings in the instructions but just cant seem to o get AGPro to properly focus. It’s always just a little off when checking with a mask… I think the problem might be that my V curves are not straight, the first to second sample line is always flatter than the 2nd third etc. I read that this was due to backlash not being sufficient but increasing it seems to make no difference. I have tried with it set to 150 and still have issues. I dont seem to get anywhere with it, sometimes if backlash is at 0 it seems to work better but that makes no sense! I’m basically just fumbling around…
My focuser is a PegasusAstro focus cube and the scope is a brand new William Optics ZS73, which has a nice big rack and pinion focuser. I cant really find much backlash in the system, certainly not a massive amount, everything seems nice and tight etc. What can I do?


It does sound like a bit of backlash. What are your autofocus settings (# of steps and step size)?

Try to aim your autofocus such that both out of focus HFR end points are about 3-4x what the in focus HRF is. For example, if you are perfectly in focus and your HFR reads 1.0 (bottom point of the V curve), try to increase the step size so that both outer points of the V curve are around 4.

Are you using a flattener or reducer? Since SGP’s focus routine uses stars from across the whole image, if the field isn’t very flat and the stars on the edges are oblong, SGP may calculate a different focus point than what the center of the image needs. It sort of averages the focus across the field. Then if you go and check the center star with a bahtinov mask it might look a little out of focus. But note that a Bahtinov mask will not be as accurate as a good autofocus routine.



I have my focus set so that its about 4 or 5 times greater than the in-focus HFR. I get about 0.8 when in focus and after the 9 steps it’s usually around 5 or 6. I am using the dedicated field flattener and the field does look OK, I also set it up to reject the outer 10% of the image for focusing.
Is there any harm in putting in a massive backlash figure, say 500? Other than it would take longer to initially focus as it needs to move out 500 then back in, in theory would this cause any issues? I just want to eliminate Backlash as I cant see anything else that it can be.


Well it looks like you’re doing everything correct. I’d say you’re just going to have to experiment with the backlash settings.

Something else you could do is save your autofocus packs for someone else to look at.


Ok, will have another play with the settings and maybe save the focus packs as well.


It looks like your doing things right. I would suggest your coupling between the motor and the focuser is slipping. That is the first thing I check. With rack and pinion focusing set your backlash to around 10. Bruce


So I increased my backlash setting to 250 and last night the V Curves looked bang on, the little dip on the first capture was gone and I did not get the warning on the final focus move that the HFR was not expected - all good I thought and outside when looking at the laptop it seemed fine, I ever checked with a mask though :frowning:
So today on looking at a 5 min sub I think its still slightly out of focus, what do you guys think and what else can I do? I have checked everything mechanically and it all seems to be OK.


This is based on you were able to get a better HFR by manually focusing? It can be hard to tell from a sub whether it is at optimal focus, as you local seeing conditions will likely determine the best HFR you can achieve.

That said, I have found that fine tuning the backlash setting is important: After SGP has completed the V-curve analysis it then needs to return the focuser to where it thinks the optimal focus position is - if you are still suffering from backlash, then it will not be able to return to the optimal point.


I don’t believe it is so important…as long as you correct for more backlash than you actually have.



If you over-correct for backlash won’t you still be out of focus?

SGP and your focuser (in my case, stepper driven) have no real idea where your telescope focuser is actually at - they just count X number of steps sent to move it In or Out. If you configure backlash as 100 steps but you only really have 50, then when backlash compensation is applied you will be 50 steps out from where SGP/focuser thinks focus is at.


I don’t think so. The backlash steps can be any number larger than the actual backlash. I have a backlash of about 90 and I use 150. I have an excellent focusing.

From SGP help, under backlash:

“Compensation step size: The number of steps to move to remove the backlash. This number does not need to be precise. If anything it needs to be larger than the total backlash in the focuser, so overshoot.”


Hmm - that would seem to imply that backlash comp is only applied before starting the v-curve, but not when returning to the “optimal” focus point (which requires a change in focuser direction, and so could suffer from backlash). Overshooting before starting the v-curve doesn’t matter - it just guarantees you have taken up all the “slop”. But if you overshoot when reversing direction, that’s going to be a problem.

It would be interesting to hear from the devs if that is indeed how it is applied.


Both, it will be applied before starting the v-curve and when returning to the optimal focus point.

Let us say that you are in position 5000 and have 7 “Auto Focus Data Points” assigned, with a step size of 100, plus 200 steps for backlash. Then to start the focuser will go to position 5300 plus 200 (backlash compensation), then it will return to position 5300 to take the first frame to determine the first focus point of the v-curve. Once the v-curve is completed and the optimal focus point is determined, let say, the best focus position found is 5100, then the focuser will go to 5100 + 200 (backlask compensation), and the it will return to 5100, the optimal focus point.

It is important that you set the Compensation direction correctly and to input a backlash compensation value larger tan your actual backlash.



Ok - agreed (sorry, had to do it out on paper to convince myself :wink: - as long as the BLC is set to be bigger than your actual backlash and as long as the direction is set correctly, it will work.

In order for the direction to be “correct”, you need to always finish your initial manual focus in the same direction (either In or Out) and set direction accordingly, otherwise you can end up with a very lopsided v-curve and may not have enough data points on one side of the curve to get to good focus.


What happpens if you have backlash in both directions? In order to get a good v curve you need ti remove any outwards (think thats the way the vcurve runs) backlash but then once the curve has been calculated the focuser changes direction ans moves in to the final position, this move wont have backlash applied.


Backlash doesn’t actually have a “direction”, just a size. As long as you specify a backlash compensation setting that is bigger than your actual backlash, then each time BLC is applied (regardless of which direction) it is guaranteed to take up all the backlash (and then overshoot by some amount).

The only reason “direction” is needed in the SGP settings is so that SGP knows whether to apply BLC for the first focuser move it makes when generating the v-curve.

As an example, let’s assume your backlash is 50 steps, but as part of your initial manual focus routine you final focus action is to always move OUT until all slop is taken up. At that point, there is no more OUT backlash (you’ve taken up all the slop) so all the 50 steps of backlash will occur when the focuser first attempts to move IN. So, if you finish yout manual focus routine by always moving OUT, you should set your backlash direction setting in SGP to be IN.

The worst case scenario for SGP is if you have manually taken up all slop, but specified the wrong direction for BLC. In this case, the first time SGP moves the focuser, it will either:

  • Apply BLC when it should not and overshoot the focus position by the # of steps you specified for BLC,
  • OR it will fail to apply BLC when it should and so undershoot the desired focus position by the # of steps in BLC.

Depending on the size specified for BLC, either of the above cases could make it more difficult to create a good v-curve.


These are not true. Also some ending statements not true.
Backlash does have a direction. And it is of critical importance. It is specified by the “direction” setting. Also it is not only applied on the initial focuser move. It is applied every time the focuser is moved in that direction. Example: All scopes I have ever used have required that “direction” be set to “IN”. For my Televue refractor I use a step size of 20, a backlash of 100, “direction” IN, and number of increments 7. The 7 means 3+1+3, ie. rack out 3 steps, then do 7 focus runs progressively from 3 out, through current position, then to 3 in. By OUT I mean larger position numbers and by IN smaller focus numbers. So a focus run does the following:

Assume a starting focus position of 18000, and that best focus after the run is determined to be 17985.
So it does a sample focus in the following order at the following positions:
move OUT to 18060
move in to 18040
move in to 18020
move in to 18000
move in to 17980
move in to 17960
move in to 17940
move OUT to 17985 (takes final comparison focus at best focus position)

However, to get to these positions it does the following actual moves:
move OUT to 18160 ( = 18060+100)
move in to 18060 take focus (this move takes up the backlash of 100)
move in to 18040 take focus
move in to 18020 take focus
move in to 18000 take focus
move in to 17980 take focus
move in to 17960 take focus
move in to 17940 take focus
move OUT to 18085 ( = 17985+100)
move in to 17985 take focus (this move takes up the backlash of 100)

Note: sample focus is always done at a position where the focuser did an IN move. Moving OUT past the desired position by the backlash amount and then moving IN to the desired position (by the backlash amount) is what removes the backlash. It is now easy to see that having a larger backlash value than the actual required backlash is just good insurance that you have removed all the backlash.

By watching your focuser carefully during a focus run, you can easily see these backlash moves being applied. If you manually ask the focuser to move out by any amount, even just 5, it moves out 105 then back in by 100. All IN moves just move in immediately.


So let’s assume the current direction for your backlash is IN and has a size of 20 steps. If you direct the focuser to move IN 25 steps it will first take up all 20 steps of backlash, and then move the focuser 5 steps IN, agreed?

Now if you immediately ask it to move OUT 20 steps, what happens?

Does it move the focuser out 20 steps or does it first have to take up the 20 steps of backlash/slop before the focuser will move? It’s the second, right?

My point was the the “direction” of the backlash is dependent on your immediate previous move (either IN or OUT). So the only way to make sure that the direction specified in the SGP setting is applied correctly is to first move the focuser in the opposite direction until all slop is taken up.


It depends.

If your scope is level then yes, the focuser may remain at the same position while the motor position moves out by 20 steps and takes up the 20 steps of backlash.
But if your scope is pointing high then as the motor moves out by 20 steps gravity causes the focuser to move and follow the motor and move out by thse 20 steps.

What this means is that you don’t really know where the focuser is, it could be anywhere within the backlash range.

Even if you can rely on the focuser mechanism being sufficiently stiff that it doesn’t move unless the focuser motor moves it then in order to have an accurate position the position must take account of the exact value of the backlash and the last direction of movement. The backlash must also be determined accurately and must not change, neither for different positions in the focuser travel nor as a result of things such as temperature.

In contrast the method described by jmacon will give a much more reproducible result.
First, all the backlash move has to be is greater than the mechanical backlash, for example 100. The mechanical backlash can be any value from 0 to 99.
Now when the focuser is moven in the motor pushes it and stops at the required position. If the focuser in your example is moved out by 20 steps the first move is by 120 steps, 20 of which take up the backlash and the next 100 move the focuser. Then the final move moves the focuser in by 100 steps so setting the focuser to exactly 20 steps from the original position.


Hi Chris,

Yep, fully understand and agree that using a BLC greater than the actual mechanical backlash will guarantee that all backlash is taken up regardless of which direction you move.

My only point was that backlash itself does not have an inherent direction - it is dependent on which direction the focuser last moved .

It does beg the question then: Why does SGP even require you to enter a direction in the backlash settings? I don’t know the details of how BLC is implemented in SGP, but I assume(!) that it uses the direction hint to decide whether to apply BLC the first time you move the focuser - if not, then why ask for the direction info at all?, because as you have pointed out, all subsequent focuser moves will apply the full BLC value.

Anyway, unless your backlash is really big, having the “wrong” the direction setting configured in SGP probably can’t do too much harm: As I tried to describe in an earlier post, the worst case scenario is that you have already taken up all the backlash, but then apply full BLC on the first focuser move - this means you will end up X steps (where X=size of your backlash) beyond where you were aiming to be.