Help with Autofocus


Hi guys, I am new to SGP, and have just shifted from using MaximDL. I made the move due to the autofocus feature SGP offers. So far I like the software!

As my title suggests, I am not getting the results I expected with the autofocus feature. I have followed the online tutorial, and re-read it a few times with no luck.

I ma using a USB_Focus stepper motor on the stock 4" focuser on my TAK TOA-150. I have measured the step size to be about 3 microns per step.

Sorry for the long explanation below!

I’ll explain what I’m doing, and what my results were, and hopefully someone can point me in the right direction.

  1. Frame and focus with my Bahtinov mask, and my focuser position is at 614, at good focus. the autofocus settings, I have used a sample sizes of 7 and 9, and a step size of between 50-80 which works well. I’m using Bin 2x2 as recommended, and an exposure time of 4 seconds.
    3.Click “Run” in the focus control window.
    4.The focuser moves out to its expected position, and starts taking frames, then moves in by the required amount. 90% of the time I end up with a good graph, with the green lines, however I ALWAYS get the warning message saying that the HFR is out by 0.8 or so.
    5.Check focus with the mask at the new computed position, and focus is clearly out.

Now after running this quite a few times, and watching what goes on I have noticed a few things:

I watch the graph as the sequence runs, it starts with a high HFR, then drops to begin forming a “V” as expected. When the graph is showing the HFR at position 614 (Excellent focus) I expect it to start to rise again, completing the “V”. However it ALWAYS overshoots this value, and falls further, ALWAYS by approximately 100 steps. The graph keeps plotting as the focuser travels in, and I end up with a nice “V” curve, with green lines, and a best fit position of say 490 or 514, 495, or 528. So I pop the mask back on, and as expected, the star is out of focus. Move back to 614, and its in focus.

I hope this part makes sense below!

Now this is the part I really don’t understand. As the graph is plotting its curve, I am watching the HFR values in the little yellow boxes in the image. When the graph begins to overshoot MY expected good position of 614, the HFR values indeed do decrees, making it appear that its working, That is; at position 500, the HFR is 0.5, compared to 1.0, at 614.

When I check this manually it doesn’t add up. If I compare HFR values of the same star, at position 500 and 614 manually using the frame and focus tool, position 614 always shows a lower value.

Any ideas??


I believe the focuser you are using is not really absolute, but is relative and offers and absolute mode. Those can be a bit finicky and you may want other users with similar gear to chime in.

