====== LamaPLC: TOFnnnC STMicroelectronics Time-of-Flight (ToF) sensors with I²C communication ====== {{ :sensor:tof400c.png?150|TOF400C}} The TOF050C, TOF200C, and TOF400C are a series of laser ranging sensor modules that use Time-of-Flight (ToF) technology to measure distances. They are designed for easy integration with microcontrollers such as Arduino and STM32 via the I²C interface. These modules are based on different underlying STMicroelectronics chips, which determine their maximum measuring distances. They are commonly used in applications such as robot obstacle avoidance, altitude measurement for drones, and gesture recognition. ^Model^Ranging Chip^Max. Measuring Distance^Field of View (FoV)^Infrared Wavelength| ^TOF050C|VL6180|50 cm|25°|850 nm| ^TOF200C|VL53L0X|2 meters|25°|940 nm| ^TOF400C|VL53L1X|4 meters|27°|940 nm| **Common Specifications:** \\ * **Communication Mode:** I²C digital interface, default address: **0x52** * **Operating Voltage:** **3.0V to 5.0V DC** * **Typical Current Consumption:** ~40mA (max) * **Operating Temperature:** -20°C to 70°C. * **Key Features:** * Measure absolute range independent of object color and reflectance * Equipped with a dedicated optical cover for dust protection and ambient light resistance * Feature M2 mounting holes for easy installation * Compatible with Arduino, STM32, ESP32, and other microcontroller platforms {{page>:tarhal}} ==== Pinout ==== ^Pin Name^Type^Description| |VIN|Power|Power supply input, typically 3.0V to 5.0V| |GND|Power|Ground connection| |SCL|I²C|Serial Clock line for I²C communication| |SDA|I²C|Serial Data line for I²C communication| |INT|Output|Interrupt output; can signal the MCU when data is ready (often labeled GPIO1 on the chip)| |SHUT|Input|Shutdown control (Active Low); pull low to enter standby, high to enable (often labeled XSHUT)| Most TOF400C modules include an onboard voltage regulator that supports 3.3V or 5V. ==== Arduino Example Code ==== The **Pololu VL53L1X** library is recommended for its lightweight footprint and ease of use. #include #include VL53L1X sensor; void setup() { Serial.begin(115200); Wire.begin(); Wire.setClock(400000); // 400 kHz I2C for better performance sensor.setTimeout(500); if (!sensor.init()) { Serial.println("Failed to detect TOF400C sensor!"); while (1); } // TOF400C supports three modes: Short (1.3m), Medium (3m), Long (4m) sensor.setDistanceMode(VL53L1X::Long); // Timing budget: more time = higher accuracy (min 20ms short, 33ms long) sensor.setMeasurementTimingBudget(50000); // 50ms // Start continuous readings every 50ms sensor.startContinuous(50); } void loop() { // Read distance in millimeters uint16_t distance = sensor.read(); Serial.print("Distance: "); Serial.print(distance); Serial.println(" mm"); if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT!"); } } ===== I²C topics on lamaPLC ===== {{topic>i2c}} \\ \\ {{tag>TOF050C VL6180 TOF200C VL53L0X TOF400C VL53L1X STMicroelectronics Time-of-Flight ToF i2c communication sensor arduino code}} This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}