How do I read from a correct data address of LIDAR using Arduino in I2C?

good shout, I'll change that now lool

You could drop that comment altogether, requestFrom's parameter are pretty obvious.

I was curious about the electrical parameters of the sensor, so I contacted the manufacturer.

Hello Sir,
Thank you for choosing our product.
The supply from 5V to 12V is acceptable.
Logic level of TF02-Pro is 3.3V but it's 5V logic voltage tolerant.
Means that LiDAR accepts 5V logical voltage but by itself it will output only 3.3V logical signal.
Our LiDAR has pull-up resistors already.

I was asked what the application is, so please enlighten me. :grinning:

The safest and most reliable way to run the sensor,
would be to use a level converter, 5V to 3.3V.

@anon25954873:

Most people on this forum will NOT download code from unknown, untrusted web sites.

If you want help, post your code in line, using code tags. Better, start your own thread.

#include <Wire.h>



char i = 0; 
byte rx_buf[9] = {0};

const int16_t I2C_SLAVE = 0x10;

void setup() {
  Wire.begin(); // join i2c bus (address optional for master)
  Serial.begin(115200);  // start serial for output print
  Serial.print("Ready to Read TF02-Pro IIC\r\n");
  pinMode(LED_BUILTIN, OUTPUT);//LED: This blinking of LED is added just to indicate reading of data, and iteration of loop
}


void loop() {
  Get_LidarDatafromIIC(I2C_SLAVE);
  //Get_LidarDatafromIIC(0x11);//if you connect
  //Get_LidarDatafromIIC(0x12);//if you connect
  //Get_LidarDatafromIIC(0x13);//if you connect
  delay(100);
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100); 
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
}

void Get_LidarDatafromIIC(byte address){ 
  Wire.beginTransmission(address); // Begin a transmission to the I2C Slave device with the given address. 
  Wire.write(0x5A); // see product mannual table 11:Obtain Data Frame
  Wire.write(0x05); // 
  Wire.write(0x00); // 
  Wire.write(0x01); // 
  Wire.write(0x60); // 
  Wire.endTransmission(0);  // Send a END Sign
  delay(100);
  Wire.requestFrom(address, 9); // request 9 bytes from slave device address
  //print the result via serial
  Serial.print("Address=0x");
  Serial.print(address,HEX);
  Serial.print(":   ");
   while ( Wire.available()) 
  { 
    rx_buf[i] = Wire.read(); // received one byte 
    Serial.print("0x");
    Serial.print(rx_buf[i],HEX);
    Serial.print(";");
    i++; 
    if(i>=9)
    {
      i=0;
      Serial.print("---------->");
      Serial.print("Distance=");
      Serial.print(rx_buf[3]*256+rx_buf[2]);
      Serial.print(";");
      Serial.print("Strength=");
      Serial.print(rx_buf[5]*256+rx_buf[4]);
    }
  }
  Serial.print("\r\n"); 
}

Try this code

Application? As in how I'm using it? It's to be used to count cones on a fixed-width track. The purpose for doing so however alludes me.

I'm guessing I got a bit of research to do, I have no idea what a level converter is atm. Still, all interesting stuff indeed

I think that will do.

It seems to be a very customer friendly company,
If I have any LIDAR application in the future,
I will definitely try to use one of their sensors.

It changes voltage levels in both directions, which you need for the I2C.

I like these, they are easy to connect, can be tristated to isolate bus sections
and have good documentation because it's basically a breakout board of a single chip.

https://de.aliexpress.com/item/1005001848929294.html

You only need two lines for the I2C, so these should work too,
but I find them a lot more confusing.

https://de.aliexpress.com/item/32641893149.html

https://de.aliexpress.com/item/32771873030.html

I have one more information to add about the I2C pull-ups (to 3.3V)

The pull-up resistor value is 2.2K Ohm.