Calculating the time it takes to reach target position

Supporting Browser-based Javascript and Node.js
Gron
Phidgetsian
Posts: 8
Joined: Fri Jul 24, 2020 5:57 pm
Contact:

Calculating the time it takes to reach target position

Postby Gron » Fri Jul 24, 2020 6:08 pm

Hello!

I have a 2.5a stepper motor attached to a NEMA 23. I have set the rescale factor so that when in step mode 1 rotation takes 16 steps. This is working as expected. What I'm trying to figure out is how do I calculate how much time it will take for the motor to go from its current position to the target position. for example, the motor is at 5 and I want to send it to 15 ( the last position in a rotation ) what do I need to do to find out how long that will take in the real world?

I know the acceleration and velocity play a role, but is there a formula or method to know the time in seconds it will take?

Another side question is what is the best way to tell when the motor has passed a specific point in its rotation, I have tried mag sensors and light sensors but both seem to have none negligible delay.

I would appreciate any help I can get! At the very least thank you for reading this post :D

jdecoux
Labview Developer
Posts: 124
Joined: Mon Nov 13, 2017 10:20 am
Contact:

Re: Calculating the time it takes to reach target position

Postby jdecoux » Mon Jul 27, 2020 2:02 pm

The stepper controller will use constant acceleration until either the velocity limit is reached, or it needs to decelerate in order to stop in the right location. If the velocity limit is reached, it will hold that velocity until the controller needs to decelerate to the target. Both acceleration and deceleration happen at the same rate.

I don't have time to go through the specific math here, but that should give you a start.

As for detecting the motor's position, what is your application that needs high-speed detection? Do you need an immediate response, or a repeatable gauge of position? If you use the right kind of rotary encoder, it can give you the position of the rotating shaft relative to an index position on the encoder. This will still have some small software delays, but the position will be accurate.

http://www.phidgets.com/products.php?product_id=3532_1
http://www.phidgets.com/products.php?product_id=ENC1000

Gron
Phidgetsian
Posts: 8
Joined: Fri Jul 24, 2020 5:57 pm
Contact:

Re: Calculating the time it takes to reach target position

Postby Gron » Mon Jul 27, 2020 7:07 pm

Hey, thanks for the reply!

I'm trying to spin a wheel and have control of where it lands.

With my current set up it seems that slight changes in the velocity can affect where my position is. I have an ENC1000 and a 40 CPR could I use these to help me obtain that or should I be able to do it with just the stepper motor controller?


Return to “Javascript”

Who is online

Users browsing this forum: No registered users and 1 guest