> Source: https://www.tinkered.ai/compare/hc-sr04-vs-vl53l0x-tof (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/compare/hc-sr04-vs-vl53l0x-tof. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# HC-SR04 vs VL53L0X ToF

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-SR04 | VL53L0X ToF | Source |
| --- | --- | --- | --- |
| Principle | Ultrasonic, 40 kHz echo timing | Laser time of flight, 940 nm VCSEL, Class 1 | ElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, p. 1 |
| Range | 2 cm to 400 cm | Up to 1.2 m default profile, up to 2 m long-range profile indoors on white | ElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, pp. 26, 28 |
| Beam | 15° measuring angle | 25° field of view | ElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, p. 1 |
| Interface | Trig and Echo pulse timing on two GPIOs | I2C up to 400 kHz, address 0x29 (7-bit) | ElecFreaks HC-SR04 datasheet, pp. 1, 2; ST VL53L0X datasheet DocID029104 Rev 2, pp. 1, 18 |
| Measurement time | 60 ms or more between readings | 33 ms typical timing budget, 20 ms high-speed, 8 ms minimum period | ElecFreaks HC-SR04 datasheet, p. 2; ST VL53L0X datasheet DocID029104 Rev 2, pp. 15, 28 |
| Supply | 5 V DC | Chip 2.6 V to 3.5 V; regulated breakouts take 3.3 V or 5 V | ElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, p. 6 |
| Current | 15 mA | 19 mA average while ranging | ElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, p. 23 |
| Target needs | At least 0.5 m², as smooth as possible, facing the sensor | Any reflectance; darker targets shorten range (80 cm typical on 17 % grey) | ElecFreaks HC-SR04 datasheet, p. 3; ST VL53L0X datasheet DocID029104 Rev 2, p. 26 |
| Several on one board | Two GPIOs per sensor | All start at 0x29; use XSHUT to give each a new address at power-up | ElecFreaks HC-SR04 datasheet, p. 1; ST VL53L0X datasheet DocID029104 Rev 2, p. 18; Adafruit VL53L0X guide |

## 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 ToF 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

- 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).

## 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).

## References

- [HC-SR04](https://www.tinkered.ai/components/hc-sr04.md)
- [VL53L0X ToF](https://www.tinkered.ai/components/vl53l0x-tof.md)
- ElecFreaks HC-SR04 datasheet
- ST VL53L0X datasheet DocID029104 Rev 2

## Try it

Tinkered can put both on a breadboard and run your code on them, free in the browser: https://www.tinkered.ai/compare/hc-sr04-vs-vl53l0x-tof