The only time I have ever seen issues like this is if you fail to deal with motor backlash or if the focuser has difficulty returning the same physical position… meaning 614 one time is not 614 the next time (or if the tube is binding… but that is usually exactly what you describe in the opposite direction. One way to test it to get to your focus position via a Baht mask, note metrics via something like Baht Grabber. Rack the tube out a bunch more then all the way in… then rack it back out to the focus pos and see if the metrics still match.

Other than this, I just have general advice:

  • Make sure the “star boxes” are drawn around actual stars and not noise or hot pixels.
  • Make sure the star boxes are not drawn around a bunch of nebulosity masquerading as stars
  • Try and shoot for a step size that yields around 2.5-3x that of focus when at the inward and outward edges.
  • Use backlash compensation if you need it.


Hi Ken, thanks for the reply. As far as I’m aware the stepper motor does offer absolute focusing, but I’ll get confirmation from the manufacturer. What do you know about changing to the absolute mode?

I don’t think it is backlash, because for at least a dozen times or so after racking in and out, and running the autofocus sequence, position 614 always showed good focus.

I’ll try what you suggested with racking the focuser in and out and checking focus again.

I’ll run through it again tonight and see how I go, maybe try a patch of sky with more stars too?

Is there a way to change the area size of the “Star boxes”, or is it automatic?
I specifically chose an area with no nebulosity, to avoid errors.



SGPro only supports absolute focusers so you are are already in absolute mode. I am just indicating that some focus motors are “relative” motors that the designers, through software, expose as an absolute stepper motor. Not sure what yours is.

It’s automatic. If it’s a star poor area, make sure AF is not grabbing a whole bunch of junk for metrics (noise, hot pixels, etc).


Thanks Ken, I’ll try some things tonight. I’ll increase Binning and exposure time also. Is it possible to subtract dark frames when running autofocus, to avoid hot pixels?

My ASCOM utilities tell me that it is an absolute motor? I might post on their users group also.




I use several USB-Focus on my scopes : one 80mm APO refractor and two 150 and 250 reflectors.

Autofocus is absolutely correct with SGP with the ASCOM driver 2.62 (the last released by USB-Focus)

My settings :

  • Bin 2x2 and 4" exposure with L-filter on a ATIK One, or the same with a Canon 500D. 20" with Ha 6 nm filter, bin 2x2. Same as you.
  • 9 steps with the refractor, 11 with reflectors
  • Stepsize : 15 with the refractor, 12 with the reflectors (f5 and f4). So, much smaller than your settings. With these settings, my V-Curves are very nice.

Maybe, the position returned to SGP by the focuser is wrong. It happened sometimes with the older drivers but not with the latest. USB-Focus has a test routine for this kind of thing (downloadable on their site)

In my specific case, I never has any issues USB-Focus/SGP/autofocus since several months now.

Check that a reasonable number of stars are selected (not hot pixels or nebulosities)


Hi, thanks for the reply, and for sharing your settings. I am with the scope at the moment, and I think I have made some progress.

I have noticed that if I rack the focuser out by 2000 steps, then back in 2000 steps, focus holds well (visually, bahtinov grabber wouldn’t work!)

However if I rack it in 2000 steps, then back out 2000 steps, focus is out by 90 steps or so.

I set up th backlash to account for this, with good results when manually stepping the focuser in and out.

Autofocus also appears to be working well. I have run the routine a few times now and checked with the mask, and focus looks good. There was one occasion where a best for was not found, and the mask confirmed this, but after another run it worked well. Only had 55 stars to work with though.

Now my guiding doesn’t want to play along…time for a polar alignment tweak I think…



Good !

I forgot to tell you : yes there is a backlash to set, in my case I measured 42 steps (where one step appears equal to 2 microns in my case)


Yes, I was pretty excited to see it work! I’m going to get a friend to bring his micrometer around and measure the step size more accurately. I got 3 microns/step by using a ruler.

One funny thing I forgot to mention was that sometimes when I move in or out the motor won’t turn, even after 2 or 3 clicks of the button, but the step position changes on the screen. This happened both in SGP and MaximDL. I did a USB cable swap but still the same problem.

I forgot to re test after I set the backlash.

My focuser has the reduction drive for fine focusing, could this mechanism have any affect on the precision of the stepper position?



Be sure you use the latest ASCOM drivers (2.62) and use the USB-Focus test application to determine if there could be communication issues between USB Focus and SGP (this routine sends lots of move orders in both directions and checks returned absolute positions).
I had moreless the same behaviour as you (some move orders ignored) with older drivers. But not with the latest.
Be also careful with DB9 electrical contacts. Weldings may be, say, “sensible”. If a wire is “near from being disconnected”, you may have this kind of behaviour.

I don’t see why the reduction mechanism should impact the accuracy of absolute position. It probably impacts the stepsize, though.

Good luck for your imaging session !


Hmm, yeah I thought maybe there was somespring or tension in the reduction gears causing some errors, but it seams to be doing ok now.

I hav the latest drivers, but I don’t understand how the test app works, when I run it, the information is there, but the last line of text says “disconnected, press enter to continue”?



Knowing the size per step is not super important. Just set it up such that your high hfr is 2-3x your low on the AF graph. So if your low hfr is 0.9 shoot for 1.8-2.7ish on the high side of the graph. Adjust the steps per sample to get to this number.



Hi Jared, thanks, I experimented a bit and found that small step size gave me poor results. I ended up with a step she of 80, which is pretty high perhaps. As the autofocus runs I can clearly see the stars go in and out of focus. It’s probably too high, but now that I have fixed the backlash issue I will lower it and see what happens.


Just wanted to say thanks for the great support and super quick response times on the forum :smile:

Great service.