Distance Sensors

You want to know how far away something is? This is the sensor to use and is also called the Ultra Sonic Sensor. It can sense objects about 255 mm away. It uses echo location similar to a bat or dolphin. It works well with larger objects and does not work well with very small or thin objects. If you're using these, be sure to use a hard object and not something that is covered in cloth. Two ultrasonic sensors in the same room may interfere with each other.

Objects need to be tall enough to be "seen" when close to the sensor.

Not quite tall enough.
Tall enough.


The example below will rotate the robot with motor A running forward at 20%. The sensor is looking for anything under 40 cm away. Until it senses something, it will keep rotating. Beware that the rotation may stop not pointed directly at what the sensor detected. It could be a little before or after, so you can repeat the process with smaller steps to try to narrow in on a direction.



Back to Sensors Page