79Views1Replies

Author Options:

I'm having trouble with my sketch regarding how to code , my stepper motor traveling to a limit switch then reversing and accelerating to another limit switch. Answered

I'm having trouble coding at a point, I built an Equatorial Platform for my telescope so I can track the stars.I have a Nema 23 stepper( 1.8 * step, 200 steps per rev.) motor with an Arduino and a Easy Driver for my micro controller. My problem when I make my sketch I have the stepper motor running at 92- 104 RPM with a potentiometer to fine adjust, at this point when my platform hits a limit switch then I want to reverse the motor and accelerate it to 2000 RPM then decelerate to 25 RPM before the platform hits an other limit switch, then start the process over.

How do I incorporate accelerating coding that to a certain point then decelerate motor before it hits the other limit switch. Do I need to find some timing coding ( for some length of time), before I want the motor to decelerate to hit the second switch. I don't want the motor running at 2000PM to hit the limit switch, I want it to decelerate before the limit switch. then reverse the motor again to 92 - 104 RPM. I'm a novice at coding with little electrical background. Your assistance is greatly appreciated. Jack Brockhurst e-mail jacam9803@yahoo.com

Discussions

None
rickharris

1 year ago

The faster you pulse a stepper motor the faster it mover (within some restrictions).

ramp up the feed by using a for next loop and a variable to control step time.

Pseudo code:

For V= 100 to 1

step

wait V sec

Step

Next V