> Source: https://www.tinkered.ai/components/vl53l0x-tof/raspberry-pi-pico (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/vl53l0x-tof/raspberry-pi-pico. 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

# VL53L0X ToF with a Raspberry Pi Pico

The VL53L0X time-of-flight sensor connects to the Raspberry Pi Pico's I2C0, SDA on GP4 and SCL on GP5, at address 0x29, powered from 3V3. Ranging draws more than most I2C sensors, and every VL53L0X starts at the same address, which shapes multi-sensor builds on the Pico.

## Wiring

| VL53L0X ToF | Raspberry Pi Pico | Note |
| --- | --- | --- |
| VCC | 3V3 |  |
| GND | GND |  |
| SCL | GP5 |  |
| SDA | GP4 |  |

## What to know on the Raspberry Pi Pico

- It draws 19 mA on average while ranging, comfortably inside the 300 mA Raspberry Pi recommends for the 3V3 pin even with several sensors. (ST VL53L0X datasheet DocID029104 Rev 2, p. 23; Raspberry Pi Pico datasheet, release 21, p. 8)
- Every VL53L0X powers up at 0x29. For several on one Pico, wire each XSHUT to a GPIO, hold all but one in reset, give the awake one a new address, and repeat. (ST VL53L0X datasheet DocID029104 Rev 2, p. 18; Pololu VL53L0X library (setAddress))
- The bare chip runs from 2.6 V to 3.5 V; the breakout's regulator lets it take the Pico's 3V3, and its I2C lines stay at 3.3 V. (ST VL53L0X datasheet DocID029104 Rev 2, p. 6)
- Leave XSHUT unconnected for a single sensor (the breakout pulls it up); tied to GND it holds the sensor in reset. (Adafruit VL53L0X breakout, pinouts (XSHUT); ST VL53L0X datasheet, XSHUT)

## Code

Libraries: pololu/VL53L0X, adafruit/Adafruit_VL53L0X

```cpp
// VL53L0X ToF on Raspberry Pi Pico: wiring and a free simulation at https://www.tinkered.ai/components/vl53l0x-tof/raspberry-pi-pico
#include <Wire.h>
#include <VL53L0X.h>

VL53L0X sensor;

void setup() {
  Serial.begin(9600);
  Wire.begin();
  if (!sensor.init()) {                 // reads model id 0xEE at 0x29
    Serial.println("VL53L0X not found");
    while (1) {}
  }
  sensor.setTimeout(500);
}

void loop() {
  uint16_t mm = sensor.readRangeSingleMillimeters();
  if (sensor.timeoutOccurred()) {
    Serial.println("VL53L0X timeout");  // no answer in 500 ms: wiring or power
  } else if (mm >= 8190) {
    Serial.println("out of range");     // no target within range
  } else {
    Serial.print(mm);
    Serial.println(" mm");
  }
  delay(200);
}
```

Compiled for rp2040:rp2040:rpipico on 2026-10-30.

## Questions

### Can I use several VL53L0X sensors with one Pico?

Yes: wire each XSHUT to its own GPIO, wake them one at a time and assign each a new I2C address; they all start at 0x29 (ST datasheet, p. 18). The Pico's second I2C controller also helps.

### Why does my Pico print 'VL53L0X timeout'?

No answer within 500 ms: check SDA on GP4, SCL on GP5, 3V3 power and that XSHUT is not pulled low.

### What range does the VL53L0X give on a Pico?

Up to 2 m (ST datasheet, p. 1), the same on any board; readings of 8190 or more mean no target in range.

## More

- [VL53L0X ToF reference](https://www.tinkered.ai/components/vl53l0x-tof.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the VL53L0X ToF on the Raspberry Pi Pico in the browser, with this wiring and code, free: https://www.tinkered.ai/components/vl53l0x-tof/raspberry-pi-pico
