Auto focus failed and have spikes all over low or high step size. 3.1.383

sg_logfile_af_15_20191123185822.txt (7.6 KB) sg_logfile_af_8_20191123184535.txt (7.1 KB) sg_logfile_af_2_20191123183443.txt (7.1 KB) sg_logfile_af_1_20191123183054.txt (7.8 KB)

This is a permanent build and I’d just changed to a new camera, neither did I move the focuser and the tube, back focus are all the same. So the near focus point is about oi the right step .

But when the first AF run, it come out with non moving or spike like HFRs, and it took me about an hour to finally gave up and do manual focus using Frame and Focus.

Turns out the best focus position is 20070 with HFR of 2.3 and the AF cannot give out this accurate data.


In order to see what is going on with your focus routines we need your actual logs. When I get those I will be able to figure out what the problem is.

The log file is more than 6MB so I uploaded to cloud, and here it is.


I think this is the same problem we had with the positions at 500000. In this case the step increment is only 5 at position 20000. I can’t check this at the moment because Mikael’s SGP Focus Logviewer program crashes reading this log file.

I think this will work if you can change your starting position to something like 5000 or less.

Thanks for looking at this @jmacon. We will get that range offset change out shortly.


No, on no account too high focus position values are causing the trouble in this case. My focus positions are in the range of 25000, and I varied stepsize between 8 and 25 steps - no problem at all whatever value was used.

I manually extracted the data (focus position, HFR, Number of Stars and Fit Quality) of the AF runs that were performed between 18:27 and 19:21 (CSV file appended). In this logfile there is no successful AF run. The reason for the AF algorithm to fail is: these data are crap, there is no detectable minimum in one of the AF runs.

There are several possibilities that could have caused this issue:

  1. Starting point too far away from best focus.
  2. AF Step Size too small (it was varied from 3 to 30 steps). Obviously the two runs with a step size of 30 were performed with a starting point far away from best focus. Furthermore, the number of stars is particularly low in these runs. It seems like clouds hindered the star detection.
  3. Not well adjusted focuser.
  4. Wrong Star Detection parameters (the AF frames were captured with 2x2 binning and the HFR Sample Size was soon reduced from initial value = 3 to 2).
  5. Strongly variable seeing conditions (local seeing).
  6. Thin clouds obscuring the stars.

Probably more than one cause is applicable here.

I also plotted HFR vs. focus position for ALL 38 AF run attempts. The graph (appended as well) looks very strange.

Not knowing details about the used telescope and focuser I will not speculate further. I am curious about how one could be able to adjust focus manually (with frame and focus) when such data are obtained.

Bernd (20.6 KB)


I was changing the camera from ASI071MC to ASI533MC, to get test results. And I WAS successfully focused ASI071MC on the other night using same step size 3 or 5 and steps at 9 or 12. But ccleaner seems deleted the log file. And since the focuser and its point remains the same place, there’s no way could the near focus point is far from 20000, (usually between ± 100)

The night sky is quite good, and I run autofocus just from parked place, some place near northern pole. wind speed is as low as <1m/s, seeing from MB is 0.7~0.8 whole night

My lat is 30.00 N and can easily do Sharpcap PA just before the first AF.

To specify my gear: OTA is Skywatcher 8" F/4 newt, and the focuser is WLD RoboPro Focuser.

This is how it looks like on that day.


To add up some info with fits header:

This is how it looks like when manually done focusing.

And I do have video captured the whole process, if it’s necessary I would like to upload to YouTube with 10x speed faster.


I did not intend to annoy you. The data extraction (manually a lot of work) was meant to facilitate the analysis for Jerry and Ken; SGP AF LogViewer indeed did not process your logfile, it crashed without providing any data.

I don’t believe that the focus point of your 071 and 533 is identical even if the backfocus distance is specified to be the same.

Nevertheless wrong Star Detection parameters could as well cause an issue, maybe because of the smaller pixels (3.76 instead of 4.78 µm).


@bulrichl, @jmacon

I found the bug and fixed it. I will send you the new version asap. Here is a summary graph of the different AF runs. Not sure what is going on here, but I agree with Bernd that this is not due to too high step values as we have seen in a case lately.



Thanks for the reply, I will manually assemble another tiny build to test on my roof when the sky is clear next week, I was worried about whether I got wrong backlash set or wrong Min star dia set, since I just checked my settings is 75 for IN backlash and 6px 6*6 for star detection.

