Homing of a stepper motor

I am working on a robotic arm that uses NEMA 17 stepper motors. The problem is that when power is cut off and then turned on again, stepper motors start from the position they were at power cut off time. I want them to move to a specified starting location on power up so that when power is turned on again, they move to that location first and then do something else. I also looked for some possible solutions like Limit Switches and Rotary Encoders but is it possible to use non-volatile memory for this purpose? If so then how?

1 Like

You need some sort of switch.

Saving the position into EEPROM memory can be done if the Arduino is always shut down in an organized way. But the EEPROM memory cannot be written to often enough to record every move in case of an unexpected power failure.

In any case, even if the position was saved there can be no certainty that the machine did not move while the power was off.


Are you using a sensor to determine where the arm is each time it turns on? Can have the steppers set to do nothing until the arm's position is determined.

Then a switch could be used to initiate a return to home function.

It might be dangerous/damaging to have the arm suddenly move to position each power on especially after unexpected power failure, depending on what the arm was doing.

I am in a similar situation. I do not want to keep the stepper powered all the time. Moving the stepper is an intermittent event in my application. When being moved, there might be severaldifferent positions the stepper has to move to. Then it will be 'quiet' for an undefined interval. Apparently, even when a stepper is turned off and on again, it might even start at a different location than it was turned off at because of mechanical vibration or some other force. So I think I need to add an encoder into the equation. But since I am thinking of using an encoder, I might as well just use a dc motor.

I guess another approach to using a stepper or DC motor that needs to be de-powered is to apply an external brake that holds the motor in position. The brake could probably be implemented with a small servo which would draw very little current when not actually moving and which could itself be de-powered without the brake releasing with a suitable mechanical design.

Whether the extra complexity is justified by the energy saving is a separate matter.


Homing on startup is a sure fire way to get a zero reference point. What do you think an ink jet printer does on start up? It's not a big deal to do it so why not? -Scotty

Homing on startup is a sure fire way to get a zero reference point. What do you think an ink jet printer does on start up? It's not a big deal to do it so why not? -Scotty

But a robot is different from an ink jet printer. You might want a robot to carry on from where it left off. Suppose it had a glass of whiskey in its claw - do you want to waste it by spillage just to get to the home position?


There's not much else to do. Each robot joint needs an encoder that can tell the exact position of the joint. Or replace each stepper motor with a stepper motor model, which includes an absolute encoder:

That motor is >$280! for the smallest one.

That motor is >$280! for the smallest one.

Yes, that's a budget range. This is a serious engineering product (motor, encoder and driver in one).

(The link I found is: αSTEP Closed Loop Stepper Motors