Endstops for stepper motor

Hello all. First post here and new to the arduino. So excuse me if I don't use correct terminology, etc.

I'm in the planing stage of a project where I need a stepper motor (with a controllerboard) to rotate a shaft. The motor will be attached to the end of the shaft. And that shaft can only turn from approximately 8 o'clock to 4 o'clock.

Now, the scenario is like this. At a specific time, the arduino will have the motor rotate from 8 to 4, or vice versa depending on which side it's starting from. And then shut off. At the next specified time it rotates the other way and shuts off.

What would be the best method for the system to know where the motor is positioned and which way to rotate? And it would be beneficial to be able to stop the motor just before the shaft hits it's physical stop to avoid over-torquing it.

I'm thinking two contact switches with a single arm that rotates with the motor. When it makes contact with one side it stops. And when it's time to start up again the arduino could read which is closed and go the other way.

Thoughts? Suggestions on a better method? I'll take any and all advice you can give me.

Thanks!
Dave

xyproblem perhaps:

Why use a stepper motor? You wouldn't "shut off" a stepper, it would lose position.
Do you need hold position and have a small range of movement, suggests either a servo
or a small DC motor+worm-gear+limit switches.

What is the scale of this anyway - how much torque is needed? How rapidly does the
shaft need to turn? How much angular accuracy is needed?

MarkT:
xyproblem perhaps:

Why use a stepper motor? You wouldn't "shut off" a stepper, it would lose position.
Do you need hold position and have a small range of movement, suggests either a servo
or a small DC motor+worm-gear+limit switches.

What is the scale of this anyway - how much torque is needed? How rapidly does the
shaft need to turn? How much angular accuracy is needed?

MarkT:
xyproblem perhaps:

Why use a stepper motor? You wouldn't "shut off" a stepper, it would lose position.
Do you need hold position and have a small range of movement, suggests either a servo
or a small DC motor+worm-gear+limit switches.

What is the scale of this anyway - how much torque is needed? How rapidly does the
shaft need to turn? How much angular accuracy is needed?

Why use a stepper? It's what is available at the time without additional purchases.

Scale? Rather small. Talking shaft sizes of 6mm.

Speed .... Very slow. It will take 30 minutes to go from one stop to the other.

Accuracy... Not all that important. As long as it stops/starts from close to physical stops. And rotates smoothly and at a steady pace.

Torque .. A little is necessary and the motors available are geared up a bit.

There will also be long wait periods between start up times. Thus, the reason for the idea of turning off the power to the motor. Seems like a waste of energy to leave it on and holding for several hours at a time.

DangerToMyself:
Why use a stepper? It's what is available at the time without additional purchases.

That isn't an actual reason to use a stepper, its a statement that you thought it fulfilled your (unspecified) requirements.

Scale? Rather small. Talking shaft sizes of 6mm.

Speed .... Very slow. It will take 30 minutes to go from one stop to the other.

Ah, so this is the real reason for wanting a stepper, namely needing motion control (ie position
control)

Accuracy... Not all that important. As long as it stops/starts from close to physical stops. And rotates smoothly and at a steady pace.

"Not all that important" - meaningless to me, "close to" - meaningless to me

Torque .. A little is necessary and the motors available are geared up a bit.

"A little", "a bit" - again meaningless to me. Motors are usually geared down, not up, do you mean
up?

Try answering with actual numbers and measurements for the torque and accuracy - you didn't
define "smoothly" or "steady", so its impossible to know what you actually require. One thing steppers
don't do is steady, they move in steps, so the question is "how steady" - numbers again are required
to know what you mean.

If you don't know how to get the actual numbers you'll have to explain the mechanical setup
in full, masses, lengths, mechanism etc, so its possible to calculate the torque and understand your
smoothness/accuracy requirements.

Not sure how "numbers" are relevant to the original question. I'm not looking for someone to do a turn key design. I'm looking for the best (or at least good) METHOD to start/stop/keep motor from turning too far using a stepper motor, controller and arduino under the scenario I gave.

And my use of "steady" wasn't good. I'm aware of steps with stepper motors. I should have implied/said "consistent".

I thank you for the time you have taken. But if my post is all meaningless, by all means, have a mod/admin delete it.

It does not damage a stepping motor if the shaft rotation is blocked while it is powered.

