×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Stepper focusser directly from Raspberry

  • Posts: 314
  • Thank you received: 34

In your svn-code rpi_focus.cpp there is:
#define STEP_DELAY 4 // [b]mili[/b]seconds
could it be that you mean microseconds?

// Stepper motor takes 4 miliseconds to move one step = 250 steps per second (real rate = 240,905660377)
// 1) focusing from min to max takes 7 evolutions
// 2) PG2528-0502U step motor makes 7 * (360deg/15degperstep)*72:1 = 1728 steps per evolution
// 3) MAX_STEPS for 7 evolutions should be 12096

This is all meant in full step mode?

I am just trying to calculate MAX_STEPS.
Lets say my focuser needs 3 evolutions for min/max and has 60 teeth. My motor gear has 13 teeth.
(60/13)*3=13.846 evolutions for min/max at the motor. 13.846 evolutions multiplied by 200 steps per evolution gives 2769.23 steps for MAX_STEPS.

Status Report: ;)
  • The motor is mounted, wiring is done,RaspberryPi has been completely "gentoo-fied" (took me 3 days).
  • Now there is a lot of fine adjustment. Those elongated holes are fine but I am unable to tighten screws on the motor because there is no place. So I have to dismount the hole thing again and again for just adjusting the motor spacing.


  • In full step mode the motor and the whole tube somehow gets in resonance and makes incredible noise
    This can be corrected a little bit by optimizing the gears spacing but its still LOUD. In 1/2 step mode its bearable, at 1/8 it would be my desired loudness.
    @Kaczorek, what step mode does the rpi_focuser use and can this be changed somehow?
--= human, without Windows™ =--
pls excuse my bad english! :)
Last edit: 8 years 8 months ago by pauledd.
8 years 8 months ago #4732

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

  • Posts: 8
  • Thank you received: 0
Good to hear your progress!
The bcm2835_delay() function is specified in milliseconds.
The relevant code starts on line 525 of rpi_focus.cpp:
 // step on
        bcm2835_gpio_write(STEP, HIGH);
        // wait
        bcm2835_delay(STEP_DELAY/2);
        // step off
        bcm2835_gpio_write(STEP, LOW);
        // wait 
        bcm2835_delay(STEP_DELAY/2);
If you need better resolution you could change those to bcm2835_delayMicroseconds(STEP_DELAY/2) and specify STEP_DELAY in microseconds instead of milliseconds.

I found in rpi_focusser.cpp only full step mode. However there is a function FocusRpi::SetSpeed() that allows programming to different microstep values.

So you could change line 481 in FocusRpi::MoveAbsFocuser from SetSpeed(1) to SetSpeed(4) for 1/8 microstepping. But then you will also need to adjust the total amount of steps and delay also. So for 1/8 microstepping you use 1/8 of the delay value and multiply the total number of steps by 8.
Last edit: 8 years 8 months ago by Gerrit Jan Baarda.
8 years 8 months ago #4733

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

  • Posts: 314
  • Thank you received: 34
ok thank you, I will go into that after fine tuning mechanics :)
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 8 months ago #4734

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

  • Posts: 314
  • Thank you received: 34
Ok I somewhat managed the noise problem.
I run into another problem (I guess skywatcher only). After mounting my Canon700D/Flattener to the focuser the focuser shaft seems to have not enought pressure against the focuser tube so I did the optimization recommended in this video . The problem was when the full weight is straight down the focuser doesn't move if the motor moves. I admit this is a rare situation that I work with the DSLR on the top. After the optimization it work better but not perfect. The problem is when I start the focuser from total inward and set it to do 1000 steps outward and when done I set it back to 0 it moves inward until it reaches the zero point but its moving on. So it moves faster inward than outward.

If I cant fix this will this be an problem while doing ekos auto-focusing? Or does it try to focus until it reaches focus no matter how much steps it skipped. I will try to add some more pressure to the focuser axis to add more friction but I guess this will stress the motor more and more.
If that doesnt work I can still set to manual focus.

Everything else is set up, waiting for clear sky to test :silly:
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 8 months ago #4739

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

  • Posts: 314
  • Thank you received: 34
Situation update: Yesterday I was able to test focuser and I have to say everything works to my full satisfaction including auto-focus. It was able to focus in less than a minute without stepper-noise-terror to the neighbourhood.
Thank you all for your inspirations an especially Kaczorek for your driver! B)
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 7 months ago #4915

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


