I want to ask about TF-Lunar Lidar, I've written code to know the distance in cm by reading the array data, right now I need some help about how to read the data so it can be showing the more specific value (float or in decimal) Or do you guys know what is the speed of the waves transmitted and captured by the lidar sensor, so that I can calculate it in a more specific form, such as using the method of calculating the distance on the Hc-srf04 sensor I also have used this format to read the distance in mm, but It never works (image about array data) enter image description here

  • 3
    it is unclear what you are trying to do ... you said that you are able to measure the distance in cm ... what is more specific value?
    – jsotola
    May 3, 2021 at 5:19
  • i'm sorry, what i mean is below cm, (mm or below) because the sensor only show it in cm like 1.00, 2.00 it wont show 1.01 or 1.02 sorry for my bad english
    – THe LaNd
    May 3, 2021 at 7:23
  • Re “the speed of the waves”: The “li” in “lidar” stands for “light”. Light waves travel at the speed of light. May 3, 2021 at 7:33
  • so if i inputting the duration of the light travel from trigger to echo, i can find the distance?. will it work?
    – THe LaNd
    May 3, 2021 at 8:17

1 Answer 1


so if i inputting the duration of the light travel from trigger to echo, i can find the distance?. will it work?

That's the basic working principle, but you cannot do that with an Arduino. Light is too fast, resulting in incredibly small travel times. You need specialized hardware for that. And thats, what a Lidar sensor (or other Time Of Flight sensor) are.

The TF-Lunar Lidar sensor supports different output formats. The distance in cm is just the default. There is also the format, that you showed in your question (9 byte mm), which gives you the distance in mm. The manual of the TF-Lunar also explains how to change the used output format (look at page 22: "5.Output format setting ID_OUTPUT_FORMAT=0x05"). How exactly this is done depends on your actual code and the used communication interface (Serial or I2C).

  • 1
    Thank you for the answer sir, that's very helpful and informative. But since I can't use the I2c because I can't find the address when I connect it to Arduino (search the address with the i2c scanner), so I need to research how to find it because I'm still learning to program Arduino without a library (.h file and .cpp file)
    – THe LaNd
    May 6, 2021 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.