Homing and Limits
Whenever a servo system starts up from either power-on or a system
reset, all axes of motion must home themselves so that they know for
sure where they are. Incremental encoders can only tell the
controller that they have moved one "tick" on the encoder wheel,
forward or reverse. It is up to the controller to count the ticks and
add to (forward) or subtract from (reverse) the current position
count. Without knowing where actual mechanical components of the
system are at startup, the computer connected to the controllers
can't know where anything is; it needs a place to start counting
from. (For more on encoders, see servomotors.)
The designer has to add an input device, usually some form of switch,
the system will use to find "home" on each axis. Here, we will call
these "homing switches" as opposed to "limit switches" for the sake
of clarity. They are functionally different in the case of a servo
system, although the term limit switch can be used for both.
In the simplest sense, a limit switch is used to limit the travel
of a mechanism. Limits can be hard or soft. A soft limit sends a
signal to the control system that it's time for the mechanism to stop
or reverse direction. The control system should then receive this
piece of information and act upon it. Should the controller fail, due
to hardware or programming errors, and the mechanism not respond
correctly, something will usually be damaged. If the motion of the
offending axis continues in its malevolent direction, it should reach
a second switch, the hard limit switch. This switch is not connected
through software, rather, it as directly as possible cuts power to
that axis, and perhaps all motor power to the rest of the machine as
well. The hard limit switch should be designed to deal with full
speed impact of the mechanism, and not fail from the blow. Placing
the body of a plastic microswitch directly in the path of a traveling
axis, for instance can result in the switch body being crushed. Use
of levers, rollers, spring fingers, etc., and giving some space for
"overtravel" of the switch before a mechanical stop is reached goes a
long way toward reliability. Above all, if there would be danger of
personal injury or equipment damage from an axis missing a limit
do not depend on software alone to catch the error.
In the specific case of the machine being discussed here, two of
the axes do not require any limit switches. The base motor and camera
rotator are free to rotate and have no mechanical endpoints to their
travel. There is nothing for either of them to collide with. They do,
however, need homing switches. The camera arm does have definite ends
to its travel, so in addition to its homing switch it has two hard
limit switches, one at the top, and one at the bottom. Fortunately,
they have only been used once, and that was during early testing.
For homing, all three axes use magnetic reed switches. They are
small glass tubes with bendable contacts inside them. When the field
of a nearby magnet flows down the length of the switch, the bendable
contacts are attracted to each other and touch, closing the switch.
Optical (photointerruptor), hall effect magnetic, or perhaps some
sort of mechanical switch would have been other options. Reed
switches were chosen because they are easy to mount, and with a
strong magnet, are easy to keep out of the way of the mechanism.
Accuracy was not a problem since during the homing exercise, the
magnet always approaches the switch from the same direction at the
same speed.
Reed switches are glass, so after connecting wires to them, they
were bonded into heat shrink tubing for protection. The switch for
the camera rotator was glued into a section of round brass tubing for
mounting.

The reed switch for homing the base is slipped into a channel in a
piece of 80-20. A wide notch was milled in the 80-20 to clear one of
the mounting bolts for the bottom bearing.
The reed switch for homing the camera arm is also slipped into a
channel in a piece of 80-20. This made it easy to adjust the home
position of the axis. The magnet is a good distance from the switch
when it activates.
A word or two about homing algorithms is in order. When the
machine starts up, it has No Idea where it is. It has to find the
homing switch without running out of travel. When travel is finite as
is the case with the camera arm, the homing switch will, by design,
be placed near one end of the axis's travel, not somewhere in the
middle. The first thing the homing algorithm wants to know is if it's
already sitting on top of the homing switch. If it is, it has no way
of knowing by how much, so its first action will be to move off the
switch plus some small amount of distance for wiggle room. Now no
matter where the axis is in space, it's free to move slowly toward
the switch, ready to stop instantly and zero out its position
counter. This controller is now home. Homing can be rather more
complex than this, depending on the nature of the mechanism but the
basic idea will be the same.
80-20 Aluminum Extrusion ---> Base ---> Brushes ---> Camera ---> Camera Arm ---> Connector Block ---> Electronics ---> Ground ---> Homing and Limits ---> Servomotors ---> Slip
Rings ---> What Comes Around Goes Around
|