The TOF10120 sensor module is a compact, high-performance Time-of-Flight (ToF) distance sensor that utilizes laser light to accurately measure distances from 10 cm up to 180 cm. The sensor operates on the principle of ToF by emitting a very short infrared light pulse and then measuring the time it takes for the light to bounce back from the object. This technology allows for precise distance measurements, making it ideal for a wide range of applications such as robotics, obstacle avoidance systems, automation, and user presence detection.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground connection |
3 | TX | UART Transmit (connect to RX of MCU) |
4 | RX | UART Receive (connect to TX of MCU) |
5 | SCL | I2C Clock (optional use) |
6 | SDA | I2C Data (optional use) |
Q: Can the TOF10120 be used outdoors? A: Yes, but direct sunlight may interfere with the measurements. It is best used in shaded or indoor environments.
Q: What is the maximum baud rate for UART communication? A: The TOF10120 supports a baud rate of up to 115200 bps.
Q: How can I change the I2C address of the sensor? A: The I2C address is fixed and cannot be changed.
#include <SoftwareSerial.h>
SoftwareSerial TOFSerial(10, 11); // RX, TX
void setup() {
Serial.begin(9600);
TOFSerial.begin(115200); // Default baud rate for TOF10120
}
void loop() {
if (TOFSerial.available()) {
int distance = TOFSerial.read() << 8;
distance |= TOFSerial.read(); // Read two bytes to get distance
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" mm");
}
}
Note: This example uses the SoftwareSerial
library to create a serial connection on pins 10 and 11 of the Arduino UNO. The TOF10120 sends two bytes for each distance measurement, which are combined to form the final distance value in millimeters. Ensure that the TOF10120 is connected with the TX pin to pin 10 and the RX pin to pin 11 on the Arduino UNO.