×

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
Kaczorek thank you. Just one more point. Am I right that I have to adjust in the rpi_focus.cpp the values "#define MAX_STEPS 10000, #define STEP_DELAY 4" to my needs?
The motor came today and soldering of the driver is done. I will do motor test tomorrow. :)
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 8 months ago #4660

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

  • Posts: 983
  • Thank you received: 375
This is correct. You can probably live with this values but tuning is a good idea. Especially STEP_DELAY which is time in milliseconds for each step. Depending on this value a motor goes smoothly or not. You can check times for your motor in its datasheet or find it out by experiment. It is safe to change this value to anything.
MAX_STEPS is specific for your scope and represents number of steps needed to travel from minimum focus position to maximum focus position (from left to right) i.e. if it takes 5 revolutions for your focus to travel from min to max and you use gear 60:13 and your motor takes 200 steps per revolution MAX_STEPS = 5*60:13*200 = 4615. If you don't change this value just remember not to push your focuser further than absolute position 4615. Otherwise it gets noisy :-)
Keep us posted and good luck!
8 years 8 months ago #4661

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

  • Posts: 314
  • Thank you received: 34
Ok. the good new is the motor works :). The motor runs smooth until approx. one ore more full rotation. Then its sounds stuttering and just after that it stops movement as if it has not enough power. My guess is that 3.3V is not enough and I will try the 5V PIN with an resistor (~1.8Ω,0.8W).

@Kaczorek I have some more questions:
  • The "Ticks" in the Indi Main Control is the same as one Full Steps of the stepper? So 200 Ticks should do one 360° turn on the motor?
  • Do you know what the little rotary potentiometer on the DRV8834 does?
  • Do you have/know something like simple sample code to drive the DRV8834 stepper just some steps foreward/backward?
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 8 months ago #4662

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

  • Posts: 983
  • Thank you received: 375
Well done!
  • Yes, the "Ticks" in the Indi Main Control is the same as one Full Steps and 200 ticks equals 360° turn on the motor. This parameter is Absolute Position of the motor.
  • Potentiometer is very useful and you should set the current for your motor with it. Check pololu site , which says "Adjustable current control lets you set the maximum current output with a potentiometer, which lets you use voltages above your stepper motor’s rated voltage to achieve higher step rates".
  • When developing my first prototype I wrote a simple bash script for testing. I attach it to the post. Feel free to use it.

File Attachment:

File Name: motor.sh.zip
File Size:1 KB
The following user(s) said Thank You: pauledd
Last edit: 8 years 8 months ago by Radek Kaczorek. Reason: Attachement missing
8 years 8 months ago #4663
Attachments:

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

  • Posts: 314
  • Thank you received: 34
This was exactly what I was looking for. Thank you very much :)
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 8 months ago #4664

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

  • Posts: 314
  • Thank you received: 34
I tried to set the current regulator as described in the video but I dont know how to power the driver in the way they did without connecting the motor but measuring the vref voltage. When I measure from the "black circle" to ground I get no voltage. Maybe I have to manually set the STEP PIN to 1 while measuring. Nevertheless I measured the current from one coil while doing 1/2 step movement and it did not touch the rating of 0.67(/2) A.

I did some tests with the motor.sh script and I came to the conclusion the stuttering is not an voltage issue but an "delay" issue. With the default value "sleep 0.000005" the motor stutters again but with higher values it runs smooth.
I also tested the latest astroberry image and I have to say it worked out of the box with the focuser (without stuttering and very smooth), but I did not test eqmod and gphoto. I will do that tomorrow or in the next days while still waiting for the mechanics parts to arrive.

Besides all of this I had again issues with eqmod "indi_eqmod_telescope dispatch error:" and gphoto connection with my custom rasparian. But that belongs to its appropriate thread and thats why I will try the pure astroberry way first and then solve my own.
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 8 months ago #4665

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

  • Posts: 8
  • Thank you received: 0
@Kaczorek
Thanks to your source I have managed to adapt the rpi_focuser source so that it will drive the BYJ28 motor + driver. Great stuff! See attached file.

However I'm wondering what the 'speed' and 'timer' values do. They are presented in the UI, but from the source I don't really see what their practical purpose is.
Also, how do you establish Absolute position? Is it merely because at some point you have moved the focuser to minimum and have bee very careful to always move it back to that before switching off?

I'm considering adding a 'steps/mm' parameter so that focus positions and ranges can be in distance instead of steps. In my case there is a mm scale on the focuser, so another thing that might be handy is to have a 'set absolute' button where one can set the position to the actual position of the focuser.
8 years 8 months ago #4681
Attachments:

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

  • Posts: 983
  • Thank you received: 375
