A safety device for a machine has a first machine part for carrying out a
working movement towards a second machine part. It also has at least a
first and a second optical barrier moving along with the first machine
part during the working movement. The first optical barrier runs ahead of
the first machine part by a first distance, and the second optical
barrier is arranged at a second distance from the first optical barrier.
A control unit is designed to stop the working movement of the first
machine part when the first optical barrier is interrupted. A test unit
allows to test whether the second optical barrier has been interrupted
once the first machine part has been stopped. A blocking unit serves for
blocking the working movement as a function of the test result from the
test unit. Using this safety device it is possible to determine an
overtravel of the first machine part in a simple and reliable manner.
Furthermore, an optical sensor barrier can be used to detect the position
for a switchover between a rapid motion and a creep motion of the machine
without requiring additional position sensors.