Stepper motor with limit switch

Hello, I have Aurdino Uno board with stepper motor and driver. I want to run the stepper motor like following way. can you guide me how to make program?


  1. Start button then motor will going to HOME position. once its reach limitswitch then its stop.
  2. start second button then motor will start rotating on forward after when it reach second limit switch then it will start rotate on revers potion.

Above step in the loop and work continues like this.

Is the limit switch normally open or closed? How is the switch connected to Arduino? Which stepper motor and driver?

can you guide me how to make program

It will be easier to help if you start by making an attempt to do it yourself. If you run into a problem please post the program and tell us in detail what it actually does and what you want it to do that is different. It will make it much easier to focus on the parts you need help with rather than wasting time on things that you can do.

Generally homing a stepper motor is done by moving step by step towards the limit switch checking the state of the switch between each step.

Stepper Motor Basics
Simple Stepper Code

Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

Have you written any code for Arduino?
Have you tried some code to make the stepper turn?

Can you post pictures or links to what your stepper and driver are please?

Thanks.. Tom... :slight_smile: