Stepper Motor Home Position

Hello,

I'm currently working on a large school project (my thesis) and I'm in need of a little help. I'm using an arduino mega 2560 to control four haydon kerk linear actuator stepper motors with quadrature encoders on each. They are driven by sparkfun's quadstepper driver. I'd like to use LabView as the software user interface but for the moment i'll stick with Open Source.

That being said, I need to set a home position for the motors. What options do I have to achieve this (both hardware and software related)? I've read different things about using sensors and such... but I'd like to hear your guys' opinions (i'd also like to avoid adding sensors because of size constraints).

This is what I'm thinking: Could I fully retract the linear actuators to the lower limit (actuator arm extension = 0mm) and set this as my home position using open source without hammering the actuator against the lower limit? In other words, how can I detect when the motor is at this lower limit and have Open Source tell it to stop attempting to step (I say attempting because it will be fully retracted at this point and just hammering against the lower limit). I can push the actuating arms back to the fully retracted state with my figures but doing this through the software would be much more professional. If I am able to do this, I can then send code to extend the arms to my actual home postion (15mm arm extension out), tell it to hold, and then eventually start the back and forth stepping I need them to do from there.

One last thing, can someone please tell me how the encoders would help in this situation? I know they wil give me positional feedback in terms of steps traveled... but I can already tell the motors how many steps I want them to step via code.. are they just for feedback to check if the motors are actually stepping what I want them to?

Thank you for your help!

Heres an outline of what I'd like the motors to do:

-Start from random position extension (rate does not matter)
-Fully retract actuator arms (0mm extension) without hammering against lower limit (rate does nto matter) - initial home position X=0mm
-Extend to actual home position (15mm) and hold (rate does not matter) - hold for a designated time frame while load is applied
-Retract and extend # of steps equal to 3mm (rate depended) (sinusoidal motion) - do this for designated time frame
-Stop and hold at actual home positon (15mm extension from initial home position) to remove load after the time specified above
-Return home to initial home position (X=0mm) without hammering against lower limit (rate does nto matter)

How you accomplish homing is going to depend on the type of encoders you have. If they are three channel encoders (2 quadrature signals and 1 index) you can home on the index. If they are two channel you will have to use a switch to home to. This could be an optical sensor, a hall sensor or a simple switch.
( My cnc machine uses a simple, cheap microswitch and can home with +/- 0.001" repeatability). It's common to have an upper and lower limit switch to avoid over-runs and use one of them also as a homing switch. The actual home position can be offset from the limit. For precise homing a multi-step process of backing off the switch and approaching it at a lower speed a second time is used.
With steppers, an encoder can't be used for closed loop operation (not quite true, apparently there are some very advanced motor controls that can accomplish this using DSP, phase vector modulation, and a bunch of other stuff that mere mortals like me will never understand :~) so they are usually used to verify if the actual move equals the commanded move. If they are not equal the software makes a correcting move.

Hi Yankee, thanks for the reply.

Yes the encoders have an indexing wire. Do you have any sample code I could look at? Or where I could look to find some?

Thanks!

Sorry, I can't point you to any code. My knowledge of homing sequences comes from my experience with LinuxCNC. The concept is simple though, and is well explained here: http://linuxcnc.org/docs/html/config_ini_homing.html. If you're good at reading code the LinuxCNC source code is available and perhaps that would give you more insight. You could find how to get that here: http://linuxcnc.org/.
Being a relative newbie at coding thats the best I can do. Hope it helps.