The LiDAR TF Mini S (SEN0259) by Benewake is a compact and versatile Light Detection and Ranging (LiDAR) sensor designed for accurate distance measurement. Utilizing laser light, this sensor can measure distances to objects with high precision, making it an essential component in robotics, drones, and autonomous vehicles for obstacle detection, navigation, and mapping.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (5V) |
2 | GND | Ground connection |
3 | RX | UART Receive (connect to TX of the controller) |
4 | TX | UART Transmit (connect to RX of the controller) |
5 | SDA | I2C Data (optional use) |
6 | SCL | I2C Clock (optional use) |
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
Serial.begin(115200);
mySerial.begin(115200); // Initialize the connection with the LiDAR
}
void loop() {
if (mySerial.available()) { // Check if data is available to read
uint8_t highByte = mySerial.read(); // Read the high byte (distance)
uint8_t lowByte = mySerial.read(); // Read the low byte (distance)
uint16_t distance = (highByte << 8) + lowByte; // Calculate the distance
Serial.print("Distance: ");
Serial.print(distance);
Serial.println("cm");
}
delay(100); // Wait for a short period before reading again
}
Q: Can the LiDAR TF Mini S be used outdoors? A: Yes, but it should be protected from direct sunlight and harsh weather conditions to maintain accuracy.
Q: What is the maximum baud rate for UART communication? A: The maximum baud rate for the TF Mini S is 115200bps.
Q: How can I change the communication interface from UART to I2C? A: The communication interface can be changed using the Benewake provided software tools or by sending specific commands to the sensor. Refer to the manufacturer's guide for detailed instructions.