@mrpraline, Astroberry Focuser actually works this way.
1. The starting position is 0, which is the most counter clockwise position. Just turn your focuser knob maximum to the left before mounting your focuser on.
2. Focusing outward increases absolute position value and focusing inward increases absolute position value.
3. On the Options tab you can find Parking Mode - while it's ON by clicking Save options button you can save actual position of your focuser. With Parking Mode ON when disconnecting the focuser it will return to 0 position first. After you reconnect it will return to saved position. Switching Parking Mode OFF will disable this feature and the focuser will not remember the position between the sessions. I always keep it ON so absolute position number is correct.
4. Anytime absolute position is out of sync with actual physical position of the focuser you can reset absolute position number by going to 0 and clicking Reset button on Options tab. This will perform short counter clockwise move to reach physical zero position (see p. 1 above). As soon as you focuser knob stops turning left you are sure that it is at 0 and physical focuser position and absolute position value are in sync.
5. You can use presets to define and save predefined focuser positions. Remember to save the options after setting the preset values. This will ensure that values are persistent between sessions.
6. Timer value is time in milliseconds you want the focuser to move (In or Out). It just calculates number of steps per time value and performs them. Set the value to e.g. 1000 ms, choose direction e.g. Inward and you will see that the focuser moves for 1 second to a specified direction. It's relative position feature. I don't use it personally but I know that some people do so I included it in the code.
7. Speed value is ignored and not used anyhow. It is a default feature of INDI focuser coming from the framework. At it's current version Astroberry Focuser works in a single speed mode. You can change default speed in the code. After many tests I don't think dual speed is required at all. The precision you will get with your setup (923 steps per revolution) should be more than enough. If it is not, just change default speed in the code to 1/nth of the full step. I will consider introducing fast and fine buttons for user level speed/precision control in future versions.

So in summary - use Parking Mode, Save options at you favorite position and you will have your focuser ready at the favorite position just after connection. Set your Presets and you can quickly change your focus after adding a barlow lens or a focal reducer.

I hope it explains a lot :)
8 years 8 months ago #4682

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

  • Posts: 8
  • Thank you received: 0
Thanks that answers a lot for me. I'm starting to get to grips with the software now.
So essentially Parking mode is used as a helper to stop the focuser in a well known position and this is how you maintain absolute position.

I have started to modify the code further so that setting and reporting the focus position will be in mm. I think this is easier to use and also allows a uniform mode of operation between different physical configurations of stepper motor, reduction and focuser.
If I get really ambitious I will change the code so one can configure different stepper interfaces at user defined hardware pins. That would allow the driver to be used in a generic way without having to compile from source.

BTW: My BYJ28 motor has has 4096 steps/turn and my focuser has a 1:10 reduction so I had to increase MAX-STEP to 140000.
8 years 8 months ago #4683

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

  • Posts: 314
  • Thank you received: 34
@Kaczorek
In your motor.sh script there is this sleep value of 0.000005. Does this mean 5 microseconds for each step on/off and one complete step is 10 microseconds?
I just now found the value for my stepper that has to be at least 1.9µs for each high/low. So I could set sleep in my case to at least 0.000002?

Meanwhile I think I successfully managed to set the current limit to 0.67A on the driver DRV8834 by:
  • set M0,M1 to 0 (for full step mode)
  • set SLEEP to 1 (for powering the motor without step)
  • measuring the current of one coil (which is 70% of the desired current limit of one coil,)
in my case it would be I=(0.67A/2)*0.7=0,2345A/coil, then I used the potentiometer to set it.
I have to verify that again!

Parts are now complete except some screws, holes are drilled (thanx for the elongated holes tip).
I still fear the angle wont be stiff enough and teeth may skip while rotating. I will maybe cut an 2nd angle an
screw them together.

--= human, without Windows™ =--
pls excuse my bad english! :)
Last edit: 7 years 5 months ago by pauledd.
8 years 8 months ago #4706

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

  • Posts: 983
  • Thank you received: 375
I'm very glad that you got it working!
Sleep value is exactly what you think :) You can safely set 0.000002 in the script. As the result locical 1 will be set for 2µs and locical 0 for another 2µs. The full step cycle will take 2x2µs = 4µs. This values are specific for your stepper motor. As stated before you can check the model values in your motor datasheet. It is also safe to experiment with the value, providing you don't leave the motor running with wrong values for long time since it gets warm and in worse case scenario does not move a step.
In my project I'm using secong angle sliding on the base plate. This way I can precisely tune distances and keep the construction very solid.

BTW. in your previous post you suggested to use mm scale in the focuser. I will leave it to your customization since using it in the astroberry focuser code will make it very motor/gears/focuser specific. I'm afraid it might loose precision when recalculating absolute position to mm values. If you come across a good solution we can work it out togeter to include it in astroberry code in future versions.
8 years 8 months ago #4707

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

  • Posts: 314
  • Thank you received: 34
I guess the "mm"-thing post you are refering to was from mrpraline: indilib.org/forum/general/766-stepper-fo...y.html?start=24#4681
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 8 months ago #4708

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

Time to create page: 0.521 seconds