In short

The HC-SR04 reaches farther, 2 cm to 400 cm by timing 40 kHz sound, on 5 V with two GPIO pins (ElecFreaks HC-SR04 datasheet, p. 1). The VL53L0X times 940 nm laser pulses and reports millimetres over I2C, up to 2 m in its long-range profile and 1.2 m by default, in a part small enough for a micro robot (ST VL53L0X datasheet DocID029104 Rev 2, pp. 1, 28). Choose the HC-SR04 for room-scale distances on flat hard targets, the VL53L0X for compact, fast, close-range sensing where an I2C bus is already there.

Side by side

HC-SR04VL53L0X
PrincipleElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, p. 1Ultrasonic, 40 kHz echo timingLaser time of flight, 940 nm VCSEL, Class 1
RangeElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, pp. 26, 282 cm to 400 cmUp to 1.2 m default profile, up to 2 m long-range profile indoors on white
BeamElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, p. 115° measuring angle25° field of view
InterfaceElecFreaks HC-SR04 datasheet, pp. 1, 2; ST VL53L0X datasheet DocID029104 Rev 2, pp. 1, 18Trig and Echo pulse timing on two GPIOsI2C up to 400 kHz, address 0x29 (7-bit)
Measurement timeElecFreaks HC-SR04 datasheet, p. 2; ST VL53L0X datasheet DocID029104 Rev 2, pp. 15, 2860 ms or more between readings33 ms typical timing budget, 20 ms high-speed, 8 ms minimum period
SupplyElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, p. 65 V DCChip 2.6 V to 3.5 V; regulated breakouts take 3.3 V or 5 V
CurrentElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, p. 2315 mA19 mA average while ranging
Target needsElecFreaks HC-SR04 datasheet, p. 3; ST VL53L0X datasheet DocID029104 Rev 2, p. 26At least 0.5 m², as smooth as possible, facing the sensorAny reflectance; darker targets shorten range (80 cm typical on 17 % grey)
Several on one boardElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, p. 18; Adafruit VL53L0X guideTwo GPIOs per sensorAll start at 0x29; use XSHUT to give each a new address at power-up

Which one to pick

Pick the HC-SR04 when
  • Distances past 2 m, up to 400 cm (ElecFreaks HC-SR04 datasheet, p. 1): room mapping, tank levels, parking aids.
  • 5 V Arduino projects with spare GPIOs and no I2C bus in use.
  • Bright or sunlit spaces, where infrared light cuts the VL53L0X's range (ST VL53L0X datasheet, p. 26).
Pick the VL53L0X when
  • Small robots, gesture and object detection under 1.2 m, with millimetre output and a 33 ms typical reading (ST VL53L0X datasheet, pp. 15, 28).
  • Soft, small or angled targets that scatter sound: it times light, not echoes from a large flat surface.
  • 3.3 V boards and crowded builds: two I2C wires shared with other sensors, no level shifting on the ESP32 or Pico.

Swapping one for the other

What changes in the wiring and the code.

  • Wiring changes from Trig and Echo to SDA and SCL: the VL53L0X breakout goes on the I2C bus at 0x29 (ST datasheet, p. 18), the HC-SR04 on two digital pins.
  • Change the library: VL53L0X (Pololu) or Adafruit_VL53L0X returns millimetres; the HC-SR04's pulseIn() and divide-by-58 code goes away (ElecFreaks datasheet, p. 2).
  • Drop the Echo divider on 3.3 V boards: the VL53L0X's lines stay at the bus level, while the HC-SR04's 5 V Echo needs a 1 kΩ / 2 kΩ divider.
  • Check the supply: a bare VL53L0X chip takes 2.6 V to 3.5 V (ST p. 6); only a breakout with a regulator accepts 5 V on VCC. The HC-SR04 needs 5 V (ElecFreaks p. 1).
  • Expect less reach: plan for 1.2 m in the default profile, 2 m only in long-range mode indoors (ST p. 28).

HC-SR04 or VL53L0X: questions

Which is more accurate?

It depends on the target. The HC-SR04 is rated down to 3 mm on large, smooth surfaces facing it (ElecFreaks datasheet, pp. 1, 3). The VL53L0X's high-accuracy profile is within ±3 % up to 1.2 m with a 200 ms budget (ST VL53L0X datasheet, p. 28), and it keeps reading on targets that scatter sound.

Which has the longer range?

The HC-SR04, 400 cm (ElecFreaks datasheet, p. 1). The VL53L0X reaches 2 m only in its long-range profile, indoors, on a white target; 80 cm on 17 % grey and 50 to 80 cm outdoors on an overcast day (ST datasheet, p. 26).

Does the VL53L0X work on a 5 V Arduino?

Yes on a regulated breakout such as the GY-VL53L0XV2: VCC takes 3.3 V or 5 V and SDA and SCL connect directly. The bare chip is a 2.6 V to 3.5 V part (ST datasheet, p. 6).

Can I use several of either on one board?

Yes. Each HC-SR04 takes two GPIOs; space their readings so echoes do not overlap (60 ms cycle, ElecFreaks p. 2). Every VL53L0X starts at 0x29, so hold each XSHUT low and assign new addresses one at a time at every power-up.

Is the VL53L0X laser safe?

Yes, it is a Class 1 laser product under IEC 60825-1:2014 (ST VL53L0X datasheet, p. 1).

The two references

Checked on 2026-10-29 against 2 sources, the makers’ datasheets first.

For AI assistants

This comparison as plain Markdown. /compare/hc-sr04-vs-vl53l0x-tof.md

What will you build with it?