Simply put a perpendicular pin through the shaft, and add some external means to block the shaft rotation at 8 o'clock and 4 o'clock.

Send more than enough steps to accomplish the total rotation in the desired direction, and you are done.

jremington:
It does not damage a stepping motor if the shaft rotation is blocked while it is powered.

Simply put a perpendicular pin through the shaft, and add some external means to block the shaft rotation at 8 o'clock and 4 o'clock.

Send more than enough steps to accomplish the total rotation in the desired direction, and you are done.

Thank you! I was unaware that steppers wouldn't be damaged that way. So, never gave that method the first thought. Very much appreciated. I will put some thought into it.

Running into an end stop is a very commonly used method of "homing" stepping motors.

DangerToMyself:
What would be the best method for the system to know where the motor is positioned and which way to rotate?

One thing that has not been mentioned is how to answer this question if the machine stops when the motor is not at either end-stop.

if it stopped in the middle would it matter which direction was chosen first?

If you have a micro-switch at each end the system will know that the motor has turned the shaft all the way clockwise or counterclockwise, or neither. If you just rely on crashing physical end stops you won't have that data.

It is perfectly possible to send step pulses to a motor that cannot move but most stepper motor controllers reduce the coil current when step pulses are not being received which makes life easier for both motor and driver.

...R
Stepper Motor Basics
Simple Stepper Code

Robin2:
if it stopped in the middle would it matter which direction was chosen first?

If you have a micro-switch at each end the system will know that the motor has turned the shaft all the way clockwise or counterclockwise, or neither. If you just rely on crashing physical end stops you won't have that data.

It will indeed matter. So, I think switches will be a must. If only to tell the arduino if it's finished the cycle or still needs to keep going whichever direction.

And thanks for those links. I'm sure I'll learn some things from the info there.

DangerToMyself:
It will indeed matter.

That may make the system more complex than what I have suggested so far.

Imagine that you have end-stops at A and B and they are working properly. Now imagine that the power fails while the motor is halfway through a move towards B so that neither end-stop is pressed.

What should happen when the power is restored? The Arduino will have no means to tell where the stepper is or whether it should move towards A or B.

The normal arrangement with stepper motors is to drive them to the HOME or ZERO position at every startup so that the Arduino can know where the motor is from that point onwards. But, if you really require the motor to continue to the destination it had failed to reach that sort of "go to home" system would be no use.

I guess one option would be to record the position (either A or B) to the EEPROM memory every time the end-stop is reached. And then at startup if neither end-stop is pressed the Arduino can read the EEPROM memory to figure out which direction the motor should be going. Because the end-stops are only pressed once every 30 minutes the EEPROM memory won't wear out

...R

Robin2:
What should happen when the power is restored? The Arduino will have no means to tell where the stepper is or whether it should move towards A or B.

I've been brainstorming on this issue. The intent has been to have an RTC included so that start times could be programmed at specific times. Thinking I could code it to calculate which rotation direction (if either) it was in when interrupted based on the start times. If it was at a state of rest when the interruption occurred, it would still have one of the 2 switches closed. Then I would have to make it check to see if it should have started the other direction or not.

It doesn't have to be at a certain point in its rotation at a certain time. Just has to rotate consistently. And being stopped in the middle of a turn due to an outage, or the like, won't matter either.

Would probably also code it to turn all the way to left side every morning prior to actual use.

Robin2:
I guess one option would be to record the position (either A or B) to the EEPROM memory every time the end-stop is reached. And then at startup if neither end-stop is pressed the Arduino can read the EEPROM memory to figure out which direction the motor should be going. Because the end-stops are only pressed once every 30 minutes the EEPROM memory won't wear out

...R

I read a bit about this. What's the limit for EEPROM? Something like 30,000 edits? So, if it did 10 stops a day, it would be ok for something like 10 years (not breaking out the calculator) :stuck_out_tongue: That could be a viable option. I will read up some more about this.

Write/Erase Cycles: 10,000 Flash/100,000 EEPROM

CrossRoads:
Write/Erase Cycles: 10,000 Flash/100,000 EEPROM

Thank you! Way more than I pulled out of the back of my brain. Knew it was a bunch though.

And that's only the guarantee. The actual performance of an individual device will be many times this. I seem to remember results posted on here that got thousands of times more writes before there was a glitch.