# VL53L0X vs VL53L1X vs HC-SR04 for robots

> Compare VL53L0X, VL53L1X and HC-SR04 distance sensors for robots: range, beam, cost and wiring, from datasheets and vendor pages. No bench tests.

Canonical: https://roboticsengineering.in/vl53l0x-vs-hc-sr04-distance-sensor-robot/ | Published: 2026-11-04 | Updated: 2026-11-04 | Author: jaadudigital

**Pick the HC-SR04 when you want cheap, long range and a 5 V Arduino; pick a VL53L0X or VL53L1X when the target is soft, angled or close, you need a narrow beam, or the robot works indoors.** This guide compares the three from their datasheets and shows how to wire several time-of-flight sensors on one I2C bus.

*Status: written from datasheets and manufacturer pages. The code has not been run on a robot here, and no range or accuracy figure below is our own measurement.*

## How each sensor measures

The HC-SR04 sends a burst of 40 kHz sound and times the echo. Its listed range is 2 to 400 cm, the working supply is 5 V at about 15 mA, and the beam is about 15 degrees wide, according to the ElecFreaks datasheet. Sound reflects off most flat surfaces, so it suits walls and boxes, but soft fabric and sharply angled surfaces send the echo away from the sensor.

The VL53L0X and VL53L1X are time-of-flight sensors from STMicroelectronics. They send short pulses of infrared light from a laser emitter and time how long the light takes to return. ST describes the VL53L0X as measuring absolute range up to 2 m with a 940 nm emitter, and the VL53L1X as ranging accurately up to 4 m at up to 50 Hz. Because they use light, they read soft and angled surfaces better than ultrasound, but bright sunlight and some dark or transparent surfaces still affect them.

## Side by side

|  | HC-SR04 | VL53L0X | VL53L1X |
| --- | --- | --- | --- |
| Principle | Ultrasonic echo, 40 kHz | Infrared time of flight | Infrared time of flight |
| Listed range | 2 to 400 cm | Up to 2 m | Up to 4 m |
| Interface | Trigger and echo pins | I2C, up to 400 kHz | I2C |
| Supply | 5 V, about 15 mA | Chip rated 2.6 to 3.5 V; many breakouts accept 5 V | Chip rated for a low-voltage supply; check your breakout |
| Beam | About 15 degrees | About 25 degrees is commonly quoted; boards list 15 to 27 | Typical full field of view about 27 degrees; the region of interest can be narrowed |
| Weak spots | Soft and angled surfaces, cross-talk between sensors | Strong sunlight, dark or transparent targets | Strong sunlight; long mode is less tolerant of ambient light |

The listed ranges are best-case figures from the manufacturers. Real range depends on the target and the light, so test with the material your robot will meet. The beam widths differ between sources, so check the exact breakout board you buy.

## Choosing for your robot

- **Wall following or box detection indoors, tight budget:** the HC-SR04, with the fixes in the [jumping-readings guide](https://roboticsengineering.in/hc-sr04-readings-jumping-fix/).
- **Small robots with soft or angled obstacles:** a VL53L0X, which reads these better than ultrasound.
- **Longer range or a narrower view:** a VL53L1X. ST’s own driver notes describe a short mode that tolerates ambient light better but is limited to about 1.3 m, and a long mode that reaches 4 m but copes less well with bright light.
- **Several sensors in a ring:** ultrasonic sensors can hear each other, so fire them one at a time; time-of-flight sensors need unique I2C addresses, shown below.

## Wiring several time-of-flight sensors

Time-of-flight sensors share a default I2C address, so two on one bus clash. The usual fix is to give each sensor an XSHUT pin connected to a microcontroller pin. Hold every sensor in reset, release them one at a time, and write a new address to each as it wakes. The address then lasts until power is removed, so the sketch repeats this on every start.

```
// Untested outline using an XSHUT pin per sensor.
const int xshut[3] = {4, 5, 6};

void setup() {
  for (int i = 0; i < 3; i++) { pinMode(xshut[i], OUTPUT); digitalWrite(xshut[i], LOW); }
  delay(10);
  for (int i = 0; i < 3; i++) {
    pinMode(xshut[i], INPUT);        // release this sensor from reset
    delay(10);
    // initialise the sensor and set its address to 0x30 + i here,
    // using the method your library provides
  }
}
```

Check how the XSHUT pin on your breakout is pulled and whether it expects a 3.3 V level. A 5 V Arduino driving XSHUT high directly can be unsafe on some boards; releasing the pin to input, as above, lets the on-board pull-up do the work.

## A test plan before you trust any of them

- **Print raw readings** for a flat wall at 10, 30, 60 and 100 cm and note the spread, not just the average.
- **Test your real obstacles:** a cardboard box, a cloth, a glossy sheet and an angled surface.
- **Test in the room light and by a window,** because infrared sensors behave differently in sunlight.
- **Mount the sensor at the height you will use** and check the floor does not appear as an obstacle.
- **Write your own results down.** A table of your measured numbers is worth more to a reader than any datasheet range.

Related: [lidar vs ultrasonic vs IR for robots](https://roboticsengineering.in/lidar-vs-ultrasonic-vs-ir-robots/), [getting reliable HC-SR04 distances](https://roboticsengineering.in/hc-sr04-reliable-distance/) and the [IR sensor with Arduino guide](https://roboticsengineering.in/ir-sensor-with-arduino/).

*Sources: ElecFreaks HC-SR04 datasheet; STMicroelectronics VL53L0X datasheet DS11555 and VL53L1X product page and driver manual UM2510. Last reviewed November 2026. Written, checked and maintained by Jignesh Panchal.*
