What Is a Distance Sensor (ToF / Ultrasonic)?
A distance sensor is a sensor that measures the distance to an object. It has two common methods: ultrasonic (sound) and ToF (light).
Ultrasonic Sensor
It sends a sound pulse and measures the return time of the echo. Since the speed of sound is known, this time is converted to distance (e.g. the HC-SR04). It's cheap and simple.
ToF (Time of Flight)
It applies the same logic with light (laser): it measures the round-trip time of the light. It's faster, more precise and clearer at short range.
Comparison
| Property | Ultrasonic | ToF |
|---|---|---|
| Medium | Sound | Light |
| Precision | Medium | High |
| Surface effect | Soft surface is weak | Transparent/shiny surface is hard |
Where Is It Used?
Robot obstacle avoidance, parking sensors, water-level measurement and contactless distance measurement.
Beam Angle
Ultrasonic sensors radiate in a narrow cone; this beam angle determines what width of objects it detects. A wide angle scans more area but can't distinguish small objects; a narrow angle gives a more precise direction but sees a narrow region.
Common Mistakes
- Not accounting for surface/angle: slanted or soft surfaces weaken the echo.
- Using it out of range: every sensor has a min/max measurement range.
- Ignoring temperature: the speed of sound changes with temperature; precise ultrasonic measurement needs correction.
Frequently Asked Questions
How does the HC-SR04 work?+
ToF or ultrasonic?+
Search parts related to "What Is a Distance Sensor (ToF / Ultrasonic)?"
Find the right part by comparing price, stock and distributors.