Limit Switches: Theory and application
Go to Home Page
Many mechanical devices have a limit, beyond which they
can not move without damage. An example of this is the steering wheel
of your car. You can turn the wheel to a certain point, and then
it stops. If you force it beyond this point, something will break.
This problem is usually handled by one of three possible methods:
-
The mechanism can be constructed stronger than the force
applied. Electric windows on a car usually work this way. When
the window reaches the top or bottom, the motor stalls. Power is
still applied, but the motor is not strong enough to break anything.
-
The mechanism can be constructed to disengage when it reaches
the end. On an old gas powered lawn mover, or toy gyroscope,
the starter rope will disengage when you reach the end of the rope.
-
Some form of sensor can detect when the mechanism reaches
it's limit, and turn off the power. This is usually done with an
electrical switch. In this application, the switch is known as a
limit switch.
All three methods above can be used with Lego mechanisms.
The Lego motors can be stalled if your mechanism is strong. The micro-motor
has a built-in slip clutch. Rack-and-pinion drives can be designed
so the pinion is ejected (disengaged) from the rack when it reaches the
end.
The most common solution with Mindstorms is to use a
sensor that turns off the electrical power. A sensor watcher can
be set to turn off a motor when a switch sensor is pressed. Unfortunately,
this method requires a sensor input, that may not be available.
It is possible to build a limit
switch that does not use a sensor input !
When you understand how limit switches work, you can build
your own limit switch.
If you prefer, Techno-stuff makes an adapter that lets you use
Lego switches as limit switches.
Theory of operation
The simplest limit switch is just a switch in series with a motor, as shown
in drawing A. The switch has "normally closed" contacts, meaning
the switch is "on" when the button is NOT pressed. When the switch
button is pressed, the switch turns off. The switch is positioned so that
when the mechanism reaches it's end of travel, it pushes the switch to
the "off" position. The problem is that when the switch is off, the
motor can not be reversed. The mechanism must be reset by hand.
DC motors like the lego motors can be reversed by reversing the direction
of current flow. With the circuit in drawing A, revesing the power
does nothing because the switch is open. This problem can be fixed
by adding a diode. A diode is an electronic component that
allows current to flow in one direction, but not the other. The symbol
for a diode is an arrow with a perpendicular line across the tip.
Current flows in the direction of the arrow. Drawing B shows
a diode in parallel with the switch. When the switch is closed, the
diode has no effect. When the switch is open, the motor can run in
one direction but not the other. Choose the direction of the diode
such that the motor can be reversed when it has stopped at it's limit.
Sometimes you may want to stop a mechanism at both ends of travel.
To do this, add a second switch and diode, as shown in drawing C.
Place a switch at each end of the mechanism, with diode direction chosen
so the motor may be reversed when it is stopped by the switch.
Timed operation
The position of a mechanism can be set fairly well by simply running the
motor for a set amount of time. If a mechanism is cycled back and
forth many times, small errors from each cycle will acumulate to create
an error that grows large. Error can be prevented from acumulating
by using a limit switch to reset the error on each cycle. Instead
of moving the mechanism back for a set amount of time, apply reverse power
for a longer time, and let it be stopped by a limit switch. This
way it will always return to the same starting position.
Example
The picutre below shows a motorized gate. The sliding gate is white,
with grey toothed plates on top. A limit switch detects when the
gate is fully open, and stops power to the motor. In this example,
there is no limit switch for the gate closed position. The gate is
closed by running the motor for the right amount of time.
If the closing time is set properly, this gate can open and close forever
with no porblems. If the closing time is set too long, the toothed
plate on the gate will go past the drive gear, stopping motion. A
rubber band may be used to pull the gate back to where the drive gear will
re-engage. This forms a purely mechanical limit mechanism.
An alternative is to add a second limit switch, that would stop the motor
when the gate is fully closed.
. . .