Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

VL53L0X laser distance sensor with ESP32-C3 SuperMini

Measure distance up to about 2 m with a VL53L0X time-of-flight sensor on an ESP32-C3 SuperMini, I2C on GPIO5/6 at address 0x29.

Arduino C++Verified — core esp32 3.3.12, VL53L0X 1.3.1, 3 Nov 2026Compile-only

Community draft — report a mistake

The VL53L0X measures distance with an infrared laser pulse — narrower beam than an ultrasonic sensor, no 5 V, and good from about 3 cm to 1.2–2 m indoors.

On the SuperMini wire VIN to 3V3, SDA to GPIO5 and SCL to GPIO6. The sketch uses the Pololu library in continuous mode and prints a reading five times a second.

Wiring

ESP32-C3 SuperMiniOnly the pins used are shown · 3.3 V logicVL53L0X ToF distance sensorGND3V35 · 56 · 6VINGNDSCLSDAGPIO1 (not connected)XSHUT (not connected)
Every connection
ESP32-C3 SuperMiniVL53L0X ToF distance sensorWireNotes
3V3VINred
GNDGNDblack
6SCLyellow
5SDAblue

2.6–5 V (on-board regulator) part, 3.3 V board. Breakouts with a regulator and level shifting accept 3.3 V or 5 V. Bare boards without them are 2.8 V-only — check the listing.

Board quirks

  • I2C on GPIO5/6 — the core’s default GPIO8/9 are strapping pins carrying the SuperMini’s LED and BOOT button.
  • Peel the clear protective film off the sensor window. With it on, readings stick around 20–50 mm.
  • Unlike the HC-SR04 the VL53L0X is a 3.3 V part, so there is no divider and it fits a battery-powered SuperMini project.
  • Every VL53L0X starts at 0x29. For two sensors, hold one in reset with XSHUT and change the other’s address with setAddress().

Code

vl53l0x-esp32c3.inoArduino C++Open in PlaygroundOpen in PlaygroundFlash
// VL53L0X time-of-flight distance sensor on an ESP32-C3 SuperMini over I2C (address 0x29).
// VIN → 3V3, GND → GND, SDA → GPIO5, SCL → GPIO6. XSHUT and GPIO1 left open.
#include <Wire.h>
#include <VL53L0X.h>

constexpr int SDA_PIN = 5;
constexpr int SCL_PIN = 6;
VL53L0X sensor;

void setup() {
  Serial.begin(115200);
  delay(1500);  // let the native USB serial port enumerate
  Wire.begin(SDA_PIN, SCL_PIN);  // GPIO8/9 are strapping pins on the C3 — not used for I2C
  sensor.setBus(&Wire);
  sensor.setTimeout(500);
  if (!sensor.init()) {
    Serial.println("VL53L0X not found at 0x29 — check wiring and remove the protective film");
    while (true) delay(1000);
  }
  sensor.startContinuous();  // back-to-back measurements (~33 ms each)
  Serial.println("VL53L0X ready");
}

void loop() {
  uint16_t mm = sensor.readRangeContinuousMillimeters();
  if (sensor.timeoutOccurred()) {
    Serial.println("Timeout");
  } else if (mm >= 8190) {
    Serial.println("Out of range");
  } else {
    Serial.printf("Distance: %u mm\n", mm);
  }
  delay(200);
}

Library: VL53L0X (Pololu) — compiled with VL53L0X 1.3.1.

Expected serial output

Serial Monitor · 115200Output
VL53L0X ready
Distance: 412 mm
Distance: 409 mm
Out of range

Common errors

“VL53L0X not found at 0x29”

Check SDA/SCL and power. I2C troubleshooting.

Readings are short or stuck

Protective film still on, or the target is dark/shiny. White, matt targets read best.

↑↓ to move · Enter to open