Time-of-Flight Distance Sensors for Makers: VL53L0X, VL53L1X, and TFMini Compared
Ultrasonic rangefinders like the HC-SR04 are the default answer whenever a maker project needs to measure distance, and for a lot of projects they're fine. But ultrasonic sensing has real limits — soft or angled surfaces absorb or deflect the sound wave, narrow objects can be missed entirely, and the measurement cone widens with distance, so you're never entirely sure what you actually detected. Time-of-flight (ToF) sensors solve most of these problems by measuring the actual travel time of a pulse of light rather than sound, and the parts to do it — the VL53L0X, VL53L1X, and TFMini family — have become cheap and well-supported enough that there's rarely a good reason to reach for an ultrasonic sensor by default anymore. This guide compares the three most common maker-accessible ToF options and covers wiring and calibration basics for each.
How Time-of-Flight Ranging Actually Works
A ToF sensor emits a short pulse of infrared laser or LED light and measures, with picosecond-scale timing circuitry, how long it takes for reflected light to return to an onboard photodiode array. Distance is simply (speed of light × time of flight) / 2. Because light travels in a much tighter beam than an ultrasonic pulse and isn't affected by soft or sound-absorbing surfaces the way ultrasonic sensing is, ToF gives a narrower, more precise measurement cone and works reliably on materials — foam, fabric, dark non-reflective objects — that give ultrasonic sensors trouble. The tradeoff is that highly reflective or transparent surfaces (glass, polished metal, glossy black plastic) can occasionally confuse a ToF sensor's return signal, which is the mirror-image failure case of ultrasonic's soft-surface problem.
Comparing the Common Options
SensorRangeInterfaceBest forNotes VL53L0X~2cm–2m (up to ~1.2m reliably)I2CShort-range presence/proximity detection, robotics obstacle sensingCheapest and most common; single-zone ranging, narrow ~25° field of view; widely cloned on breakout boards under $3 VL53L1X~4cm–4mI2CLonger-range robotics, drone altitude hold, liquid level sensingSuccessor to the L0X with roughly double the range and a selectable field of view (15°–27°); supports multi-zone/region-of-interest ranging on the same silicon TFMini / TFMini-S / TFMini Plus0.1–12m (TFMini-S), up to 40m outdoor (TFMini Plus)UART or I2COutdoor rangefinding, drone altitude, robotics navigation, security/gate sensingUses a discrete LIDAR module rather than an integrated ST sensor package; much better performance in bright outdoor sunlight than the VL53 familyFor most indoor maker projects — a box that detects when a part is present, a robot that needs to stop before hitting a wall, an automated pet feeder that senses bowl level — the VL53L0X is the cheapest starting point and is more than accurate enough. Reach for the VL53L1X when 2 meters isn't enough range or when you need the multi-zone ranging to distinguish between a few different regions in the sensor's field of view without adding a second sensor. The TFMini family is the right call outdoors or any time you need meters of range in direct sunlight, where the VL53 family's shorter-range IR laser struggles against ambient light.
Wiring the VL53L0X / VL53L1X (I2C)
Sensor PinConnects To VIN3.3V (most breakouts have an onboard regulator, but check — some are 3.3V logic only, and ESP32 GPIO is not 5V tolerant) GNDGND SDAESP32/Arduino SDA (GPIO21 on most ESP32 dev boards) SCLESP32/Arduino SCL (GPIO22 on most ESP32 dev boards) XSHUTA free GPIO pin — used to reset/enable the sensor, and essential if you're running multiple ToF sensors on one busEvery VL53L0X and VL53L1X breakout ships with the same default I2C address (0x29), which is a problem the moment you want more than one sensor on a bus — a common need for a robot that wants front, left, and right obstacle sensing. The fix is to wire each sensor's XSHUT pin to a separate GPIO, hold all but one sensor in reset at boot, initialize the active sensor and assign it a new I2C address in software, then release the next sensor from reset and repeat. Adafruit's and Pololu's VL53L0X/L1X Arduino libraries both include multi-sensor examples that handle this address-reassignment sequence — don't try to write it from scratch on your first attempt.
Wiring the TFMini (UART Mode)
Sensor PinConnects To 5V5V supply (TFMini modules are 5V-powered even when the UART logic level output is 3.3V — check your specific module's datasheet) GNDGND TXESP32/Arduino RX (a hardware or software UART, not the same pins used for USB programming) RXESP32/Arduino TXThe TFMini streams distance frames continuously over UART at 115200 baud by default in most firmware versions, so reading it is mostly a matter of parsing a fixed-length frame (typically 9 bytes, starting with a 0x59 0x59 header) rather than polling like an I2C sensor. Some TFMini variants also support an I2C mode selectable via a configuration command, which is worth using if you're already tight on UART peripherals on an ESP32 project that also needs serial debug output.
Calibration and Accuracy Notes
- Surface reflectivity affects maximum range more than accuracy. A low-reflectivity target (dark, matte, or foam) will reduce the maximum reliable range of any ToF sensor significantly compared to the datasheet's white-target rating — plan for real-world range to be noticeably shorter than the spec sheet number against dark materials.
- Ambient IR light causes noise, not systematic error. Direct sunlight is the main enemy of the VL53 family specifically; if a project needs to work outdoors in daylight, either shield the sensor from direct sun or move to a TFMini-class sensor designed for it.
- Angle of incidence matters. Measuring a surface at a steep angle rather than straight-on reduces the returned signal strength and can produce erratic or dropped readings well before the nominal maximum range.
- Averaging beats one-shot precision. All three sensor families benefit from taking several readings and using a median or rolling average rather than trusting a single sample, especially near the edges of their range or against marginal surfaces.
Choosing Between ToF and Ultrasonic for a New Project
ToF is generally the better default for anything involving robotics navigation, precise proximity detection, or measuring distance to varied or soft materials. Ultrasonic sensors still have a place — they're cheaper, tolerant of dusty or smoky environments where IR sensors can be fooled, and don't care about the color or reflectivity of the target the way ToF can. For a project running inside a laser cutter's smoke plume or a dusty CNC enclosure, for example, an ultrasonic sensor may actually be the more robust choice specifically because it isn't affected by particulate the way an optical sensor is.
Time-of-flight sensing used to be exotic, expensive hardware reserved for industrial robotics; today it's a two-dollar breakout board and a well-documented Arduino library. For most obstacle-detection, presence-sensing, and short-range distance measurement needs in a maker project, it's worth defaulting to a ToF sensor over ultrasonic unless a specific reason — cost, dust tolerance, or an existing design already built around ultrasonic — points the other way.
Related Guides
- I2C vs SPI vs UART: How to Choose and Use Serial Communication Protocols
- I2C Wiring and Protocol Guide for Arduino, ESP32, and Raspberry Pi
- Shift Registers and I/O Expanders for Arduino and ESP32: 74HC595, MCP23017, and PCF8574 Explained
- Battery Fuel Gauge ICs for Lithium Projects: MAX17048, BQ27441, and Coulomb Counting Explained
- Real-Time Clock Modules for Arduino and ESP32: DS3231 vs DS1307, Battery Backup, and NTP Sync
- CAN Bus for Makers: ESP32 TWAI and MCP2515 Wiring, Termination, and Message Design
- Capacitive Touch Sensing for Makers: TTP223, MPR121, and ESP32 Native Touch Pins
- Driving Many Servos with a PCA9685 PWM Driver: I2C Wiring for Raspberry Pi and ESP32 Robotics