×

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
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 8 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 8 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 8 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.

  • Posts: 983
  • Thank you received: 375
I'm glad you have found the solution! Changing polarity of coils is a harware type of solution which is OK. There is also software type of solution, depending on what driver you use. If you use Astroberry PiFace drivers designed for PiFace Relay Plus and Motor Extra you can use Direction button on the driver's Options Tab. Just select Normal or Reverse to set physical direction for Focuser In/Out. This feature is not present in the legacy Astroberry Focuser designed for DYI HAT based on DRV8834 stepper driver. In this case you need to make changes to the source code and recompile.
7 years 5 months ago #11971

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

  • Posts: 314
  • Thank you received: 34
Thank you Kaczorek, I do not plan to get such a PiFace thing as long as the astroberry focuser driver works.
Do you plan to update the Astroberry Focuser furthermore, will it work with future versions of indi? Or is it abandoned because of PiFace?
--= human, without Windows™ =--
pls excuse my bad english! :)
7 years 5 months ago #11973

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

  • Posts: 983
  • Thank you received: 375
I still maintain the astroberry focuser driver. However I do not develop it actively. I can make changes on community request or introduce lazy updates based on piface changes. I assume it will work with future versions INDI unless major changes to focuser interface are introduced. I will try to update it by then.
7 years 5 months ago #11979

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

  • Posts: 314
  • Thank you received: 34
Dear Kaczorek,
Today I tried to compile your astroberry driver again but I get errors from make regarding 'PortT' / 'PortTP' was not declared...:

Full output:
paul@Gummi ~/build/astroberry-test/build $ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
-- The CXX compiler identification is GNU 5.4.0
-- The C compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- Checking for module 'libindi'
--   Found libindi, version 1.4.1
-- Found INDI: /usr/include/libindi (found version "1.4.1") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/paul/build/astroberry-test/build
 
paul@Gummi ~/build/astroberry-test/build $ LANG=en make
Scanning dependencies of target indi_rpibrd
[ 25%] Building CXX object CMakeFiles/indi_rpibrd.dir/rpi_brd.o
/home/paul/build/astroberry-test/rpi_brd.cpp:26:6: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
 std::auto_ptr<IndiRpibrd> indiRpibrd(0);
      ^
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/memory:81:0,
                 from /home/paul/build/astroberry-test/rpi_brd.cpp:20:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;
                            ^
[ 50%] Linking CXX executable indi_rpibrd
[ 50%] Built target indi_rpibrd
Scanning dependencies of target indi_rpifocus
[ 75%] Building CXX object CMakeFiles/indi_rpifocus.dir/rpi_focus.o
/home/paul/build/astroberry-test/rpi_focus.cpp:26:6: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
 std::auto_ptr<FocusRpi> focusRpi(0);
      ^
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/memory:81:0,
                 from /home/paul/build/astroberry-test/rpi_focus.cpp:20:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;
                            ^
/home/paul/build/astroberry-test/rpi_focus.cpp: In member function 'virtual bool FocusRpi::initProperties()':
/home/paul/build/astroberry-test/rpi_focus.cpp:171:17: error: 'PortT' was not declared in this scope
     IUFillText(&PortT[0], "PORT", "Port","RPi GPIO");
                 ^
/home/paul/build/astroberry-test/rpi_focus.cpp:172:23: error: 'PortTP' was not declared in this scope
     IUFillTextVector(&PortTP,PortT,1,getDeviceName(),"DEVICE_PORT","Ports",OPTIONS_TAB,IP_RO,0,IPS_OK);
                       ^
/home/paul/build/astroberry-test/rpi_focus.cpp: In member function 'virtual bool FocusRpi::saveConfigItems(FILE*)':
/home/paul/build/astroberry-test/rpi_focus.cpp:411:27: error: 'PortTP' was not declared in this scope
     IUSaveConfigText(fp, &PortTP);
                           ^
make[2]: *** [CMakeFiles/indi_rpifocus.dir/build.make:63: CMakeFiles/indi_rpifocus.dir/rpi_focus.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/indi_rpifocus.dir/all] Error 2
make: *** [Makefile:128: all] Error 2

Do you have any ideas whats wrong now? Maybe indilib has changed something recently or is my compiler to new?
--= human, without Windows™ =--
pls excuse my bad english! :)
7 years 1 month ago #15221

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

  • Posts: 314
  • Thank you received: 34
I maybe solved it by myself by changing a few lines in rpi_focus.cpp:

I commented out two lines here:
...
bool FocusRpi::initProperties()
{
    INDI::Focuser::initProperties();
 
    //IUFillText(&PortT[0], "PORT", "Port","RPi GPIO");
    //IUFillTextVector(&PortTP,PortT,1,getDeviceName(),"DEVICE_PORT","Ports",OPTIONS_TAB,IP_RO,0,IPS_OK);
 
    IUFillNumber(&FocusAbsPosN[0],"FOCUS_ABSOLUTE_POSITION","Ticks","%0.0f",0,MAX_STEPS,(int)MAX_STEPS/100,0);
...

and I changed this:
...
bool FocusRpi::saveConfigItems(FILE *fp)
{
      IUSaveConfigText(fp, &PortTP);
 ...
to this:
...
bool FocusRpi::saveConfigItems(FILE *fp)
{
    //IUSaveConfigText(fp, &PortTP);
    INDI::Focuser::saveConfigItems(fp);
...

and to remove the deprecated warnung of auto_ptr I changed this:
...
std::auto_ptr<FocusRpi> focusRpi(0);
...
to this:
std::unique_ptr<FocusRpi> focusRpi(new FocusRpi());

and finally I have absolutly no clue if this was the right way to do it but my changes seems to work so far with the focuser.
--= human, without Windows™ =--
pls excuse my bad english! :)
The following user(s) said Thank You: Jasem Mutlaq, norikyu
7 years 1 month ago #15224

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

  • Posts: 983
  • Thank you received: 375

Indeed the root cause is the recent change in INDI library, which introduces connection plugin. This change removed PortT variable so all drivers need to be changed to recognize this. Astroberry focuser does not use any port so it's save to remove it from the code as you did. Well done!
I will update the code soon so it should work out of the box.
The following user(s) said Thank You: pauledd
7 years 1 month ago #15254

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

Time to create page: 0.675 seconds