Ordered on weekdays before 14:00 = shipped the same day and delivered the next day in 98% of cases. Free returns 30-day reflection period 1-year warranty

Wiring diagram and code example

How to connect the TOF400C-VL53L1X Distance Sensor Time-Of-Flight 4-400cm to an Arduino UNO or ESP32, with an example sketch you can upload straight away.

VL53L1X Time-of-Flight Distance Measurement

Connect the TOF400C VL53L1X Time-of-Flight sensor to your Arduino Uno using I2C. The sketch initializes the sensor in long-distance mode (up to 4 meters) and continuously measures distance with millimeter precision. Open the Serial Monitor at 115200 baud to view real-time distance readings.

Wiring diagram: TOF400C-VL53L1X Distance Sensor Time-Of-Flight 4-400cm on an Arduino UNO
Wiring diagram · Click to enlarge
Connection table: TOF400C-VL53L1X Distance Sensor Time-Of-Flight 4-400cm on an Arduino UNO
Connection table · Click to enlarge
VL53L1X_Time_of_Flight_Distance_Measurem.ino · compiled and verified
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : VL53L1X Time-of-Flight Distance Measurement
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : TOF400C-VL53L1X Distance sensor Time-Of-Flight very accurate 4-400cm
 *  Libraries : VL53L1X 1.3.1
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include <Wire.h>
#include <VL53L1X.h>

VL53L1X sensor;

void setup() {
  Serial.begin(115200);
  Wire.begin();
  Wire.setClock(400000); // 400 kHz I2C

  sensor.setTimeout(500);
  if (!sensor.init()) {
    Serial.println(F("Failed to detect and initialize sensor!"));
    while (1) {
      delay(1000);
    }
  }

  // Use Long distance mode (up to 400 cm)
  sensor.setDistanceMode(VL53L1X::Long);
  sensor.setMeasurementTimingBudget(50000);

  // Start continuous ranging with 50 ms period
  sensor.startContinuous(50);
  Serial.println(F("VL53L1X sensor ready. Reading distances..."));
}

void loop() {
  uint16_t distanceMm = sensor.read();

  Serial.print(F("Distance: "));
  Serial.print(distanceMm);
  Serial.print(F(" mm  ("));
  Serial.print(distanceMm / 10.0, 1);
  Serial.print(F(" cm)"));

  if (sensor.timeoutOccurred()) {
    Serial.print(F(" [TIMEOUT]"));
  }

  Serial.println();
  delay(100);
}

Required libraries: VL53L1X 1.3.1

Wiring diagram and example code generated by Codey.online — https://www.codey.online

VL53L1X Time-of-Flight Distance Meter

This circuit connects a VL53L1X laser time-of-flight sensor to the ESP32 over I2C to measure distances from 4 cm up to 400 cm. Open the Serial Monitor at 115200 baud to view real-time distance readings in millimeters.

Wiring diagram: TOF400C-VL53L1X Distance Sensor Time-Of-Flight 4-400cm on an ESP32 DevKit V1
Wiring diagram · Click to enlarge
Connection table: TOF400C-VL53L1X Distance Sensor Time-Of-Flight 4-400cm on an ESP32 DevKit V1
Connection table · Click to enlarge
VL53L1X_Time_of_Flight_Distance_Meter.ino · compiled and verified
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : VL53L1X Time-of-Flight Distance Meter
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : TOF400C-VL53L1X Distance sensor Time-Of-Flight very accurate 4-400cm
 *  Libraries : VL53L1X 1.3.1
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include <Wire.h>
#include <VL53L1X.h>

VL53L1X sensor;

void setup() {
  Serial.begin(115200);
  Wire.begin(21, 22);
  Wire.setClock(400000);

  sensor.setTimeout(500);
  if (!sensor.init()) {
    Serial.println("Failed to detect and initialize VL53L1X sensor!");
    while (1) {
      delay(10);
    }
  }

  // Use Long distance mode (up to 4 meters) and 50 ms timing budget
  sensor.setDistanceMode(VL53L1X::Long);
  sensor.setMeasurementTimingBudget(50000);
  sensor.startContinuous(50);

  Serial.println("VL53L1X ready! Measuring distance...");
}

void loop() {
  uint16_t distanceMm = sensor.read();

  if (sensor.timeoutOccurred()) {
    Serial.println("Measurement timeout!");
  } else {
    Serial.print("Distance: ");
    Serial.print(distanceMm);
    Serial.print(" mm (");
    Serial.print(distanceMm / 10.0, 1);
    Serial.println(" cm)");
  }

  delay(100);
}

Required libraries: VL53L1X 1.3.1

Wiring diagram and example code generated by Codey.online — https://www.codey.online

TOF400C-VL53L1X Distance Sensor Time-Of-Flight 4-400cm

Mini laser distance sensor module with an accuracy of 1mm and large range.

Model: TOF400C-VL53L1X
Voltage: 3V to 5V
Current consumption: 40 mA (max)
Distance: 4cm to 400cm

Connections:
- VIN
- GND
- SDA
- SCL
- INT
- SHUT


Communication: the I2C communication protocol (fully compatible with 3-5V systems)

Suitable for Arduino, ESP8266 and ESP32.

Multiple sensors on 1 I2C line possible because the sensors can be assigned an I2C address via software.

The TOF400C-VL53L1X Time Of Flight laser sensor is a very precise and reliable sensor that can be used for a wide range of applications, including distance measurement, motion detection, and navigation.

One of the main advantages of this sensor is its precision. The sensor uses laser technology to measure the distance to an object, resulting in much more accurate results than, for example, an infrared sensor. This makes the sensor suitable for use in drones, industrial automation, and robots.

In addition, the sensor is also very easy to use. It is compatible with a wide range of microcontroller platforms, including Arduino, Raspberry Pi, and STM32, and there are many examples and libraries available to help you integrate the sensor into your project.

Finally, the sensor is also very small and lightweight, making it easy to integrate into a wide range of applications. The 2 screw holes also make it very easy to securely mount this sensor.

Dimensions
Length: 1.3cm
Width: 1.04cm
Height: 0.32cm

  • Laser distance sensor
  • 1 mm accuracy
  • 4-400 cm range
  • 6 connections

Why choose this product?

  • Very accurate – Measures distance with 1 mm accuracy.
  • Long range – Measures distances from 4 to 400 cm.
  • Easy integration – Compatible with Arduino, Raspberry Pi and STM32.
  • Multiple sensors – Multiple sensors possible on one I2C line.
  • Compact size – Small and lightweight, easy to integrate.
  • Secure mounting – Two screw holes for sturdy mounting.
Specifications
Dimensions1,3 cm x 1,04 cm x 0,32 cm
InterfaceI2C
Suitable forArduino, ESP8266 and ESP32
Power consumption40 mA
ModelTOF400C-VL53L1X
Distance4cm to 400cm

Reviews

★★★★★ 5,0/5 1 review
  • ★★★★★Joep KievitsVerified purchase

    4 meter range!

Write a review
Your rating

Shipping & returns

Shipping

  • Parcel with track & trace€ 7,70Within 24 hours
  • Pick up at PostNL location€ 7,40Within 24 hours
  • Letterbox parcel€ 3,70Within 2 business days
  • Letterbox parcel 24 hours€ 4,55Within 24 hours
  • Pick up in storeFree
All about shipping

Returns

Not satisfied? You have 30 days after delivery to return the product.

All about returns

Recently viewed