Three sensor technologies dominate non-contact distance measurement: time-of-flight using infrared laser light, ultrasonic using sound, and mmWave radar using 24 GHz to 80 GHz radio waves. They are often quoted against each other as though one were simply better, but each fails in a different environment.
Choosing correctly is mostly about identifying which environment your product will actually meet, and which failure mode is unacceptable.
The one-line summary of each
Time-of-flight (ToF) measures the round-trip time of emitted infrared light against a photodiode, or the phase shift of a modulated beam. It is fast, millimetre-accurate and narrow-beam, but it depends on receiving a usable reflection.
Ultrasonic measures the round-trip time of a sound pulse. It works on almost any material including transparent and dark surfaces, but the speed of sound changes with temperature and the beam is wide.
mmWave radar transmits a frequency-modulated radio signal and measures range from the beat frequency. It sees through dust, smoke, fog and plastic, and it can detect a stationary person by their breathing motion rather than only by movement.
Representative parts: TOF050C/200C/400C laser modules for optical ranging, HC-SR04 ultrasonic module for a low-cost acoustic build, and LD2410B 24GHz radar module for presence detection that has to survive dust and dark.
Side-by-side comparison
| Factor | ToF (infrared laser) | Ultrasonic | mmWave radar |
|---|---|---|---|
| Typical range | A few centimetres up to about 4 m for modules; longer with a dedicated laser module | 2 cm to about 4 m for common modules; longer for industrial units | Up to about 8-10 m for presence modules; far longer for automotive radar |
| Accuracy | Millimetre level | Centimetre level, temperature dependent | Centimetre level; good for presence, coarser for precision |
| Beam | Narrow, a few degrees | Wide, typically 30-60 degrees | Wide, configurable by antenna design |
| Target material | Most opaque surfaces; poor on black, glossy or transparent targets | Almost any material, including glass and liquid | Reflects from most materials; very reflective metal and water need care |
| Ambient light | Affected by strong sunlight or IR sources | Unaffected | Unaffected |
| Temperature and humidity | Largely unaffected | Directly affected; sound speed changes with temperature | Unaffected by temperature and humidity |
| Wind, dust, smoke | Dust can block the optical path | Air movement and dust degrade the reading | Penetrates dust, smoke, fog and rain reasonably well |
| Detects stationary targets | Yes | Yes, but needs a returning echo | Yes; can detect breathing-level micro-motion |
| Through plastic or glass cover | Requires an IR-transparent window | Requires an acoustic opening | Works through plastic and many non-metallic covers |
| Interference between units | Optical crosstalk if aimed at each other | Units can hear each other; needs sequencing | Frequency planning needed in dense installations |
| Typical current draw | Low | Low to moderate | Moderate to high, especially continuous radar |
| Integration effort | I2C or UART, driver provided by vendor | Trig and echo, or UART for industrial units | UART, plus configuration of gates and sensitivity |
| Relative cost | Low to moderate | Lowest | Moderate to highest |
Where each technology breaks
Time-of-flight: when there is no usable reflection
A ToF sensor needs light to come back. Very dark, matte surfaces absorb the beam. Polished metal can reflect it away from the receiver. A glass or clear plastic panel in front of the sensor may pass the light straight through instead of returning it. Strong sunlight or another infrared source raises the noise floor until the reading becomes unreliable.
The usual fixes are optical: reduce the field of view, add a bandpass filter matched to the emitter wavelength, or cover the sensor with an IR-transparent window that has a defined transmission at that wavelength and blocks visible light.
Ultrasonic: when temperature or geometry changes
Sound speed rises with temperature, which adds roughly 0.6 m/s per degree Celsius. Without compensation, a 20 °C change moves the reading by several percent across a two-metre span. Temperature compensation is available in better modules and can be implemented in firmware, but it is frequently forgotten.
The beam is wide and the sensor has a minimum blanking distance, so close targets and narrow enclosures are difficult. Soft, porous materials such as foam and fabric absorb the pulse. In installations with several ultrasonic sensors, units must be triggered in sequence to avoid hearing each other.
mmWave radar: when the geometry or the power budget is wrong
Radar excels where dust, moisture, darkness or a sealed enclosure would defeat the other two. Its difficulties are different. Metal surfaces and large water bodies can produce very strong reflections and multipath, creating phantom targets. Large reflective objects can also produce side-lobe detections that appear as objects where none exist.
Configuration matters more than with the other technologies: detection gates, sensitivity thresholds and dwell time all have to be tuned to the application. And radar modules draw more current than the alternatives, which matters in a battery-powered product. Radio regulation also applies: the permitted frequency bands and power levels differ by country.
Choosing by application
| Application | Usually the best fit | Why |
|---|---|---|
| Robot obstacle avoidance | ToF or ultrasonic | Fast update, simple interface; ultrasonic if targets are dark or transparent |
| Liquid level in a tank | Ultrasonic or radar | Non-contact and material-blind; radar if there are vapours or foam |
| Presence detection in a room | mmWave radar | Detects a stationary person by micro-motion, works behind a plastic cover |
| People counting at a doorway | mmWave radar or ToF | Radar for direction sensing; ToF where the path is unobstructed |
| Collision detection on a moving machine | mmWave radar or ToF | Radar survives dust and rain; ToF is faster and more accurate in clean conditions |
| Assembly line part positioning | ToF or laser module | Millimetre accuracy matters and the environment is controlled |
| Level or position through a sealed cover | mmWave radar | Only radar transmits through the cover reliably |
| Gesture or short-range user interaction | ToF | Narrow beam and multiple zones suit close interaction |
| Car or motorcycle blind spot warning | mmWave radar | Long range, weather-independent, already available in automotive grades |
Integration details that decide the result
- Mechanical placement. The sensor's field of view must not be blocked by a bezel or a cable. A 3 mm protrusion in the beam path is enough to create a false close-range target.
- Minimum distance. ToF and ultrasonic sensors both have a near limit below which they cannot measure. Check it against your mechanical design, not just the maximum range.
- Update rate. A radar module configured for stable presence detection may update slowly. If your control loop needs 50 Hz, verify the sensor can deliver it.
- Calibration. Offset and gain drift differ per unit. For precision work, allow a calibration step in production.
- False-positive handling. Every one of these technologies can produce an occasional spurious reading. Decide in firmware how many consecutive readings constitute a real event.
Common selection mistakes
- Choosing ToF for a black target, then discovering the return signal is too weak at the required range.
- Choosing ultrasonic outdoors without temperature compensation or a plan for wind and rain.
- Choosing radar for millimetre accuracy, then trying to tune sensitivity to recover precision the technology was never specified for.
- Ignoring the cover material, which is usually the single biggest cause of a sensor that works on the bench and fails in the enclosure.
- Not checking the radio regulation for the destination market when using mmWave.
How we can help
Tell us the measurement range, the target material, the environment (indoor, outdoor, dust, rain, sunlight) and the required update rate. We will narrow it down to a technology and the specific modules we can supply.
If you already have a sensor part number that is going out of production, send it with the application details. Replacing a distance sensor is not just a range question, and matching the failure behaviour in your environment matters more than matching the datasheet.