ESP32 TOF200C Time-of-Flight Sensor
Overview
The TOF200C is a compact, low-cost laser-ranging sensor based on the VL53L0X time-of-flight chip from STMicroelectronics. It provides accurate distance measurement using a 940nm VCSEL emitter.
Choose Your Platform
About TOF200C Time-of-Flight Sensor
📏 TOF200C Sensor Overview
- Range: 3cm to 200cm (with 3cm dead zone)
- Interface: I²C digital communication
- Resolution: 1mm accuracy depending on ambient light
- Field of View: 25°
- Operating Voltage: 3.0V to 5.0V
- Typical Current: ~40mA
- Compact: Ideal for embedded and mobile systems
Check Other module sensors based on VL53L0X Time of Flight Sensor:
Where to Buy
Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.
Technical Specifications
3D Printed Enclosure
Protect your ESP32-C3 SuperMini and TOF200C sensor with our custom-designed snap-fit enclosure. Available in multiple colors and configurations, it offers secure housing for both components.
Each enclosure is carefully designed and tested to ensure perfect fit and functionality. Made with premium materials for durability and aesthetics.
Pinout Configuration
The VCC
pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND
pin is the ground connection and must be connected to the ground of your ESP32.
- VIN: Power supply (3.0V – 5.0V)
- GND: Ground
- SDA: I²C Data
- SCL: I²C Clock
- INT: Interrupt output
- SHUT: Shutdown (active low)
Troubleshooting Guide
Common Issues
📡 No Distance Readings
Issue: The sensor always reports 'Out of range'.
Solution: Check power supply and wiring. Ensure SHUT pin is pulled high. Try initializing with a different I²C address if using multiple sensors.
🔌 I²C Not Detected
Issue: Device does not show up on I²C scanner.
Solution: Double-check SDA/SCL connections and use pull-up resistors (~4.7kΩ) if necessary. Ensure address conflicts are avoided if multiple devices share the bus.
⚠️ Unstable Measurements
Issue: Readings fluctuate rapidly.
Solution: Use averaging in code, reduce ambient IR noise (sunlight), and avoid glossy targets.
Debugging Tips
🔍 Serial Monitor
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
⚡ Voltage Checks
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
Code Examples
Arduino Example
#include <Wire.h>
#include <Adafruit_VL53L0X.h>
Adafruit_VL53L0X lox = Adafruit_VL53L0X();
void setup() {
Serial.begin(115200);
Wire.begin();
if (!lox.begin()) {
Serial.println("Failed to initialize TOF200C sensor!");
while (1);
}
Serial.println("TOF200C ready!");
}
void loop() {
VL53L0X_RangingMeasurementData_t measure;
lox.rangingTest(&measure, false);
if (measure.RangeStatus != 4) {
Serial.print("Distance: ");
Serial.print(measure.RangeMilliMeter);
Serial.println(" mm");
} else {
Serial.println("Out of range");
}
delay(500);
}
ESPHome Example
i2c:
sda: 21
scl: 22
sensor:
- platform: vl53l0x
name: "TOF200C Distance"
update_interval: 1s
MicroPython Example
from machine import I2C, Pin
import time
import vl53l0x
# Initialize I2C interface (GPIO21 = SDA, GPIO22 = SCL)
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
# Initialize VL53L0X sensor
tof = vl53l0x.VL53L0X(i2c)
# Start continuous ranging
tof.start()
while True:
distance = tof.read()
print("Distance: {} mm".format(distance))
time.sleep(0.5)
- I2C Setup: Initializes the I2C bus on GPIO21 (SDA) and GPIO22 (SCL), which are typical defaults for ESP32.
- Sensor Initialization: Creates a
VL53L0X
object and starts continuous distance measurement. - Measurement Loop: Reads the distance in millimeters and prints it every 0.5 seconds.
📦 Note: You must install the vl53l0x.py
MicroPython driver on your board. You can find it on GitHub repositories like https://github.com/rsc1975/micropython-vl53l0x
or adapt one to your setup.
Conclusion
The ESP32 TOF200C Time-of-Flight Sensor is a powerful distance sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.