If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Warm up: ultrasonic vision

Ultrasonic Sensor

Most of us don't have nightvision scopes at home. Luckily we can build a simple robot which can help us see in the dark. To make things simple let's say we only need to avoid hitting walls.
To do this we will need to use our ultrasonic sensor. This sensor generates high frequency sound waves and measures the echo which is received back by the sensor. The length of this echo is used to determine the distance to an object:
Ultrasonic sensor
Finally let's review another fundamental concept we will need: switch blocks. If we want to modify the behavior of our robot based on some condition (such as a light turning on, button press or object dection) we use the switch block. Which looks like this:
Switch statement based on light sensor
The following video introduces the switch block and shows how we can control a switch block using the ulstrasonic sensor.
Khan Academy video wrapper

A robot's point of view

Before you move on and begin building amazing robots it's important to practice thinking like a robot. This is a nice challenge to get started with: close your eyes and use the ultrasonic sensor as your vision. Try the following:
  • Idea 1: Try to find the door and exit a room without touching a wall
  • Idea 2: Tape a large box to the wall and try and locate it without touching wall or box
  • Idea 3 (groups): Can a group of people exit a room without coming into contact?
What did you learn?

Want to join the conversation?