How to make the TFMINI rangefinder talk I2C

Hi

Does this method also work for the TF mini plus as well?

Thank you

Probably, if not you may need to reduce the data rate

Thank you for your help pporier, and just confirming this has been successfully used on a pixRacer if you’re using a UBEC or similar for power?

No need for UBEC if its just one TFMINI

Hello,

I am struggling with connecting the TFMINI Plus to Pixhawk Mini. I decided not to use UART version, due to lack of serial ports on my PX, but I2C.
I found out that the I2C does not work out of the box (on my Pix at least). I found the command 5A 05 0A 01 can switch the interface from serial onto I2C. Pressed the button and the data on serial port stopped updating. Looks like the working interface is now I2C.
Unfortunately ArduPlane that I am using still does not see it at any option withing I2C in rangefinders.
Any ideas how to properly set the TFMini Plus to talk to Pix directly via I2C (skipping the Arduino Pro Mini).

Thank you in advance for your help and support.
Hubert

Hardware:
Pixhawk MINI by 3DR (ArduPlane V3.9.4)
TFMini Plus

1 Like

I suggest you follow this thread

1 Like

Hello, great topic!
I got everything working. The pixhawk/missionplanner displays the distance correctly. But when it exeeds +/-2m it displays 0.13 and will not change anymore. When I restart the arduino pro mini (cut of power and reapply it) it willl display again, only if the distance measured is below +/-2m. In the Benewake GUI it measures a range that exeeds the 2m so the sensor should be fine.

Powering the arduino and TFMINI with an external powersupply at the moment for testing

Any suggestions?

Hello,
You have to find if the problem is on the sensor side or on the FC side.
Can you send static value above 2M just to check if FC reads ok?

1 Like

Thanks for the fast response.
When I set distance to 300 or more it keeps showing op normal in missionplanner (3 for 300 etc) so the FC part should be fine. The sensor displays distances of 4m+ in the benewake GUI with good accuracy.

In that case you can try reading and outputting on Arduino serial monitor

1 Like

I could try it out, but for now, I dont know exactly what I changed but it seems to work now. I ran some of the commands for the TFmini again in the GUI

Does Ardupilot 3.6.9 have native support for the TFmini i2c version? If not, is there a workaround with which I can use the TFMini i2c as the only rangefinder on the pixhawk?

I see the new driver has been merged but It’s not on a release yet you have to use Master (beta) release

Hello. I need your help. The fact is that I need to fly 2m above the corn. And when the corn is still small (up to 1m), TF02 measures the distance to the ground and everything is ok. When the corn is large (more than 2m) the leaves are thick, the lidar measures from the leaves and everything is also ok. But there is a period when corn is heterogeneous in the fields, and during one flight the lidar measures from the leaves or from the ground. How to solve this problem? Installing a second lidar will help?

A radar would more appropriate as it bounce on earth, but they are not common at the moment.

Other option would be a surface scan lidar but they are expensive

it has to be in pix mode to work ?

It has to be in binary format to work with with the arduino I2C sketch, not pix

while in bin format
and having uploaded the outdor sketch i wont get corect info to the pixhawk
any help ?
getting 0.2m while crealy io have more than that .

Double check everything and read the thread for similar issues.
I just looked back at the code, you might try changing offset and scaling like this:

uint8_t OffSet = 0 ; //Offset error of the LIDAR
uint8_t Scaling = 1 ; //Benewake outputs in mm, we have to scale to cm

So with 2 TFmini’s going through I2C you can have them both working? I want to have a ROVER stay inside of a hallway or crop row: having one turn left and one turn right when drifting toward wall. Would there be to separate RNGFND_ADDR numbers?