Pages: [1]   Go Down
Author Topic: Stepper project  (Read 893 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Thanks!
Gary
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34724
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 3
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34724
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: