I've used ST microLIDAR Time-of-Flight sensors previously to measure short distances. A VL6180X to focus my laser cutter laser-focus-assembly-completed and VL53L0/1X sensors for distances up to 4 meters in projects whose blogs I can't locate on this new site.
I have a requirement for longer distance measurements of 10-12 meters and I came across the LIDAR07 from DFRobot that is spec'ed to measure up to 12 meters: TOF_IR_Distance_Sensor_0.2_12m . One compromise of the longer range is that minimum measurable distance is 20cm.
In honor of the 10 millionth Arduino Uno, I decided to use one for my initial tests .
The LIDAR07 uses either a UART or I2C interface. I am going to use I2C.
I 3D printed a tripod mount and wired a small proto board to interface the 8 pin cable to a Grove connector since I have a lot of Grove cables.
I downloaded and installed the DFRobot_LIDAR07 Arduino library from github DFRobot_LIDAR07 .
Lidar07_I2C_measureDistance.ino
/** * @file measureDistance.ino * @brief This example demonstrated the basic distance measuring function of LIDAR07, the range is 0.2m-12m (Operating voltage: 5 V) * @n Connection rules: PIN1-PIN8 are in the front of the sensor from right to left. * @n PIN1----------------------SCL--------------------Maincontroller SCL(IIC mode) * @n PIN2----------------------SDA--------------------Maincontroller SDA(IIC mode) * @n PIN3----------------------Light source power supply ground--------------Maincontroller GND * @n PIN4----------------------Light source power supply(5V)--------Maincontroller VCC * @n PIN5----------------------TX---------------------Maincontroller RX pin, which is set to be used for serial communication with the sensor (UART mode) * @n PIN6----------------------RX---------------------Maincontroller TX pin, which is set to be used for serial communication with the sensor (UART mode) * @n PIN7----------------------Module main power supply ground------------Maincontroller GND * @n PIN8----------------------Module main power supply(5V)------Maincontroller VCC * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) * @licence The MIT License (MIT) * @author [yangfeng]<feng.yang@dfrobot.com> * @version V1.0 * @date 2021-04-16 * @get from https://www.dfrobot.com * @url https://github.com/DFRobot/DFRobot_LIDAR07 */ #include"DFRobot_LIDAR07.h" //If using IIC mode, please enable macro USE_IIC #define USE_IIC #ifdef USE_IIC DFROBOT_LIDAR07_IIC LIDAR07; #endif //If using UART mode, please enable macro USE_UART. The USE_UART is enabled by default. The two modes USE_IIC and USE_UART can’t be used at the same time. //#define USE_UART #ifdef USE_UART #if defined(ESP8266)||defined(ARDUINO_AVR_UNO) #include <SoftwareSerial.h> SoftwareSerial mySerial(4,12);//GPIO4 is corresponding to RX on main control board, GPIO12 is corresponding to TX on main control board /**! * The TX of esp32 Serial1 is GPIO10, and the RX is GPIO9 * The TX of mega2560 Serial1 is GPIO18, and the RX is GPIO19 * The TX of M0 Serial1 is GPIO1, and the RX is GPIO0 * The TX of leonardo Serial1 is GPIO1, and the RX is GPIO0 */ #endif DFROBOT_LIDAR07_UART LIDAR07; #endif void setup() { uint32_t version; Serial.begin(115200); #ifdef USE_IIC while(!LIDAR07.begin()){ Serial.println("The sensor returned data validation error"); delay(1000); } #endif #ifdef USE_UART #if defined(ESP8266)||defined(ARDUINO_AVR_UNO) mySerial.begin(115200); while(!LIDAR07.begin(mySerial)){ Serial.println("The sensor returned data validation error"); delay(1000); } #else Serial1.begin(115200); while(!LIDAR07.begin(Serial1)){ Serial.println("The sensor returned data validation error"); delay(1000); } #endif #endif version = LIDAR07.getVersion(); Serial.print("VERSION: "); Serial.print((version>>24)&0xFF,HEX); Serial.print(".");Serial.print((version>>16)&0xFF,HEX); Serial.print(".");Serial.print((version>>8)&0xFF,HEX); Serial.print(".");Serial.println((version)&0xFF,HEX); LIDAR07.startFilter(); //After enabling the filter, it can be stopped by calling LIDAR07.stopFilter() } void loop() { int errinfo; while(!LIDAR07.startMeasure()){ Serial.println("Incorrect data was returned"); delay(1000); } Serial.print("Distance:");Serial.print(LIDAR07.getDistanceMM());Serial.println(" mm"); Serial.print("Amplitude:");Serial.println(LIDAR07.getSignalAmplitude()); delay(1000); }
Here is a sample of readings from the Serial Monitor:
You can see that the amplitude of the received signal reduces as the distance to the target increases. Another issue with this sensor is that the minimum required target size increases by quite a bit with distance. It is 0.9m at 12 meters. Luckily, I am looking for larger objects and this would possibly act as a filter to exclude small animal detection.
Accuracy and repeatability will not be as good as the shorter range sensors, but if it's good to ~20cm - that will be sufficient for my use case. That's something that I'll need to characterize.
For outdoor and full range testing, I'm going to hook the sensor up to an ESP32.