The Ultrasonic Sensor is the other sensor that gives
your robot vision. The Ultrasonic Sensor enables the
robot to see and detect objects. You can also use it
to make your robot avoid obstacles, sense and meas-
ure distance, and detect movement.
The Ultrasonic Sensor measures distance in
centimeters and in inches on the NXT. It is able to
measure distances from 0 to 255 centimeters with a
precision of +/-3 cm.
The Ultrasonic Sensor uses the same scientic principle as bats: it measures
distance by calculating the time it takes for a sound wave to hit an object and return
– just like an echo.
Large-sized objects with hard surfaces return the best readings. Objects made of
soft fabric or that are curved (like a ball) or are very thin or small can be difcult for
the sensor to detect.
Note that two or more Ultrasonic Sensors operating in the same room may interfere
with each other’s readings.
You can use the Ultrasonic Sensor in
many different ways. Program a robot
to sneak around the house without
it bumping into things. Or make an
advanced burglar alarm robot that reacts
to movement as well as light or color
settings.
Select the Ultrasonic Sensor icon
and the port where you’ve con-
nected the sensor.
Measure the distance to an object. For example, move your hand closer to
the sensor and watch the readings change.
Test the Ultrasonic Sensor’s ability to measure distance:
Connect the Ultrasonic Sensor to the NXT.
Select the View submenu in the NXT display.
Select the Try Me submenu on the NXT’s display and test your
Ultrasonic Sensor. You’ll get a fun reaction.