A video demo will be great!!
8 years 7 months ago #4916

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

  • Posts: 314
  • Thank you received: 34
Yesterday I tried again but auto-focus failed. Then I tried with manual again. I guess it failed because of seeing or I was just very lucky with my previous success. I recorded a video, the first half is the autofocus and the second the manual focus.

I can't escape the feeling that my focuser still needs some pressure-adjustments respectively is pure cheap crap. It still needs two steps outward and one step inward to get to the same position.
Question to the others: Does your focuser exactly re-focus to a specific value? How much backlash do you have?

Here is the video
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 7 months ago #4920

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

  • Posts: 983
  • Thank you received: 375
pauledd, I have taken a look at your video and I there are a few things to note:
1) You should not use autostretch filter when focusing. It influences real HRF and can render unpredictable results. (at least this my experience).
2) I would recommend to lower the values of Step and Maximum Travel. Ekos autofocus is really for final focusing, so there's no point to set high step and travel values. If you do it almost always loses the focus (again these is my experience). I use Step=100 to get raw focus and reset it to 5 (and finally to 2) to get final focus, with maximum travel of 200. This means I do at least 2 rounds of focusing - raw & fine.
3) Backlash - you need to figure it out by experiment. It is very specific for your hardware. In my case I'm using 60 steps (and my maximum steps is 10000) on SCT and primary mirror focusing. The value I use for backlash comes from observing focuser knob gear (not motor gear). Set low step value (e.g. 5) and get a star out of focus driving in just one direction. At this stage make sure that backlash is set to 0. Next change focusing direction and observe the gear and the star. As soon as you see the first move of focuser knob and/or star focus you can estimate as a number of steps made after changing direction.

And the final thought... autofous is a nice feature but in reality I never use it. Instead I focus manually with Start framing on.

Good luck!
8 years 7 months ago #4923

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

I've noticed two things:

1. Auto-stretch was on. I think the Focus module warns you not to use filters when doing auto-focus.
2. The star was saturated. Reduce exposure time. Saturated stars gives erroneous HFR values.

The usual rule of thumb is, if you can obtain valid HFR values, the algorithm takes care of the rest.
8 years 7 months ago #4925

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

  • Posts: 314
  • Thank you received: 34
Just for those who read my previous voltage and current considerations on the stepper.
They are WRONG. My stepper is rated at 0.67A per coil. That is an total current
of 1.34A total. This is too much for the Raspberry Pi 5V pin even with a good 2A power supply, and
it is way to much for the 3.3V pin. I somewhere read it should not exceed 200mA or so...

I decided to power my stepper (VMOT) right from 12V Battery with a buck converter to 5V.
To set the current regulator potentiometer I calculated (2*0.67A)/2=0.67V (at VREF).
I am doing this because I sold my F5 Newton a while ago and now I received my new F4 newton
with much better monorail focuser and the mechanics will be rebuilt too.
--= human, without Windows™ =--
pls excuse my bad english! :)
Last edit: 7 years 5 months ago by pauledd.
7 years 5 months ago #11868

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

  • Posts: 314
  • Thank you received: 34
@Kaczorek

Is there a simple "software" way to reverse the fokuser direction?
Because after wiring my new setup if I press "Focus Out" my focuser
moves inward if I set a new Relative Position. Or do I have to change the polarity
in my cabling somewhere :blink:

Nevertheless, my new setup is now driven by a belt and feels much more
precise, silent and reliable. Also my new monorail 1:10 translation gives a lot
more precision than the old crayford that I had before and using 1/2-stepp on the stepper
seems sufficient.

I still have a lot to do until I can test the focuser on the real stars.
I currently built a "astrobox" that contains everything between the mount and the battery (12V,20AH) to
get rid of that thousand cables and power supplies and synscan motor controller. Etching one more PCB for DRV8834,
rewiring everthing to make it less messy and finaly check for condensation/moisture at "outside"
conditions.
--= human, without Windows™ =--
pls excuse my bad english! :)
Last edit: 7 years 5 months ago by pauledd.
7 years 5 months ago #11967

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

  • Posts: 314
  • Thank you received: 34
I was able to reverse the stepper direction by changing coil B2,B1 to B1,B2.
--= human, without Windows™ =--
pls excuse my bad english! :)
7 years 5 months ago #11970

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

Time to create page: 0.390 seconds