Go Down

Topic: Stepper project (Read 909 times) previous topic - next topic


I did a search but didn't really find anything that answered my question so I thought I would post it.

I have a pretty simple project but I'm not sure how to do it exactly.  I need to use steppers to move a platform in x and y axes.  It would start at the bottom left corner and move right (+X axis) until it hits a limit switch then move a certain amount up (+ Y axis) and reverse direction in the X.  It would hit another limit switch at the opposite end, move +Y and reverse X.  This would continue until it hits a limit switch on the Y axis then it would stop.  I see lots of info on moving steppers using arduino and a stepper driver, but I haven't seen anything about using a limit switch.

I think these are all the functions I would need:
1. Set 0,0 - move the platform to the desired location and have the program set this to 0,0
2. Set X travel speed (inches per minute)
3. Set Y increment - steps or decimal inches

Any help would be greatly appreciated!  If someone knows how to do this and wants to actually do the work, I'm open to paying to have it done.



It is a pretty trivial program to do. You just outlined most of it.
A limit switch is just like a push button. You read it with a digitalRead() function.
So the X scan would be a simple loop, step the motor, read the switch if switch not tripped then repeat.
When it is tripped you go to the outer loop, read the Y, if not tripped step the Y, change the X direction and go back to the first loop.
The whole thing is about 10 lines tops.


I agree with Grumpy, except I would probably do it with an ISR. Attach all your limit switches to digital IO lines that are all on the same processor port. An interrupt will be triggered when any line on the entire port changes. Your ISR then goes and checks to see which switch triggered the interrupt.

But either way, it will work and like Mike said, its pretty easy to do.


Thing about an ISR is that it still has to interact with the main loop. I don't see you gaining anything here. It is as simple to do a digital read as it is to check anything that an IRS sets.

Go Up