PublicSensors

4.1 Distance Sensor Intro

Overview:

Sound navigation and ranging, commonly referred to as sonar, uses sound waves to sense the location of objects. Many animals, such as bats and dolphins, use sonar (or “echolocation”) to navigate and find food. Through technology, we can use the same technique of producing sounds and listening for echoes to make measurements. This is particularly useful over long distances or in environments such as the ocean where it is difficult to see.

Materials Needed:

Materials needed for Basic Distance Sensor Construction and Application Activities:

In addition to the materials listed above, you will need to edit the active_sensors.py file on you microcontroller to activate the distance sensor. See the instructions on our Code Resources page for how to change the active sensor.

Introduction to Distance Sensors:

Distance sensors, also called ‘echosounders’, detect how far away an object is by sending out a signal and listening for the echo from that object.

Based on the amount of time it takes for the sound wave to travel from the sensor to an object and back, we can estimate how far the object is as long as we know how fast the sound is traveling.

Distance = Speed of Sound × Time

In this activity, you will use an acoustic distance sensor (HCSR04) to measure distance. For a further challenge, try the Advanced section to calculate the speed of sound in air for yourself.