4.1 Distance Sensor Intro
On this page:
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.