Hi everyone,
I'm completely new to arduino and this is my first project.
I'm building a star tracker using an arduino uno, a 28byj-48 stepper motor and its driver. In this project i need the timing between steps to be extremely accurate. I have some external gearing but i also need the frequency of the steps to be almost exactly 2.4068 steps/seconds, or in other terms, 4.51275 rpms at 32steps/rev. This is the code I'm using:
I'v seen this code in many tutorials and decided to use it. Doing some experiments i found out that the speed of the motor is set only by the whole number in steppermotor.setSpeed(rpm).
This is not ideal for the kind of precision I'm aiming at. Is there any way to solve this?
That type of stepper motor isn't really well suited to this sort of application. A modern bipolar stepper is more precise (200 steps/rev or more if you use microstepping) and can give higher torque. They need different drivers such as the A4988 or DRV8825. If you were to use a DC motor you would still need an encoder to measure actual position.
There is presumably some gearing between the motor and telescope mount. Choosing the ratio of that might help to get easier numbers.
Once you are using a more precise stepper, then you can use Bresenham's algorithm to generate pulses to drive it. This is an approximate algorithm that ensures that the error between the actual and ideal position never exceeds some small limit. There's lot's about this on the web - Google is your friend. There are other algorithms too.
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project See About the Installation & Troubleshooting category.