But I’m pleased that the log viewer bug was found, since I have experienced the same crash issue to check the AF log prior posting this report.

Anyway I use HFR method, and have valid license of PinPoint but I did not use FHWM. During my AF tries, I’ve changed variable one by one to test if there’s anything wrong, first I unchecked just made FocusDark for 4s focusing, then I reduced focus time to 3s, and I even tried focus in bin 1*1, and adjust the steps or step sizes with no luck, changed the backlash from 0 to 120 with no luck, that’s the time I finally gave up and do manual focus with Frame and Focus and Focus control by moving the focuser IN 6 or 30 steps one shot by one shot.


Download the corrected Logviewer version 1.2 here:

Don’t hesitate to report this kind of bug using the thread regarding the Logviewer.


Thanks @mikaelA for the fixed viewer. It works great with the log from @esazx. Using it so I can now see the focus results, I agree with your prior comments that the range is not the problem. The positions around 20000 are just fine.

Maple, I think you should be working with step increments of at least 20. The ones less than 10 look to me to be a complete waste of time. You will never get reliable results because they are producing an HFR ratio of high/low of around 1.5 or worse. The ratio should be at least 2.5. These comments of course assume that the reported focuser positions are actually corresponding accurately to real physical positions of the focuser. I have my doubts about that. As @bulrichl mentions, your focus data looks pretty bad. You focuser is either working really poorly, or the seeing/weather was really bad. Since you have confirmed good weather, that leaves the focuser as the culprit.

Have you checked by close visual inspection that your focuser is actually making the requested moves? Your data is very consistent with a serious failure of the focuser to do what you are asking it to do.

Here is what I suggest you do:

  1. do manual focus to get a really good focus. Turn on image statistics. Capture the visible portion of the image and the image statistics panel, so we can see the star HFR results for the image.
  2. rack the focuser OUT 50 steps, and repeat the image capture.
  3. repeat 2) a total of 4 times. At this point you will have 5 images.
  4. repeat 2 a total of 8 times but move the focuser IN instead of out by 50 steps each time.

Post these 13 jpg images here so we can take a look at them.

Be sure you do the racking OUT and IN using your control software, not manually, after your initial manual focus.

Make your best guess as to which direction you need to apply backlash, and apply a generous amount of it prior to doing your manual fine focus.
Be sure all the images display both the Statistics summary tab and as large an image of your star field as possible with all the selected stars showing their HFR values.
Point your scope approximately toward the zenith for the tests.
Make sure your mount is tracking.

What we should learn from this is whether or not your focuser is producing regular, reproducible changes in focus. We will also get a good idea of what your backlash is, and what direction it needs to be applied. We will also learn what range of step values will work well for you.

You star image in good focus is excellent. You should be getting perfect focus curves on a good weather night, so something is really out of whack.

1 Like

With further looking at your focus runs, I think your step increment is way too low. Try values from 50 to 100. You may find that works right out of the box and not have to do the process I recommended above.

This process should give you a good value for your step increment:

  1. manually get good focus. Note focuser position and average HFR for the frame from statistics.
  2. rack focuser to lower positions and note the new average HFR, This should be larger than your first one in good focus, unless you are sucking up some of the backlash.
  3. continue 2) until the HFR is 3 to 4 times what you got in good focus at 1).
  4. compute your step increment from this formula: (Worst focus position - Best focus position) / 4;

Example: in focus your HFR is 2.5 at position = 20250, at worst focus your HFR is 8.1 at position 20025.
(20250 - 20025)/4 = 56.25. Set your step increment to 50 or 60, and set the number of steps to 9.


Thank you very much. And for all your hard working.

I’ve test the configuration yesterday night, turns out my motor control panel has a wrong configure.

The stepper control needs 1/8 microstep or 1/16 microstep. and I’ve wrongly turn it into a 1/4 microstep.

And also in the ASCOM driver the microstep multiplier setting is wrong. Which means the whole focuser step setting is dead.

With a local friend’s help he figure’s out with my motor, 1cm of tube moving usually needs 2000 ~ 3000 steps, more or less is bad setting, so I changed it to moving from 0 to 1.65 on tube needs 3550 steps. And the result is good as hell.

Using 9 steps and each step 12 and IN backlash 75 can finally do all filters’ AF without any problem, although I think my backlash is a bit higher than the actual one.